From 941eebd0b8d01f62680e428c9b496937dadd02e9 Mon Sep 17 00:00:00 2001 From: firestar99 Date: Fri, 12 Dec 2025 12:14:56 +0100 Subject: [PATCH 1/2] ci: split main test between `test-os` and `test-rust-gpu-versions` jobs --- .github/workflows/push.yaml | 55 ++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index 82929b56..8e028752 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -5,13 +5,14 @@ on: branches: - main pull_request: + workflow_dispatch: env: # For setup-rust, see https://github.com/moonrepo/setup-rust/issues/22 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} jobs: - install-and-build-shaders: + test-os: strategy: fail-fast: false matrix: @@ -19,49 +20,59 @@ jobs: - ubuntu-latest - macos-latest - windows-latest - rust-gpu-version: [latest] - include: + runs-on: ${{ matrix.os }} + env: + RUST_LOG: debug + steps: + - uses: actions/checkout@v4 + - uses: cargo-bins/cargo-binstall@main + - run: cargo binstall cargo-nextest + - run: cargo fetch --locked + - name: shader-crate-template cargo fetch --locked + run: | + cd ./crates/shader-crate-template + cargo fetch --locked + - run: cargo nextest run + - name: Run a full build + run: cargo xtask test-build + + test-rust-gpu-releases: + strategy: + fail-fast: false + matrix: + rust-gpu-version: # As well as testing on each OS, we also want to test to make sure we're still supporting # older versions of `rust-gpu`. However, we can assume that these tests are already okay # across platforms, so we only need to test on Linux, the chepeast in terms of minutes. # # `0.7.0` currently fails building `spirv-builder-cli` with: # """ - # package `is_terminal_polyfill v1.70.1` cannot be built because it requires rustc + # package `is_terminal_polyfill v1.70.1` cannot be built because it requires rustc # 1.70.0 or newer, while the currently active rustc version is 1.69.0-nightly # """ # It's probably easily fixable. But also `0.7.0` was released in April 2023, so there's # unlikely many users of it? - - os: ubuntu-latest - rust-gpu-version: 0.8.0 - - os: ubuntu-latest - rust-gpu-version: 0.9.0 - runs-on: ${{ matrix.os }} - defaults: - run: - shell: bash + - 0.8.0 + - 0.9.0 + runs-on: ubuntu-latest env: RUST_LOG: debug steps: - uses: actions/checkout@v4 - - name: Fetch root dependencies - run: cargo fetch --locked - - name: Fetch shader-crate-template dependencies - run: | - cd ./crates/shader-crate-template - cargo fetch --locked - - run: cargo test - name: Run a full build run: cargo xtask test-build --rust-gpu-version ${{ matrix.rust-gpu-version }} - + lints: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: cargo-bins/cargo-binstall@main - - name: Install cargo-shear - run: cargo binstall cargo-shear + - run: cargo binstall cargo-shear - run: cargo fetch --locked - run: cargo clippy -- --deny warnings - run: cargo fmt --check - run: cargo shear + +defaults: + run: + shell: bash From 2ca01c2c2f72f3f0206a47184744fb267d9740f5 Mon Sep 17 00:00:00 2001 From: firestar99 Date: Fri, 12 Dec 2025 12:32:15 +0100 Subject: [PATCH 2/2] ci: add `test_success` job --- .github/workflows/push.yaml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index 8e028752..3f0bd481 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -62,7 +62,7 @@ jobs: - name: Run a full build run: cargo xtask test-build --rust-gpu-version ${{ matrix.rust-gpu-version }} - lints: + lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -73,6 +73,21 @@ jobs: - run: cargo fmt --check - run: cargo shear + # 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-24.04 + needs: [test-os, test-rust-gpu-releases, 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-os.result }}" == "success" ]] || exit 1 + [[ "${{ needs.test-rust-gpu-releases.result }}" == "success" ]] || exit 1 + [[ "${{ needs.lint.result }}" == "success" ]] || exit 1 + defaults: run: shell: bash