CICD #33
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "CICD" | |
on: | |
push: | |
branches: | |
- '**' | |
workflow_call: | |
workflow_dispatch: | |
jobs: | |
setup: | |
runs-on: self-hosted | |
environment: 'dev' | |
steps: | |
- uses: actions/checkout@v3 | |
name: "Checkout code" | |
build: | |
runs-on: self-hosted | |
environment: 'dev' | |
needs: setup | |
outputs: | |
build-id: ${{ steps.build.outputs.build-id }} | |
steps: | |
- uses: ./.github/actions/build-container | |
name: "Build container image" | |
id: build | |
run: | |
runs-on: self-hosted | |
environment: 'dev' | |
needs: build | |
outputs: | |
run-all-opts-port: ${{ steps.run-all-opts.outputs.port }} | |
run-all-opts-name: ${{ steps.run-all-opts.outputs.name }} | |
run-no-opts-port: ${{ steps.run-no-opts.outputs.port }} | |
run-no-opts-name: ${{ steps.run-no-opts.outputs.name }} | |
steps: | |
- uses: ./.github/actions/run-container-all-opts | |
name: "Start container with all options set" | |
id: run-all-opts | |
with: | |
build-id: ${{ needs.build.outputs.build-id }} | |
- uses: ./.github/actions/run-container-no-opts | |
name: "Start container with no options set" | |
id: run-no-opts | |
with: | |
build-id: ${{ needs.build.outputs.build-id }} | |
- uses: ./.github/actions/wait | |
name: "Wait for the containers to start" | |
test: | |
runs-on: self-hosted | |
environment: 'dev' | |
needs: [build, run] | |
steps: | |
- uses: ./.github/actions/tests/monit | |
name: "Test Monit with all options on" | |
with: | |
name: ${{ needs.run.outputs.run-all-opts-name }} | |
- uses: ./.github/actions/tests/monit | |
name: "Test Monit with no options on" | |
with: | |
name: ${{ needs.run.outputs.run-no-opts-name }} | |
- uses: ./.github/actions/tests/nginx | |
name: "Test Nginx with all options on" | |
with: | |
port: ${{ needs.run.outputs.run-all-opts-port }} | |
- uses: ./.github/actions/tests/nginx | |
name: "Test Nginx with no options on" | |
with: | |
port: ${{ needs.run.outputs.run-no-opts-port }} | |
cleanup: | |
runs-on: self-hosted | |
environment: 'dev' | |
needs: [build, run, test] | |
if: always() | |
steps: | |
- uses: ./.github/actions/cleanup | |
with: | |
images: homekit-monitord:${{ needs.build.outputs.build-id }} | |
containers: homekit-monitord-${{ needs.run.outputs.run-all-opts-name }} homekit-monitord-${{ needs.run.outputs.run-no-opts-name }} |