Additional CI improvments #47
This file contains hidden or 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: CI | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| types: [opened, reopened, synchronize, ready_for_review] | |
| branches: ["main"] | |
| push: | |
| branches: ["main"] | |
| permissions: | |
| contents: read | |
| actions: read | |
| packages: write | |
| jobs: | |
| # Compute once which path groups changed; every other job references these | |
| # outputs. dorny/paths-filter handles PR base diff, push base diff, and | |
| # empty results on non-diff events (workflow_dispatch); the `if:` guards | |
| # below explicitly opt manual runs back into running everything. | |
| changes: | |
| name: Detect Changes | |
| runs-on: ubuntu-latest | |
| outputs: | |
| builds: ${{ steps.filter.outputs.builds }} | |
| docker: ${{ steps.filter.outputs.docker }} | |
| tests: ${{ steps.filter.outputs.tests }} | |
| docs: ${{ steps.filter.outputs.docs }} | |
| cpp_checks: ${{ steps.filter.outputs.cpp_checks }} | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1 | |
| id: filter | |
| with: | |
| filters: | | |
| builds: | |
| - src/** | |
| - include/** | |
| - benchmarks/** | |
| - cpp-example-collection | |
| - cpp-example-collection/** | |
| - client-sdk-rust/** | |
| - cmake/** | |
| - CMakeLists.txt | |
| - CMakePresets.json | |
| - build* | |
| - .build* | |
| - vcpkg.json | |
| - .github/workflows/ci.yml | |
| - .github/workflows/builds.yml | |
| docker: | |
| - docker/** | |
| - .dockerignore | |
| - CMakeLists.txt | |
| - CMakePresets.json | |
| - build* | |
| - .build* | |
| - cmake/** | |
| - .github/workflows/ci.yml | |
| - .github/workflows/docker-images.yml | |
| tests: | |
| - src/** | |
| - include/** | |
| - client-sdk-rust/** | |
| - cmake/** | |
| - .token_helpers/** | |
| - CMakeLists.txt | |
| - CMakePresets.json | |
| - build* | |
| - .build* | |
| - vcpkg.json | |
| - .github/workflows/ci.yml | |
| - .github/workflows/tests.yml | |
| docs: | |
| - README.md | |
| - include/** | |
| - docs/** | |
| - scripts/generate-docs.sh | |
| - .github/workflows/ci.yml | |
| - .github/workflows/generate-docs.yml | |
| - .github/workflows/publish-docs.yml | |
| - "!AGENTS.md" | |
| cpp_checks: | |
| - src/** | |
| - include/** | |
| - benchmarks/** | |
| - client-sdk-rust/** | |
| - cmake/** | |
| - CMakeLists.txt | |
| - CMakePresets.json | |
| - scripts/clang-format.sh | |
| - scripts/clang-tidy.sh | |
| - .clang-format | |
| - .clang-tidy | |
| - .github/workflows/ci.yml | |
| - .github/workflows/cpp-checks.yml | |
| builds: | |
| name: Builds | |
| needs: changes | |
| if: ${{ needs.changes.outputs.builds == 'true' || github.event_name == 'workflow_dispatch' }} | |
| uses: ./.github/workflows/builds.yml | |
| secrets: inherit | |
| # docker-images: | |
| # name: Docker Images | |
| # needs: changes | |
| # if: ${{ needs.changes.outputs.docker == 'true' || github.event_name == 'workflow_dispatch' }} | |
| # uses: ./.github/workflows/docker-images.yml | |
| # secrets: inherit | |
| tests: | |
| name: Tests | |
| needs: changes | |
| if: ${{ needs.changes.outputs.tests == 'true' || github.event_name == 'workflow_dispatch' }} | |
| uses: ./.github/workflows/tests.yml | |
| secrets: inherit | |
| # license-check is cheap (seconds) and broad enough that it should run on | |
| # every PR. | |
| license-check: | |
| name: License Check | |
| uses: ./.github/workflows/license_check.yml | |
| cpp-checks: | |
| name: C++ Checks | |
| needs: changes | |
| if: ${{ needs.changes.outputs.cpp_checks == 'true' || github.event_name == 'workflow_dispatch' }} | |
| uses: ./.github/workflows/cpp-checks.yml | |
| generate-docs: | |
| name: Generate Docs | |
| needs: changes | |
| if: ${{ needs.changes.outputs.docs == 'true' || github.event_name == 'workflow_dispatch' }} | |
| uses: ./.github/workflows/generate-docs.yml | |
| # Context: GitHub repository rulesets "required checks" actually need a job name to list. | |
| # This job is an aggregate job | |
| ci: | |
| name: CI | |
| runs-on: ubuntu-latest | |
| # List all the jobs that need to succeed for the CI to pass | |
| needs: | |
| - changes | |
| - builds | |
| # - docker-images | |
| - tests | |
| - license-check | |
| - cpp-checks | |
| - generate-docs | |
| if: always() | |
| steps: | |
| - name: Verify required CI jobs | |
| uses: suzuki-shunsuke/required-status-check-action@2b5a46064846b09381852c2c4217e898f639e768 # v0.1.3 | |
| with: | |
| needs: ${{ toJson(needs) }} |