Skip to content

Fix capability extension validation to use ANY-of semantics #54

Fix capability extension validation to use ANY-of semantics

Fix capability extension validation to use ANY-of semantics #54

Workflow file for this run

name: Rust
permissions:
contents: read
on:
push:
branches:
- 'main'
pull_request:
types: [opened, synchronize, reopened]
env:
CARGO_TERM_COLOR: always
jobs:
# Pure Rust tests
rust-tests:
name: Rust Tests (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Download SPIRV-Headers
run: python3 utils/git-sync-deps
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
rust/target/
key: ${{ runner.os }}-cargo-${{ hashFiles('rust/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Build Rust workspace
working-directory: rust
# Exclude crates requiring C++ build (tested in rust-ffi-tests job)
# spirv-tools-cli depends on spirv-tools-ffi, so both must be excluded
run: cargo build --workspace --exclude spirv-tools-ffi --exclude spirv-tools-cli
- name: Run Rust tests
working-directory: rust
# Exclude crates requiring C++ build (tested in rust-ffi-tests job)
# spirv-tools-cli depends on spirv-tools-ffi, so both must be excluded
run: cargo test --workspace --exclude spirv-tools-ffi --exclude spirv-tools-cli
# Rust FFI pretending to be C++ - runs C++ test suite against Rust implementation
rust-ffi-tests:
name: Rust FFI C++ Tests (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Download dependencies
run: python3 utils/git-sync-deps
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
rust/target/
key: ${{ runner.os }}-cargo-ffi-${{ hashFiles('rust/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-ffi-
- name: Configure CMake (Unix)
if: runner.os != 'Windows'
# Use build-rust to match the Rust FFI build.rs expectation
run: |
cmake -B build-rust \
-DSPIRV_BUILD_FUZZER=OFF \
-DSPIRV_ENABLE_RUST_TARGET_ENV=ON \
-DCMAKE_BUILD_TYPE=Release
- name: Configure CMake (Windows)
if: runner.os == 'Windows'
# Use build-rust to match the Rust FFI build.rs expectation
run: |
cmake -B build-rust -DSPIRV_BUILD_FUZZER=OFF -DSPIRV_ENABLE_RUST_TARGET_ENV=ON
- name: Build C++ with Rust FFI (Unix)
if: runner.os != 'Windows'
run: cmake --build build-rust --config Release -j $(nproc 2>/dev/null || sysctl -n hw.ncpu)
- name: Build C++ with Rust FFI (Windows)
if: runner.os == 'Windows'
run: cmake --build build-rust --config Release
- name: Run C++ tests (Unix)
if: runner.os != 'Windows'
working-directory: build-rust
run: ctest --output-on-failure -C Release -j $(nproc 2>/dev/null || sysctl -n hw.ncpu)
- name: Run C++ tests (Windows)
if: runner.os == 'Windows'
working-directory: build-rust
run: ctest --output-on-failure -C Release
# Clippy and format checks
rust-lint:
name: Rust Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Download SPIRV-Headers
run: python3 utils/git-sync-deps
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
rust/target/
key: ${{ runner.os }}-cargo-lint-${{ hashFiles('rust/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-lint-
- name: Check formatting
working-directory: rust
run: cargo fmt --all -- --check
- name: Run Clippy
working-directory: rust
# Exclude crates requiring C++ build (tested in rust-ffi-tests job)
# spirv-tools-cli depends on spirv-tools-ffi, so both must be excluded
# Lint configuration is in rust/Cargo.toml [workspace.lints.clippy]
run: cargo clippy --workspace --exclude spirv-tools-ffi --exclude spirv-tools-cli --all-targets -- -D warnings