chore: decompose cargo-hack feature sweep into per-crate parallel targets #3277
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
| on: | |
| pull_request: | |
| merge_group: | |
| push: | |
| branches: ["main"] | |
| name: PR Checks | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| CARGO_INCREMENTAL: 0 | |
| CARGO_NET_RETRY: 10 | |
| RUSTUP_MAX_RETRIES: 10 | |
| RUST_BACKTRACE: short | |
| PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true | |
| jobs: | |
| pr-title: | |
| name: PR Title Check | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - name: Check PR title follows conventional commits | |
| env: | |
| PR_TITLE: ${{ github.event.pull_request.title }} | |
| run: | | |
| # Conventional commit pattern: type(optional-scope): description | |
| pattern='^(feat|fix|chore|docs|style|refactor|perf|test|build|ci|revert)(\([a-zA-Z0-9_-]+\))?!?: .+' | |
| if ! echo "$PR_TITLE" | grep -qE "$pattern"; then | |
| echo "::error::PR title does not follow conventional commits format." | |
| echo "" | |
| echo "Expected format: type(optional-scope): description" | |
| echo " Types: feat, fix, chore, docs, style, refactor, perf, test, build, ci, revert" | |
| echo " Examples:" | |
| echo " feat: add new linting rule" | |
| echo " fix(parser): handle trailing commas" | |
| echo " chore: bump version to 1.0.0" | |
| echo "" | |
| echo "Got: $PR_TITLE" | |
| exit 1 | |
| fi | |
| bazel-lint: | |
| name: Bazel Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # ratchet:actions/checkout@v6.0.3 | |
| - uses: bazel-contrib/setup-bazel@c5acdfb288317d0b5c0bbd7a396a3dc868bb0f86 # ratchet:bazel-contrib/setup-bazel@0.19.0 | |
| with: | |
| bazelisk-cache: true | |
| disk-cache: ${{ github.workflow }} | |
| repository-cache: true | |
| # Only master (push to main) runs update the cache; PRs and merge | |
| # group jobs restore it read-only to avoid polluting/contending. | |
| cache-save: ${{ github.event_name == 'push' }} | |
| - name: Build all targets | |
| run: bazelisk build --config=ci //... | |
| - name: Run all tests | |
| run: bazelisk test --config=ci //... | |
| bazel-lockfile: | |
| name: Bazel Lockfile Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # ratchet:actions/checkout@v6.0.3 | |
| - uses: bazel-contrib/setup-bazel@c5acdfb288317d0b5c0bbd7a396a3dc868bb0f86 # ratchet:bazel-contrib/setup-bazel@0.19.0 | |
| with: | |
| bazelisk-cache: true | |
| disk-cache: ${{ github.workflow }} | |
| repository-cache: true | |
| # Only master (push to main) runs update the cache; PRs and merge | |
| # group jobs restore it read-only to avoid polluting/contending. | |
| cache-save: ${{ github.event_name == 'push' }} | |
| - name: Update lockfile | |
| run: bazelisk mod deps --lockfile_mode=update | |
| - name: Check lockfile is up to date | |
| run: | | |
| if ! git diff --quiet MODULE.bazel.lock; then | |
| echo "::error::MODULE.bazel.lock is out of date. Run 'bazel mod deps --lockfile_mode=update' and commit the changes." | |
| git diff MODULE.bazel.lock | |
| exit 1 | |
| fi | |
| build-binaries: | |
| name: Build binaries for all platforms | |
| # Master pushes only need to refresh the Bazel cache; skip the binary | |
| # matrix there since it does not use that cache. | |
| if: github.event_name != 'push' | |
| runs-on: ${{ matrix.platform.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| - name: sqruff-linux-x86_64-musl.tar.gz | |
| os: ubuntu-latest | |
| target: x86_64-unknown-linux-musl | |
| bin: sqruff | |
| - name: sqruff-linux-aarch64-musl.tar.gz | |
| os: ubuntu-latest | |
| target: aarch64-unknown-linux-musl | |
| bin: sqruff | |
| - name: sqruff-windows-x86_64.zip | |
| os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| bin: sqruff.exe | |
| - name: sqruff-darwin-x86_64.tar.gz | |
| os: macos-15-intel | |
| target: x86_64-apple-darwin | |
| bin: sqruff | |
| - name: sqruff-darwin-aarch64.tar.gz | |
| os: macOS-latest | |
| target: aarch64-apple-darwin | |
| bin: sqruff | |
| steps: | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # ratchet:actions/checkout@v6.0.3 | |
| - uses: ./.github/actions/build-binaries | |
| with: | |
| package: false | |
| publish: false |