mirror of
https://github.com/Rust-GPU/rust-gpu.git
synced 2026-06-07 01:59:51 +09:00
The `macOS-latest` images on GitHub are arm: ``` Current runner version: '2.324.0' Operating System macOS 14.7.5 23H527 Runner Image Image: macos-14-arm64 ```
249 lines
9.1 KiB
YAML
249 lines
9.1 KiB
YAML
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
merge_group:
|
|
|
|
name: CI
|
|
|
|
# Cancel PR actions on new commits
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
test:
|
|
name: Test
|
|
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: aarch64-apple-darwin
|
|
runs-on: ${{ matrix.os }}
|
|
env:
|
|
RUSTUP_UNPACK_RAM: "26214400"
|
|
RUSTUP_IO_THREADS: "1"
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install Vulkan SDK
|
|
uses: humbletim/install-vulkan-sdk@v1.2
|
|
with:
|
|
version: 1.4.309.0
|
|
cache: true
|
|
- if: ${{ runner.os == 'Linux' }}
|
|
name: Linux - Install native dependencies
|
|
run: sudo apt install libwayland-cursor0 libxkbcommon-dev libwayland-dev
|
|
# 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 }}
|
|
|
|
# Core crates
|
|
# Compiled in --release because cargo compiletest would otherwise compile in release again.
|
|
- name: rustc_codegen_spirv build
|
|
run: cargo test -p rustc_codegen_spirv --release --no-default-features --features "use-installed-tools" --no-run
|
|
|
|
- name: rustc_codegen_spirv test
|
|
run: cargo test -p rustc_codegen_spirv --release --no-default-features --features "use-installed-tools"
|
|
|
|
- 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
|
|
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
|
|
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")
|
|
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).
|
|
RUSTFLAGS: -Zshare-generics=off
|
|
PROFILE: debug
|
|
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
|
|
- name: Install Vulkan SDK
|
|
uses: humbletim/install-vulkan-sdk@v1.2
|
|
with:
|
|
version: 1.4.309.0
|
|
cache: true
|
|
# 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
|
|
shell: bash
|
|
run: |
|
|
echo "::group::Uninstall android-31"
|
|
$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --uninstall "platforms;android-31"
|
|
echo "::endgroup::"
|
|
|
|
echo "::group::Install android-30"
|
|
$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --install "platforms;android-30"
|
|
echo "::endgroup::"
|
|
|
|
echo "::group::Install cargo-apk"
|
|
cargo +stable install cargo-apk
|
|
echo "::endgroup::"
|
|
|
|
echo "::group::Add aarch64-linux-android target"
|
|
rustup target add aarch64-linux-android
|
|
echo "::endgroup::"
|
|
|
|
echo "::group::Build WGPU example for Android"
|
|
cargo apk build -p example-runner-wgpu --lib --features use-installed-tools --no-default-features
|
|
echo "::endgroup::"
|
|
|
|
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: aarch64-apple-darwin
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install Vulkan SDK
|
|
uses: humbletim/install-vulkan-sdk@v1.2
|
|
with:
|
|
version: 1.4.309.0
|
|
cache: true
|
|
# 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: aarch64-apple-darwin
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install Vulkan SDK
|
|
uses: humbletim/install-vulkan-sdk@v1.2
|
|
with:
|
|
version: 1.4.309.0
|
|
cache: true
|
|
- 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, compiletest, difftest, android]
|
|
steps:
|
|
- run: echo "All test jobs passed"
|
|
|
|
lint:
|
|
name: Lint
|
|
runs-on: ubuntu-24.04
|
|
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"
|
|
- name: Install native dependencies
|
|
run: sudo apt install libwayland-cursor0 libxkbcommon-dev libwayland-dev
|
|
- name: Install Vulkan SDK
|
|
uses: humbletim/install-vulkan-sdk@v1.2
|
|
with:
|
|
version: 1.4.309.0
|
|
cache: true
|
|
- name: Install rustup components
|
|
run: rustup component add rustfmt clippy
|
|
# 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
|
|
- name: Rustfmt
|
|
run: cargo fmt --all -- --check
|
|
- name: Rustfmt compiletests
|
|
run: shopt -s globstar && rustfmt --check tests/compiletests/ui/**/*.rs
|
|
- name: Rustfmt difftests
|
|
run: cargo fmt --check --all --manifest-path tests/difftests/tests/Cargo.toml
|
|
- name: Check docs are valid
|
|
run: RUSTDOCFLAGS=-Dwarnings cargo doc --no-deps
|
|
- name: Check docs for `spirv-std` and `spirv-builder` on stable (for docs.rs)
|
|
run: |
|
|
RUSTDOCFLAGS=-Dwarnings cargo +stable doc --no-deps -p spirv-std
|
|
RUSTDOCFLAGS=-Dwarnings cargo +stable doc --no-deps -p spirv-builder --no-default-features
|
|
- name: Clippy & custom lints
|
|
run: .github/workflows/lint.sh
|
|
|
|
cargo-deny:
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: EmbarkStudios/cargo-deny-action@v2
|