mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-23 18:11:06 +00:00
ci: Use cargo nextest as the test runner and export junit reports
Close #519 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1502>
This commit is contained in:
parent
df52948b02
commit
ce13ac33fd
8 changed files with 99 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"
|
|
@ -225,6 +225,11 @@ update-nightly:
|
|||
stage: "test"
|
||||
script:
|
||||
- *cargo_test
|
||||
artifacts:
|
||||
paths:
|
||||
- 'junit_reports'
|
||||
reports:
|
||||
junit: "junit_reports/**/junit.xml"
|
||||
|
||||
test msrv:
|
||||
extends:
|
||||
|
@ -290,6 +295,11 @@ test nightly all-features:
|
|||
stage: "test"
|
||||
script:
|
||||
- ./ci/run-sys-cargo-test.sh
|
||||
artifacts:
|
||||
paths:
|
||||
- 'junit_reports'
|
||||
reports:
|
||||
junit: "junit_reports/**/junit.xml"
|
||||
|
||||
test stable sys:
|
||||
extends:
|
||||
|
@ -438,7 +448,9 @@ coverage:
|
|||
artifacts:
|
||||
paths:
|
||||
- 'coverage'
|
||||
- 'junit_reports'
|
||||
reports:
|
||||
junit: "junit_reports/**/junit.xml"
|
||||
coverage_report:
|
||||
coverage_format: cobertura
|
||||
path: "coverage/cobertura.xml"
|
||||
|
@ -577,6 +589,11 @@ windows rust docker msrv:
|
|||
- 'windows'
|
||||
- '2022'
|
||||
- "gstreamer-windows"
|
||||
artifacts:
|
||||
paths:
|
||||
- 'junit_reports'
|
||||
reports:
|
||||
junit: "junit_reports/**/*.xml"
|
||||
script:
|
||||
# Skip -sys tests as they don't work
|
||||
# https://github.com/gtk-rs/gtk3-rs/issues/54
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
variables:
|
||||
GST_RS_IMG_TAG: "2024-09-12.1"
|
||||
GST_RS_IMG_WINDOWS_TAG: "2024-09-12.1"
|
||||
GST_RS_IMG_TAG: "2024-10-02.0"
|
||||
GST_RS_IMG_WINDOWS_TAG: "2024-10-02.0"
|
||||
GST_RS_STABLE: "1.81.0"
|
||||
GST_RS_MSRV: "1.71.1"
|
||||
# The branch we use to build GStreamer from in the docker images
|
||||
|
|
|
@ -45,6 +45,13 @@ if [ "$RUST_IMAGE_FULL" = "1" ]; then
|
|||
fi
|
||||
fi
|
||||
|
||||
# Multiple dependencies of cargo-nextest require 1.74/1.75 nowadays
|
||||
if [ "$RUST_VERSION" = "1.71.1" ]; then
|
||||
cargo install --locked cargo-nextest@0.9.67
|
||||
else
|
||||
cargo install --locked cargo-nextest
|
||||
fi
|
||||
|
||||
if [ "$RUST_VERSION" = "1.71.1" ]; then
|
||||
cargo install --locked cargo-c --version 0.9.26+cargo-0.74
|
||||
else
|
||||
|
|
|
@ -8,6 +8,8 @@ cargo --version
|
|||
cpus=$(nproc || sysctl -n hw.ncpu)
|
||||
CARGO_FLAGS="-j${FDO_CI_CONCURRENT:-$cpus}"
|
||||
|
||||
parent="${CI_PROJECT_DIR:-$(pwd)}"
|
||||
|
||||
for crate in gstreamer* gstreamer-gl/{egl,wayland,x11}; do
|
||||
if [ -e "$crate/Cargo.toml" ]; then
|
||||
if [ -n "$ALL_FEATURES" ]; then
|
||||
|
@ -19,7 +21,11 @@ for crate in gstreamer* gstreamer-gl/{egl,wayland,x11}; do
|
|||
echo "Building and testing $crate with $FEATURES"
|
||||
|
||||
cargo build $CARGO_FLAGS --locked --color=always --manifest-path "$crate/Cargo.toml" $FEATURES
|
||||
RUST_BACKTRACE=1 G_DEBUG=fatal_warnings cargo test $CARGO_FLAGS --color=always --manifest-path "$crate/Cargo.toml" $FEATURES
|
||||
RUST_BACKTRACE=1 G_DEBUG=fatal_warnings cargo nextest run --profile=ci $CARGO_FLAGS --color=always --manifest-path "$crate/Cargo.toml" $FEATURES
|
||||
|
||||
new_report_dir="$parent/junit_reports/$crate"
|
||||
mkdir -p "$new_report_dir"
|
||||
mv "$parent/target/nextest/ci/junit.xml" "$new_report_dir/junit.xml"
|
||||
fi
|
||||
done
|
||||
|
||||
|
|
|
@ -8,6 +8,8 @@ cargo --version
|
|||
cpus=$(nproc || sysctl -n hw.ncpu)
|
||||
CARGO_FLAGS="-j${FDO_CI_CONCURRENT:-$cpus}"
|
||||
|
||||
parent="${CI_PROJECT_DIR:-$(pwd)}"
|
||||
|
||||
for crate in gstreamer*/sys gstreamer-gl/*/sys; do
|
||||
if [ -e "$crate/Cargo.toml" ]; then
|
||||
echo "Building $crate with --all-features"
|
||||
|
@ -42,5 +44,9 @@ for crate in gstreamer/sys \
|
|||
gstreamer-video/sys \
|
||||
gstreamer-webrtc/sys; do
|
||||
echo "Testing $crate with --all-features)"
|
||||
RUST_BACKTRACE=1 cargo test $CARGO_FLAGS --locked --color=always --manifest-path $crate/Cargo.toml --all-features
|
||||
RUST_BACKTRACE=1 cargo nextest run --profile ci $CARGO_FLAGS --locked --color=always --manifest-path $crate/Cargo.toml --all-features
|
||||
|
||||
new_report_dir="$parent/junit_reports/$crate"
|
||||
mkdir -p "$new_report_dir"
|
||||
mv "$parent/target/nextest/ci/junit.xml" "$new_report_dir/junit.xml"
|
||||
done
|
||||
|
|
|
@ -42,6 +42,43 @@
|
|||
"--all-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/$crate/"
|
||||
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($features in $features_matrix) {
|
||||
foreach($crate in $crates)
|
||||
{
|
||||
|
@ -77,11 +114,12 @@ foreach($features in $features_matrix) {
|
|||
|
||||
$env:G_DEBUG="fatal_warnings"
|
||||
$env:RUST_BACKTRACE="1"
|
||||
cargo test --no-fail-fast --color=always --manifest-path $crate/Cargo.toml $env:LocalFeatures
|
||||
|
||||
cargo nextest run --profile=ci --no-fail-fast --color=always --manifest-path $crate/Cargo.toml $env:LocalFeatures
|
||||
if (!$?) {
|
||||
Write-Host "Tests failed to for crate: $crate"
|
||||
Exit 1
|
||||
}
|
||||
|
||||
Move-Junit -Features $features
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,4 +15,17 @@ if (!$?) {
|
|||
Exit 1
|
||||
}
|
||||
|
||||
# Multiple dependencies of cargo-nextest require 1.74/1.75 nowadays
|
||||
if ("$env:RUST_VERSION" -eq "1.71.1") {
|
||||
cargo install --locked cargo-nextest@0.9.67
|
||||
} else {
|
||||
cargo install --locked cargo-nextest
|
||||
}
|
||||
|
||||
if (!$?) {
|
||||
Write-Host "Failed to install cargo-nextest"
|
||||
Exit 1
|
||||
}
|
||||
|
||||
cargo-cbuild --version
|
||||
cargo nextest --version
|
||||
|
|
Loading…
Reference in a new issue