Improve CI (#2241)

* update to actions/checkout@v3

* update to actions/upload-artifact@v3

* remove minor version

* remove unmaintained actions-rs actions

* update to codecov/codecov-action@v3

* use ubuntu-latest

* use extra cargo/rust env vars

* use cargo-nextest

* check naga-fuzz

* only check on MSRV and minimal-versions

* add whitespace between steps

* rename to CI

* use cargo-llvm-cov to generate code coverage
This commit is contained in:
Teodor Tanasoaia 2023-02-06 17:47:18 +01:00 committed by GitHub
parent 2d0aab875a
commit 64f8691e52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 154 additions and 161 deletions

104
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,104 @@
name: CI
on: [push, pull_request]
env:
CARGO_INCREMENTAL: false
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full
MSRV: 1.63
jobs:
check-msrv:
name: Check MSRV and minimal-versions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install MSRV toolchain
run: rustup toolchain install $MSRV --no-self-update --profile=minimal
- name: Install nightly toolchain
run: rustup toolchain install nightly --no-self-update --profile=minimal
- name: Install cargo-hack
uses: taiki-e/install-action@v2
with:
tool: cargo-hack
# -Z avoid-dev-deps doesn't work
- run: cargo +nightly hack generate-lockfile --remove-dev-deps -Z minimal-versions --offline
- name: Test all features
run: cargo +$MSRV check --all-features --workspace
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install cargo-nextest and cargo-llvm-cov
uses: taiki-e/install-action@v2
with:
tool: cargo-nextest,cargo-llvm-cov
- name: Default test
# Our intention here is to test `naga` with no features enabled. But
# since `cli` is the default package, a plain `cargo test` will build
# `naga` with the features requested in `cli/Cargo.toml`. Passing
# `--package naga` causes us to use the default features in the
# top-level `Cargo.toml` instead.
run: cargo nextest run --package naga
- name: Test all features
run: cargo llvm-cov --lcov --output-path lcov.info nextest --all-features --workspace
- name: Upload coverage report to codecov
uses: codecov/codecov-action@v3
with:
files: lcov.info
- name: Check snapshots
run: git diff --exit-code -- tests/out
check:
name: Check benchmarks and naga-fuzz
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check benchmarks
run: cargo check --benches
- name: Check naga-fuzz
run: |
cd fuzz
cargo check
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: rustup component add clippy
- run: cargo clippy --all-features --workspace -- -D warnings
documentation:
name: Documentation
runs-on: ubuntu-latest
env:
RUSTDOCFLAGS: -Dwarnings
steps:
- uses: actions/checkout@v3
- run: cargo doc -p naga --all-features --document-private-items
fmt:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: cargo fmt -- --check

View File

@ -4,49 +4,29 @@ on:
push:
branches: [master]
jobs:
coverage:
name: Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Install binstall
uses: taiki-e/install-action@v2
with:
tool: cargo-binstall
- name: Install cargo-tarpaulin
run: cargo binstall --no-confirm cargo-tarpaulin
- name: Generate report
run: cargo tarpaulin --tests --all-features --workspace --out Xml
- name: Upload to codecov.io
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Archive code coverage results
uses: actions/upload-artifact@v1
with:
name: code-coverage-report
path: cobertura.xml
env:
CARGO_INCREMENTAL: false
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full
jobs:
parse-dota2:
name: Parse Dota2 shaders
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- uses: actions/checkout@v3
- run: mkdir data
- name: Download shaders
run: curl https://user.fm/files/v2-5573e18b9f03f42c6ae53c392083da35/dota2-shaders.zip -o data/all.zip
- name: Unpack shaders
run: cd data && unzip all.zip
- name: Build Naga
run: cargo build --release --bin naga
- name: Convert shaders
run: for file in data/*.spv ; do echo "Translating" ${file} && target/release/naga --validate 27 ${file} ${file}.metal; done
@ -54,15 +34,14 @@ jobs:
name: Parse Sascha Willems Vulkan tutorial shaders
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- uses: actions/checkout@v3
- name: Download shaders
run: git clone https://github.com/SaschaWillems/Vulkan.git
- name: Build Naga
run: cargo build --release --bin naga
- name: Convert metal shaders
run: |
# No needed to stop workflow if we can't validate one file
@ -87,20 +66,20 @@ jobs:
name: Parse dneto0 spirv-samples
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- uses: actions/checkout@v3
- name: Download shaders
run: git clone https://github.com/dneto0/spirv-samples.git
- name: Build Naga
run: cargo build --release --bin naga
- name: Install spirv-tools
run: |
wget -q https://storage.googleapis.com/spirv-tools/artifacts/prod/graphics_shader_compiler/spirv-tools/linux-clang-release/continuous/1489/20210629-121459/install.tgz
tar zxf install.tgz
./install/bin/spirv-as --version
- name: Compile spv from spvasm
run: |
cd spirv-samples
@ -111,6 +90,7 @@ jobs:
echo "Convert to spv with spirv-as: $fname"
../install/bin/spirv-as --target-env spv1.3 $(realpath ${fname}) -o ./spv/$(basename ${fname}).spv
done;
- name: Validate spv and generate wgsl
run: |
set +e
@ -135,6 +115,7 @@ jobs:
echo "Result: $(expr $FILE_COUNT - $SUCCESS_RESULT_COUNT) / $FILE_COUNT" > counter
done
cat counter
- name: Validate output wgsl
run: |
set +e
@ -161,20 +142,18 @@ jobs:
name: Check snapshots (validated or not)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
- uses: actions/checkout@v3
- name: Install cargo-nextest
uses: taiki-e/install-action@v2
with:
profile: minimal
toolchain: stable
- uses: actions-rs/cargo@v1
name: Test minimal (without span)
with:
command: test
args: --features validate -p naga
- uses: actions-rs/cargo@v1
name: Test all (without validation)
with:
command: test
args: --features wgsl-in,wgsl-out,glsl-in,glsl-out,spv-in,spv-out,msl-out,hlsl-out,dot-out --workspace
tool: cargo-nextest
- name: Test minimal (without span)
run: cargo nextest run --features validate -p naga
- name: Test all (without validation)
run: cargo nextest run --features wgsl-in,wgsl-out,glsl-in,glsl-out,spv-in,spv-out,msl-out,hlsl-out,dot-out --workspace
- name: Check snapshots (without validation)
run: git diff --exit-code -- tests/out

View File

@ -1,100 +0,0 @@
# Regular testing.
name: pipeline
on: [push, pull_request]
jobs:
test-msrv:
name: Test MSRV and dependencies minimal-versions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: "1.63.0"
override: true
- uses: taiki-e/install-action@cargo-hack
- uses: taiki-e/install-action@cargo-minimal-versions
# nightly is only used by cargo-minimal-versions to regenerate the lock file
- run: rustup toolchain add nightly --no-self-update
- name: Test all features
run: cargo minimal-versions test --all-features --workspace
- name: Check snapshots
run: git diff --exit-code -- tests/out
test:
name: Test Nightly
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
- uses: actions-rs/cargo@v1
name: Default test
with:
# Our intention here is to test `naga` with no features enabled. But
# since `cli` is the default package, a plain `cargo test` will build
# `naga` with the features requested in `cli/Cargo.toml`. Passing
# `--package naga` causes us to use the default features in the
# top-level `Cargo.toml` instead.
command: test
args: --package naga
- uses: actions-rs/cargo@v1
name: Test all features
with:
command: test
args: --all-features --workspace
- name: Check snapshots
run: git diff --exit-code -- tests/out
- uses: actions-rs/cargo@v1
name: Check benchmarks
with:
command: check
args: --benches
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add clippy
- uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-features --workspace -- -D warnings
documentation:
name: Documentation
runs-on: ubuntu-latest
env:
RUSTDOCFLAGS: -Dwarnings
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: doc
args: -p naga --all-features --document-private-items
fmt:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt
- name: run rustfmt
run: |
cargo fmt -- --check

View File

@ -11,12 +11,17 @@ on:
jobs:
validate-linux:
name: SPIR-V + GLSL
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install tools
run: sudo apt-get install spirv-tools glslang-tools graphviz
- run: make validate-spv
- run: make validate-glsl
- run: make validate-dot
- run: make validate-wgsl

View File

@ -9,5 +9,6 @@ jobs:
name: MSL
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- run: make validate-msl

View File

@ -9,9 +9,11 @@ jobs:
name: HLSL via DXC
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Add DirectXShaderCompiler
uses: napokue/setup-dxc@v1.1.0
uses: napokue/setup-dxc@v1.1
- run: make validate-hlsl-dxc
shell: sh
@ -19,7 +21,8 @@ jobs:
name: HLSL via FXC
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Add fxc bin to PATH
run: |
Get-Childitem -Path "C:\Program Files (x86)\Windows Kits\10\bin\**\x64\fxc.exe" `
@ -28,5 +31,6 @@ jobs:
| Split-Path -Parent `
| Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append
shell: powershell
- run: make validate-hlsl-fxc
shell: sh