Skip to content

Split compiletests and difftests into parallel CI jobs #272

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 5, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 97 additions & 30 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ jobs:
target: x86_64-pc-windows-msvc
- os: macOS-latest
target: x86_64-apple-darwin
- os: ubuntu-24.04
target: aarch64-linux-android
host: x86_64-unknown-linux-gnu
runs-on: ${{ matrix.os }}
env:
RUSTUP_UNPACK_RAM: "26214400"
Expand All @@ -42,13 +39,6 @@ jobs:
- if: ${{ runner.os == 'Linux' }}
name: Linux - Install native dependencies
run: sudo apt install libwayland-cursor0 libxkbcommon-dev libwayland-dev
- if: ${{ runner.os == 'Linux' }}
name: Install xvfb, llvmpipe and lavapipe
run: |
sudo apt-get update -y -qq
sudo add-apt-repository ppa:kisak/turtle -y
sudo apt-get update
sudo apt install -y xvfb libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers
# cargo version is a random command that forces the installation of rust-toolchain
- name: install rust-toolchain
run: cargo version
Expand All @@ -60,39 +50,25 @@ jobs:
# Core crates
# Compiled in --release because cargo compiletest would otherwise compile in release again.
- name: rustc_codegen_spirv build
if: ${{ matrix.target != 'aarch64-linux-android' }}
run: cargo test -p rustc_codegen_spirv --release --no-default-features --features "use-installed-tools" --no-run

- name: rustc_codegen_spirv test
if: ${{ matrix.target != 'aarch64-linux-android' }}
run: cargo test -p rustc_codegen_spirv --release --no-default-features --features "use-installed-tools"

- name: compiletest
if: ${{ matrix.target != 'aarch64-linux-android' }}
run: cargo run -p compiletests --release --no-default-features --features "use-installed-tools" -- --target-env vulkan1.1,vulkan1.2,spv1.3

- name: difftest
if: ${{ matrix.target != 'aarch64-linux-android' }}
run: cargo run -p difftests --release --no-default-features --features "use-installed-tools"

- name: workspace test
if: ${{ matrix.target != 'aarch64-linux-android' }}
run: cargo test --release
- name: workspace test (excluding examples & difftest)
run: cargo test --release --workspace --exclude "example-runner-*" --exclude "difftest*" --no-default-features --features "use-installed-tools"

# Examples
- name: cargo check examples
if: ${{ matrix.target != 'aarch64-linux-android' }}
run: cargo check -p example-runner-ash -p example-runner-wgpu -p example-runner-cpu -p compute-shader -p mouse-shader -p simplest-shader -p sky-shader --no-default-features --features "use-installed-tools"

- name: build example shaders
if: ${{ matrix.target != 'aarch64-linux-android' }}
env:
PROFILE: release
OUT_DIR: "target/release/ci/out"
run: cargo run -p example-runner-wgpu-builder --release --no-default-features --features "use-installed-tools"

- name: build example shaders (dev aka "debug mode")
if: ${{ matrix.target != 'aarch64-linux-android' }}
env:
# HACK(eddyb) see `[profile.dev]` in `Cargo.toml` for more on why
# `-Zshare-generics=off` is useful (and why it had to be moved here).
Expand All @@ -101,8 +77,35 @@ jobs:
OUT_DIR: "target/debug/ci/out"
run: cargo run -p example-runner-wgpu-builder --no-default-features --features "use-installed-tools"

android:
name: Android
strategy:
matrix:
include:
- os: ubuntu-24.04
target: aarch64-linux-android
host: x86_64-unknown-linux-gnu
runs-on: ${{ matrix.os }}
env:
RUSTUP_UNPACK_RAM: "26214400"
RUSTUP_IO_THREADS: "1"
steps:
- uses: actions/checkout@v4
# Install the spirv-tools binaries from tarballs hosted on each release
# of spirv-tools. This downloads the tarball, decompresses it, unpacks
# the binaries to the specified path, and adds them to PATH
- name: Install spirv-tools binaries
shell: bash
run: cargo run --manifest-path .github/install-spirv-tools/Cargo.toml -- ${{matrix.host || matrix.target}} 0.10.0 "${{github.workspace}}/bin"
# cargo version is a random command that forces the installation of rust-toolchain
- name: install rust-toolchain
run: cargo version
# 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 ${{ matrix.target }}

- name: Build WGPU Example for Android
if: ${{ matrix.target == 'aarch64-linux-android' }}
shell: bash
run: |
echo "::group::Uninstall android-31"
Expand All @@ -125,11 +128,75 @@ jobs:
cargo apk build -p example-runner-wgpu --lib --features use-installed-tools --no-default-features
echo "::endgroup::"

# This just allows us to branch protect on this one job rather needing to change
# it if the test matrix changes
compiletest:
name: Compiletest
strategy:
matrix:
include:
- os: ubuntu-24.04
target: x86_64-unknown-linux-gnu
- os: windows-2022
target: x86_64-pc-windows-msvc
- os: macOS-latest
target: x86_64-apple-darwin
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install spirv-tools binaries
shell: bash
run: cargo run --manifest-path .github/install-spirv-tools/Cargo.toml -- ${{matrix.target}} 0.10.0 "${{github.workspace}}/bin"
# cargo version is a random command that forces the installation of rust-toolchain
- name: install rust-toolchain
run: cargo version
- name: cargo fetch --locked
run: cargo fetch --locked --target ${{ matrix.target }}
- name: compiletest
run: cargo run -p compiletests --release --no-default-features --features "use-installed-tools" -- --target-env vulkan1.1,vulkan1.2,spv1.3

difftest:
name: Difftest
strategy:
matrix:
include:
- os: ubuntu-24.04
target: x86_64-unknown-linux-gnu
- os: windows-2022
target: x86_64-pc-windows-msvc
- os: macOS-latest
target: x86_64-apple-darwin
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install spirv-tools binaries
shell: bash
run: cargo run --manifest-path .github/install-spirv-tools/Cargo.toml -- ${{matrix.target}} 0.10.0 "${{github.workspace}}/bin"
- if: ${{ runner.os == 'Linux' }}
name: Linux - Install native dependencies
run: sudo apt install libwayland-cursor0 libxkbcommon-dev libwayland-dev
- if: ${{ runner.os == 'Linux' }}
name: Install xvfb, llvmpipe and lavapipe
run: |
sudo apt-get update -y -qq
sudo add-apt-repository ppa:kisak/turtle -y
sudo apt-get update
sudo apt install -y xvfb libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers
# cargo version is a random command that forces the installation of rust-toolchain
- name: install rust-toolchain
run: cargo version
- name: cargo fetch --locked
run: cargo fetch --locked --target ${{ matrix.target }}
- name: cargo fetch --locked difftests
run: cargo fetch --locked --manifest-path=tests/difftests/tests/Cargo.toml --target ${{ matrix.target }}
- name: test difftest
run: cargo test -p "difftest*" --release --no-default-features --features "use-installed-tools"
- name: difftests
run: cargo run -p difftests --release --no-default-features --features "use-installed-tools"

# 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
needs: [test, compiletest, difftest, android]
steps:
- run: echo "All test jobs passed"

Expand Down