name: Cargo Build & Test
on:
push:
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
build_and_test:
name: Rust project - latest
runs-on: ubuntu-latest
strategy:
matrix:
toolchain:
- stable
- beta
- nightly
steps:
- uses: actions/checkout@v4
- name: Install Vulkan SDK and Runtime
uses: jakoch/install-vulkan-sdk-action@v1.4.0
with:
vulkan_version: latest
install_runtime: true
cache: true
stripdown: true
- name: Verify shader compilers
run: |
echo "=== GLSL Compiler (glslangValidator) ==="
glslangValidator --version
echo ""
echo "=== DXC Compiler ==="
dxc --version
echo ""
echo "=== SPIR-V Tools ==="
spirv-opt --version || echo "spirv-opt not found"
- name: Setup Rust toolchain
run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-${{ matrix.toolchain }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose