fix(clippy): Enable clippy to work transitively (#731) #2003
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 | |
| # Controls when the action will run. | |
| on: | |
| # Triggers the workflow on push or pull request events but only for release branches | |
| push: | |
| branches: [main, 1.x] | |
| pull_request: | |
| branches: [main, 1.x] | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| concurrency: | |
| # Cancel previous actions from the same PR or branch except 'main' branch. | |
| # See https://docs.github.com/en/actions/using-jobs/using-concurrency and https://docs.github.com/en/actions/learn-github-actions/contexts for more info. | |
| group: concurrency-group::${{ github.workflow }}::${{ github.event.pull_request.number > 0 && format('pr-{0}', github.event.pull_request.number) || github.ref_name }}${{ github.ref_name == 'main' && format('::{0}', github.run_id) || ''}} | |
| cancel-in-progress: ${{ github.ref_name != 'main' }} | |
| jobs: | |
| list-examples: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| format-matrix: ${{ steps.set-format-matrix.outputs.matrix }} | |
| test-matrix: ${{ steps.set-test-matrix.outputs.matrix }} | |
| lint-matrix: ${{ steps.set-lint-matrix.outputs.matrix }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Verify bcr patches | |
| run: patch --dry-run -p1 --fuzz 0 < .bcr/patches/*.patch | |
| - uses: lycheeverse/lychee-action@v2 | |
| with: | |
| # Allow 503 Service Unavailable when rate limited | |
| args: --accept '200..=204,503' --base ${{ github.workspace }} --verbose --no-progress './**/*.md' './**/*.html' | |
| fail: false # sigh | |
| - name: "List examples that have a tools/format folder" | |
| id: set-format-matrix | |
| run: | | |
| folders=$(find examples -type d -path "*/tools/format" | sed 's|/tools/format||' | jq -R -s -c 'split("\n") | map(select(length > 0))') | |
| echo "matrix=$folders" >> "$GITHUB_OUTPUT" | |
| echo "Generated format matrix: $folders" | |
| - name: "List examples that have a tools/lint folder" | |
| id: set-lint-matrix | |
| run: | | |
| folders=$(find examples -type d -path "*/tools/lint" | sed 's|/tools/lint||' | jq -R -s -c 'split("\n") | map(select(length > 0))') | |
| echo "matrix=$folders" >> "$GITHUB_OUTPUT" | |
| echo "Generated lint matrix: $folders" | |
| - name: "Find all examples that have test/*.bats files" | |
| id: set-test-matrix | |
| run: | | |
| folders=$(find examples -name "*.bats" -path "*/test/*" | sed 's|/test/.*||' | sort -u | jq -R -s -c 'split("\n") | map(select(length > 0))') | |
| echo "matrix=$folders" >> "$GITHUB_OUTPUT" | |
| echo "Generated test matrix: $folders" | |
| format: | |
| needs: list-examples | |
| # Our version of clang-format has some deps that aren't satisfiable on newer ubuntu yet | |
| runs-on: ${{ matrix.folder == 'examples/cpp' && 'ubuntu-22.04' || 'ubuntu-24.04' }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| folder: ${{ fromJson(needs.list-examples.outputs.format-matrix) }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: bazel-contrib/setup-bazel@0.15.0 | |
| with: &bazelrc | |
| bazelrc: | | |
| common --show_progress_rate_limit=60 | |
| common --show_timestamps | |
| build:lint --no@aspect_rules_lint//lint:color | |
| # Permit this gross non-hermetic dependency | |
| - if: matrix.folder == 'examples/cpp' | |
| run: sudo apt-get update && sudo apt-get install -y libtinfo5 | |
| # TODO: Fix for Bazel 9 | |
| - if: matrix.folder == 'examples/csharp' || matrix.folder == 'examples/fsharp' || matrix.folder == 'examples/nodejs' | |
| run: echo "USE_BAZEL_VERSION=8.x" >> "$GITHUB_ENV" | |
| - run: bazel run //tools/format | |
| working-directory: ${{ matrix.folder }} | |
| integration-test: | |
| needs: list-examples | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| folder: ${{ fromJson(needs.list-examples.outputs.test-matrix) }} | |
| include: | |
| - folder: format | |
| exclude: | |
| # FIXME: these are failing, diagnose. | |
| - folder: examples/python | |
| - folder: examples/cpp | |
| - folder: examples/java | |
| - folder: examples/shell | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install Aspect CLI | |
| uses: jaxxstorm/action-install-gh-release@v2.1.0 | |
| with: | |
| repo: aspect-build/aspect-cli | |
| tag: v2026.4.2 | |
| asset-name: aspect-cli | |
| rename-to: aspect | |
| platform: unknown-linux | |
| arch: x86_64 | |
| chmod: 0755 | |
| extension-matching: disable | |
| - name: Setup bats | |
| uses: mig4/setup-bats@v1 | |
| with: | |
| bats-version: "1.8.2" | |
| - name: Setup bats helpers | |
| uses: brokenpip3/setup-bats-libs@0.0.3 | |
| with: | |
| support-path: /usr/lib/bats/bats-support | |
| support-version: "0.3.0" | |
| assert-path: /usr/lib/bats/bats-assert | |
| assert-version: "2.1.0" | |
| # TODO: Fix for Bazel 9 | |
| - if: matrix.folder == 'examples/java' || matrix.folder == 'examples/shell' || matrix.folder == 'examples/kotlin' || matrix.folder == 'format' | |
| run: echo "USE_BAZEL_VERSION=8.x" >> "$GITHUB_ENV" | |
| - name: "Integration test" | |
| working-directory: ${{ matrix.folder }} | |
| run: bats ./test | |
| lint: | |
| needs: list-examples | |
| runs-on: ubuntu-24.04 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| folder: ${{ fromJson(needs.list-examples.outputs.lint-matrix) }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: bazel-contrib/setup-bazel@0.15.0 | |
| with: *bazelrc | |
| # TODO: Fix for Bazel 9 | |
| - if: matrix.folder == 'examples/cpp' || matrix.folder == 'examples/kotlin' || matrix.folder == 'examples/nodejs' || matrix.folder == 'examples/python' | |
| run: echo "USE_BAZEL_VERSION=8.x" >> "$GITHUB_ENV" | |
| - name: Lint | |
| working-directory: ${{ matrix.folder }} | |
| run: | | |
| bazel build --config=lint --output_groups=rules_lint_human //... | |
| bazel build --config=lint \ | |
| --output_groups=rules_lint_patch \ | |
| --@aspect_rules_lint//lint:fix \ | |
| //... | |
| test: | |
| strategy: | |
| matrix: | |
| # Linux is tested on Aspect Workflows | |
| os: | |
| - macos-latest | |
| # TODO(alex): lots of places are missing windows... | |
| # - windows-latest | |
| version: | |
| - 7.x | |
| - 8.x | |
| - 9.* | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: bazel-contrib/setup-bazel@0.8.0 | |
| with: | |
| repository-cache: ${{ inputs.mount_bazel_caches }} | |
| bazelrc: | | |
| common --announce_rc | |
| common --color=yes | |
| - name: Test | |
| # Reduce time on macos runners by testing one example | |
| working-directory: examples/java | |
| env: | |
| USE_BAZEL_VERSION: ${{ matrix.version }} | |
| run: bazel test //... |