CI #27
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "*" | |
pull_request: | |
merge_group: | |
name: CI | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- uses: actions-rs/toolchain@v1 | |
with: | |
# FIXME(eddyb) `style_edition = "2024"` in `rustfmt.toml` is what keeps | |
# this on `nightly`, should switch to `stable` when that stabilizes. | |
toolchain: nightly | |
# HACK(eddyb) use `nightly` by default without breaking the ability to | |
# temporarily bypass it through `rust-toolchain.toml`. | |
default: true | |
override: false | |
# run cargo fetch w/ --locked to verify Cargo.lock is up-to-date | |
- run: cargo fetch --locked | |
# make sure all code has been formatted with rustfmt | |
- name: check rustfmt | |
run: | | |
rustup component add rustfmt | |
cargo fmt -- --check --color always | |
# run clippy to verify we have no warnings | |
- name: cargo clippy | |
run: | | |
rustup component add clippy | |
cargo clippy --all-targets --all-features -- -D warnings | |
- name: Ensure compatibility with rust-gpu nightly rust version | |
run: | | |
curl -sSL https://github.com/rust-gpu/rust-gpu/raw/main/rust-toolchain.toml | grep -v '^components = ' > rust-toolchain.toml | |
cargo check --workspace --all-targets | |
rm rust-toolchain.toml | |
test: | |
name: Test | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macOS-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
# NOTE(eddyb) this is the simplest way found so far to get `glslang`. | |
- name: Prepare Vulkan SDK | |
uses: humbletim/[email protected] | |
with: | |
vulkan-query-version: 1.3.250.0 | |
vulkan-components: Glslang SPIRV-Tools | |
vulkan-use-cache: true | |
- run: cargo fetch | |
# FIXME(eddyb) `cargo test` is not even that important yet. | |
- name: cargo test build | |
run: cargo build --tests --release --all-targets | |
- name: cargo test | |
run: cargo test --release --all-targets | |
# FIXME(eddyb) actually flesh this out into a whole testing setup | |
# (see also https://github.com/EmbarkStudios/spirt/issues/7). | |
- name: Minimal glslang -> SPIR-V -> SPIR-T -> SPIR-V testing | |
run: | | |
glslangValidator -V --target-env spirv1.3 -g tests/data/basic.frag.glsl -o tests/data/basic.frag.glsl.dbg.spv | |
glslangValidator -V --target-env spirv1.3 -g tests/data/debug-printf.vert.glsl -o tests/data/debug-printf.vert.glsl.dbg.spv | |
cargo run --release --example spv-lower-link-lift tests/data/basic.frag.glsl.dbg.spv | |
cargo run --release --example spv-lower-link-lift tests/data/debug-printf.vert.glsl.dbg.spv | |
- if: ${{ runner.os == 'Linux' }} | |
name: Check examples are up to date | |
run: .github/workflows/check-examples.sh | |
deny-check: | |
name: cargo-deny | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- uses: EmbarkStudios/cargo-deny-action@v2 | |
publish-check: | |
name: Publish Check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- run: cargo fetch | |
- name: cargo publish check | |
run: cargo publish --dry-run |