Skip to content

Merge pull request #18497 from Aflynn50/wire-up-uniter-application-wa… #94

Merge pull request #18497 from Aflynn50/wire-up-uniter-application-wa…

Merge pull request #18497 from Aflynn50/wire-up-uniter-application-wa… #94

Workflow file for this run

# This workflow examines the changed files
# and runs tests depending on what files have changed.
name: "Checks"
on:
push:
branches: [3.*, 4.*, main]
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
workflow_dispatch:
permissions:
contents: read
jobs:
changed-files:
name: "Collate changed files"
runs-on: ubuntu-latest
outputs:
check-build: ${{ steps.filter-files.outputs.check-build }}
check-client: ${{ steps.filter-files.outputs.check-client }}
check-migrate: ${{ steps.filter-files.outputs.check-migrate }}
check-upgrade: ${{ steps.filter-files.outputs.check-upgrade }}
check-terraform: ${{ steps.filter-files.outputs.check-terraform }}
check-snap: ${{ steps.filter-files.outputs.check-snap }}
check-generate: ${{ steps.filter-files.outputs.check-generate }}
steps:
- name: Filter Files
id: filter-files
uses: dorny/paths-filter@v3
with:
filters: |
check-build:
- '**.go'
- 'go.mod'
- '.github/workflows/build.yml'
- 'scripts/dqlite/**'
- 'Makefile'
- 'make_functions.sh'
check-client:
- '**.go'
- 'go.mod'
- '.github/workflows/client-tests.yml'
- 'scripts/dqlite/**'
- 'Makefile'
- 'make_functions.sh'
check-migrate:
- '**.go'
- 'go.mod'
- 'snap/**'
- '.github/workflows/migrate.yml'
- 'scripts/dqlite/**'
- 'Makefile'
- 'make_functions.sh'
check-upgrade:
- '**.go'
- 'go.mod'
- 'snap/**'
- '.github/workflows/upgrade.yml'
- '.github/setup-lxd/**'
- 'scripts/dqlite/**'
- 'Makefile'
- 'make_functions.sh'
check-snap:
- '**.go'
- 'go.mod'
- 'snap/**'
- '.github/workflows/snap.yml'
- 'scripts/dqlite/**'
- 'Makefile'
- 'make_functions.sh'
check-terraform:
- '**.go'
- 'go.mod'
- '.github/workflows/terraform-smoke.yml'
check-generate:
- '**.go'
- 'go.mod'
- '.github/workflows/gen.yml'
build:
needs: [changed-files]
name: Build
if: github.event.pull_request.draft == false && needs.changed-files.outputs.check-build == 'true'
uses: ./.github/workflows/build.yml
snap:
needs: [changed-files]
name: Snap
if: github.event.pull_request.draft == false && needs.changed-files.outputs.check-snap == 'true'
uses: ./.github/workflows/snap.yml
generate:
needs: [changed-files]
name: Generate
if: github.event.pull_request.draft == false && needs.changed-files.outputs.check-generate == 'true'
uses: ./.github/workflows/gen.yml
client:
needs: [changed-files]
name: Client Tests
if: github.event.pull_request.draft == false && needs.changed-files.outputs.check-client == 'true'
uses: ./.github/workflows/client-tests.yml
terraform:
needs: [changed-files]
name: Terraform Smoke
# TODO - always skip terraform tests until they are made reliable on 3.x branches.
if: false && github.event.pull_request.draft == false && github.base_ref != 'main' && needs.changed-files.outputs.check-terraform == 'true'
uses: ./.github/workflows/terraform-smoke.yml
migrate:
needs: [changed-files]
name: Migrate
if: github.event.pull_request.draft == false && needs.changed-files.outputs.check-migrate == 'true'
uses: ./.github/workflows/migrate.yml
upgrade:
needs: [changed-files]
name: Upgrade
if: github.event.pull_request.draft == false && github.base_ref != 'main' && needs.changed-files.outputs.check-upgrade == 'true'
uses: ./.github/workflows/upgrade.yml
result-check:
needs: [build,snap,generate,client,terraform,migrate,upgrade]
runs-on: ubuntu-latest
name: Check Tests Passed
if: always() && !cancelled()
steps:
- name: Check Results
shell: bash
run: |
# TODO - add terraform once ready.
if ${{ needs.build.result == 'success' || needs.build.result == 'skipped' }} \
&& ${{ needs.snap.result == 'success' || needs.snap.result == 'skipped' }} \
&& ${{ needs.generate.result == 'success' || needs.generate.result == 'skipped' }} \
&& ${{ needs.client.result == 'success' || needs.client.result == 'skipped' }} \
&& ${{ needs.terraform.result != 'fix me' || needs.terraform.result == 'skipped' }} \
&& ${{ needs.migrate.result == 'success' || needs.migrate.result == 'skipped' }} \
&& ${{ needs.upgrade.result == 'success' || needs.upgrade.result == 'skipped' }}; then
exit 0
fi
exit 1