mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-22 03:21:00 +00:00
ci: Use cargo nextest as the test runner and export junit reports
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1840>
This commit is contained in:
parent
2fc8d6a27d
commit
24ffee3fd6
3 changed files with 67 additions and 6 deletions
6
.config/nextest.toml
Normal file
6
.config/nextest.toml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
[profile.ci]
|
||||||
|
failure-output = "immediate-final"
|
||||||
|
fail-fast = false
|
||||||
|
|
||||||
|
[profile.ci.junit]
|
||||||
|
path = "junit.xml"
|
|
@ -106,13 +106,24 @@ trigger:
|
||||||
script:
|
script:
|
||||||
- rustc --version
|
- rustc --version
|
||||||
- CARGO_FLAGS="-j${FDO_CI_CONCURRENT:-$(nproc)} --locked --color=always --all --all-targets"
|
- CARGO_FLAGS="-j${FDO_CI_CONCURRENT:-$(nproc)} --locked --color=always --all --all-targets"
|
||||||
|
- new_report_dir="$CI_PROJECT_DIR/junit_reports"
|
||||||
|
- mkdir -p "$new_report_dir"
|
||||||
|
|
||||||
|
|
||||||
- cargo build $CARGO_FLAGS
|
- cargo build $CARGO_FLAGS
|
||||||
- RUST_BACKTRACE=1 G_DEBUG=fatal_warnings cargo test $CARGO_FLAGS
|
- RUST_BACKTRACE=1 G_DEBUG=fatal_warnings cargo nextest run --profile=ci $CARGO_FLAGS
|
||||||
|
- mv "$CI_PROJECT_DIR/target/nextest/ci/junit.xml" "$new_report_dir/junit-tests-default.xml"
|
||||||
|
|
||||||
- cargo build $CARGO_FLAGS --all-features --exclude gst-plugin-gtk4
|
- cargo build $CARGO_FLAGS --all-features --exclude gst-plugin-gtk4
|
||||||
- RUST_BACKTRACE=1 G_DEBUG=fatal_warnings cargo test $CARGO_FLAGS --all-features --exclude gst-plugin-gtk4
|
- RUST_BACKTRACE=1 G_DEBUG=fatal_warnings cargo nextest run --profile=ci $CARGO_FLAGS --all-features --exclude gst-plugin-gtk4
|
||||||
|
- mv "$CI_PROJECT_DIR/target/nextest/ci/junit.xml" "$new_report_dir/junit-tests-all.xml"
|
||||||
|
|
||||||
- cargo build $CARGO_FLAGS --no-default-features
|
- cargo build $CARGO_FLAGS --no-default-features
|
||||||
- RUST_BACKTRACE=1 G_DEBUG=fatal_warnings cargo test $CARGO_FLAGS --no-default-features
|
- RUST_BACKTRACE=1 G_DEBUG=fatal_warnings cargo nextest run --profile=ci $CARGO_FLAGS --no-default-features
|
||||||
|
- mv "$CI_PROJECT_DIR/target/nextest/ci/junit.xml" "$new_report_dir/junit-tests-no-default.xml"
|
||||||
|
artifacts:
|
||||||
|
reports:
|
||||||
|
junit: "junit_reports/*.xml"
|
||||||
|
|
||||||
test msrv:
|
test msrv:
|
||||||
extends:
|
extends:
|
||||||
|
@ -392,7 +403,12 @@ coverage:
|
||||||
script:
|
script:
|
||||||
- CARGO_FLAGS="-j${FDO_CI_CONCURRENT:-$(nproc)} --locked --color=always --all"
|
- CARGO_FLAGS="-j${FDO_CI_CONCURRENT:-$(nproc)} --locked --color=always --all"
|
||||||
|
|
||||||
- cargo test $CARGO_FLAGS --all-features --exclude gst-plugin-gtk4
|
- cargo nextest run --profile=ci $CARGO_FLAGS --all-features --exclude gst-plugin-gtk4
|
||||||
|
|
||||||
|
- new_report_dir="$CI_PROJECT_DIR/junit_reports"
|
||||||
|
- mkdir -p "$new_report_dir"
|
||||||
|
- mv "$CI_PROJECT_DIR/target/nextest/ci/junit.xml" "$new_report_dir/coverage-junit.xml"
|
||||||
|
|
||||||
# generate html report
|
# generate html report
|
||||||
- mkdir -p coverage
|
- mkdir -p coverage
|
||||||
- grcov . --binary-path ./target/debug/ -s . -t html,cobertura --branch --ignore-not-existing --ignore "*target*" --ignore "*/build.rs" -o ./coverage/
|
- grcov . --binary-path ./target/debug/ -s . -t html,cobertura --branch --ignore-not-existing --ignore "*target*" --ignore "*/build.rs" -o ./coverage/
|
||||||
|
@ -403,6 +419,7 @@ coverage:
|
||||||
paths:
|
paths:
|
||||||
- 'coverage'
|
- 'coverage'
|
||||||
reports:
|
reports:
|
||||||
|
junit: "junit_reports/*.xml"
|
||||||
coverage_report:
|
coverage_report:
|
||||||
coverage_format: cobertura
|
coverage_format: cobertura
|
||||||
path: "coverage/cobertura.xml"
|
path: "coverage/cobertura.xml"
|
||||||
|
|
|
@ -37,12 +37,50 @@ function Run-Tests {
|
||||||
|
|
||||||
$env:G_DEBUG="fatal_warnings"
|
$env:G_DEBUG="fatal_warnings"
|
||||||
$env:RUST_BACKTRACE="1"
|
$env:RUST_BACKTRACE="1"
|
||||||
cargo test --no-fail-fast --color=always --workspace $local_exclude --all-targets $Features
|
cargo nextest run --profile=ci --no-fail-fast --color=always --workspace $local_exclude --all-targets $Features
|
||||||
|
|
||||||
if (!$?) {
|
if (!$?) {
|
||||||
Write-Host "Tests failed"
|
Write-Host "Tests failed"
|
||||||
Exit 1
|
Exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Move-Junit -Features $Features
|
||||||
|
}
|
||||||
|
|
||||||
|
function Move-Junit {
|
||||||
|
param (
|
||||||
|
$Features
|
||||||
|
)
|
||||||
|
|
||||||
|
if ($env:CI_PROJECT_DIR) {
|
||||||
|
$parent = $env:CI_PROJECT_DIR
|
||||||
|
} else {
|
||||||
|
$parent = $PWD.path
|
||||||
|
}
|
||||||
|
Write-Host "Parent directory: $parent"
|
||||||
|
|
||||||
|
$new_report_dir = "$parent/junit_reports/"
|
||||||
|
If(!(test-path -PathType container $new_report_dir))
|
||||||
|
{
|
||||||
|
New-Item -Path "$new_report_dir" -ItemType "directory"
|
||||||
|
if (!$?) {
|
||||||
|
Write-Host "Failed to create directory: $new_report_dir"
|
||||||
|
Exit 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($Features -eq "--all-features") {
|
||||||
|
$suffix = "all"
|
||||||
|
} elseif ($Features -eq "--no-default-features") {
|
||||||
|
$suffix = "no-default"
|
||||||
|
} else {
|
||||||
|
$suffix = "default"
|
||||||
|
}
|
||||||
|
|
||||||
|
Move-Item "$parent/target/nextest/ci/junit.xml" "$new_report_dir/junit-$suffix.xml"
|
||||||
|
if (!$?) {
|
||||||
|
Write-Host "Failed to move junit file"
|
||||||
|
Exit 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($feature in $features_matrix) {
|
foreach($feature in $features_matrix) {
|
||||||
|
|
Loading…
Reference in a new issue