Module #14
Workflow file for this run
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: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| merge_group: | |
| workflow_dispatch: | |
| name: CI | |
| # Cancel PR actions on new commits | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| test: | |
| name: Test | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ ubuntu-latest, windows-latest, macOS-latest ] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: 'true' | |
| - uses: cargo-bins/cargo-binstall@main | |
| # just need a random command that forces the installation of rust-toolchain | |
| # figure out native target triple while we're at it | |
| - name: install rust-toolchain | |
| run: echo "TARGET=$(rustc --print host-tuple)" >> "$GITHUB_ENV" | |
| - run: cargo binstall cargo-nextest | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # Fetch dependencies in a separate step to clearly show how long each part | |
| # of the testing takes | |
| - name: cargo fetch --locked | |
| run: cargo fetch --locked --target $TARGET | |
| # check autogen | |
| - run: cargo autogen | |
| - name: check generated files are up-to-date | |
| run: | | |
| git add . | |
| git diff --cached | |
| git diff --quiet && git diff --cached --quiet | |
| # tests | |
| - name: build test | |
| run: cargo nextest run --no-run | |
| - name: test | |
| run: cargo nextest run | |
| # This allows us to have a single job we can branch protect on, rather than needing | |
| # to update the branch protection rules when the test matrix changes | |
| test_success: | |
| runs-on: ubuntu-latest | |
| needs: [test, lint] | |
| # Hack for buggy GitHub Actions behavior with skipped checks: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks#handling-skipped-but-required-checks | |
| if: ${{ always() }} | |
| steps: | |
| # Another hack is to actually check the status of the dependencies or else it'll fall through | |
| - run: | | |
| echo "Checking statuses..." | |
| [[ "${{ needs.test.result }}" == "success" ]] || exit 1 | |
| [[ "${{ needs.lint.result }}" == "success" ]] || exit 1 | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Note that we are explicitly NOT checking out submodules, to validate | |
| # that we haven't accidentally enabled spirv-tools native compilation | |
| # and regressed CI times | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: "false" | |
| # cargo version is a random command that forces the installation of rust-toolchain | |
| - name: install rust-toolchain | |
| run: cargo version | |
| - name: Install rustup components | |
| run: rustup component add rustfmt clippy | |
| - name: cargo fetch --locked | |
| run: cargo fetch --locked | |
| - name: Rustfmt | |
| run: cargo fmt --all -- --check | |
| - name: Check docs are valid | |
| run: RUSTDOCFLAGS=-Dwarnings cargo doc --no-deps | |
| - name: cargo clippy | |
| run: cargo clippy --all-targets -- -D warnings | |
| defaults: | |
| run: | |
| shell: bash |