ci: parallelize tests

This commit is contained in:
chyyran 2024-02-24 01:59:56 -05:00 committed by Ronny Chan
parent 8ba4b72cf1
commit a5c684a7ee
3 changed files with 113 additions and 17 deletions

View file

@ -13,12 +13,12 @@ jobs:
steps:
- name: Approve
run: echo Full test suite for PRs needs approval by a maintainer
test:
test-presets:
runs-on: ubuntu-latest
continue-on-error: false
environment:
name: full-test
runs-on: windows-latest
needs: [approve-full-test]
continue-on-error: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
@ -28,5 +28,56 @@ jobs:
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly
- name: Test
run: cargo test -p librashader --features=github-ci --test reflect -- --nocapture
- name: Test preset processing
run: cargo test -p librashader --features=github-ci --test reflect -- --nocapture preprocess_all_slang_presets_parsed
test-naga:
runs-on: ubuntu-latest
continue-on-error: false
environment:
name: full-test
needs: [ approve-full-test ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install nightly Rust
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly
- name: Test Naga reflection
run: cargo test -p librashader --features=github-ci --test reflect -- --nocapture compile_all_slang_presets_wgsl_naga compile_all_slang_presets_msl_naga compile_all_slang_presets_spirv_naga
test-cross:
runs-on: ubuntu-latest
continue-on-error: false
environment:
name: full-test
needs: [ approve-full-test ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install nightly Rust
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly
- name: Test SPIRV-Cross
run: cargo test -p librashader --features=github-ci --test reflect -- --nocapture compile_all_slang_presets_msl_cross compile_all_slang_presets_glsl_cross compile_all_slang_presets_hlsl_cross compile_all_slang_presets_spirv_cross
test-dxil:
runs-on: windows-latest
continue-on-error: false
environment:
name: full-test
needs: [ approve-full-test ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install nightly Rust
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly
- name: Test DXIL
run: cargo test -p librashader --features=github-ci --test reflect -- --nocapture compile_all_slang_presets_dxil_cross

View file

@ -8,7 +8,49 @@ on:
env:
CARGO_TERM_COLOR: always
jobs:
test:
test-presets:
runs-on: ubuntu-latest
continue-on-error: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install nightly Rust
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly
- name: Test preset preprocessing
run: cargo test -p librashader --features=github-ci --test reflect -- --nocapture preprocess_all_slang_presets_parsed
test-naga:
runs-on: ubuntu-latest
continue-on-error: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install nightly Rust
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly
- name: Test Naga Reflection
run: cargo test -p librashader --features=github-ci --test reflect -- --nocapture compile_all_slang_presets_wgsl_naga compile_all_slang_presets_msl_naga compile_all_slang_presets_spirv_naga
test-cross:
runs-on: ubuntu-latest
continue-on-error: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install nightly Rust
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly
- name: Test SPIRV-Cross reflection
run: cargo test -p librashader --features=github-ci --test reflect -- --nocapture compile_all_slang_presets_msl_cross compile_all_slang_presets_glsl_cross compile_all_slang_presets_hlsl_cross compile_all_slang_presets_spirv_cross
test-dxil:
runs-on: windows-latest
continue-on-error: false
steps:
@ -20,5 +62,6 @@ jobs:
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly
- name: Test
run: cargo test -p librashader --features=github-ci --test reflect -- --nocapture
- name: Test DXIL
run: cargo test -p librashader --features=github-ci --test reflect -- --nocapture compile_all_slang_presets_dxil_cross

View file

@ -18,7 +18,7 @@ use once_cell::sync::Lazy;
static ALL_SLANG_PRESETS: Lazy<RwLock<Vec<(PathBuf, ShaderPreset)>>> =
Lazy::new(|| RwLock::new(collect_all_loadable_slang_presets()));
fn collect_all_slang_presets() -> Vec<(PathBuf, ShaderPreset)> {
fn collect_all_slang_presets(collect_is_error: bool) -> Vec<(PathBuf, ShaderPreset)> {
let presets = glob("../test/shaders_slang/**/*.slangp")
.unwrap()
.collect::<Vec<_>>()
@ -32,11 +32,13 @@ fn collect_all_slang_presets() -> Vec<(PathBuf, ShaderPreset)> {
return Some((path, preset));
}
Err(e) => {
#[cfg(feature = "github-ci")]
println!(
"::warning title=Failed to parse preset::{e:?} ({})",
path.display()
)
if collect_is_error {
#[cfg(feature = "github-ci")]
println!(
"::error title=Failed to parse preset::{e:?} ({})",
path.display()
)
}
}
}
}
@ -48,7 +50,7 @@ fn collect_all_slang_presets() -> Vec<(PathBuf, ShaderPreset)> {
}
fn collect_all_loadable_slang_presets() -> Vec<(PathBuf, ShaderPreset)> {
let mut presets = collect_all_slang_presets();
let mut presets = collect_all_slang_presets(false);
presets.retain(|(_, preset)| {
!preset
.shaders
@ -61,7 +63,7 @@ fn collect_all_loadable_slang_presets() -> Vec<(PathBuf, ShaderPreset)> {
#[test]
pub fn preprocess_all_slang_presets_parsed() {
let presets = collect_all_slang_presets();
let presets = collect_all_slang_presets(true);
for (path, preset) in presets {
preset.shaders.into_par_iter().for_each(|shader| {
@ -144,7 +146,7 @@ where
#[cfg(feature = "github-ci")]
println!(
"::warning title=Failed to reflect {} with {}::{e:?} ({})",
"::error title=Failed to reflect {} with {}::{e:?} ({})",
O::DEBUG,
R::DEBUG,
path.display()