diff --git a/.config/nextest.toml b/.config/nextest.toml new file mode 100644 index 000000000..dde5328ca --- /dev/null +++ b/.config/nextest.toml @@ -0,0 +1,6 @@ +[profile.ci] +failure-output = "immediate-final" +fail-fast = false + +[profile.ci.junit] +path = "junit.xml" diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1bfa21470..db2580457 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 diff --git a/ci/images_template.yml b/ci/images_template.yml index 93bb7f641..d697b4528 100644 --- a/ci/images_template.yml +++ b/ci/images_template.yml @@ -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 diff --git a/ci/install-rust.sh b/ci/install-rust.sh index 9f2bd8cd2..b125395d2 100755 --- a/ci/install-rust.sh +++ b/ci/install-rust.sh @@ -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 diff --git a/ci/run-cargo-test.sh b/ci/run-cargo-test.sh index 83f05a8f8..5e258fc5d 100755 --- a/ci/run-cargo-test.sh +++ b/ci/run-cargo-test.sh @@ -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 diff --git a/ci/run-sys-cargo-test.sh b/ci/run-sys-cargo-test.sh index 106bb7d6c..35d7ce387 100755 --- a/ci/run-sys-cargo-test.sh +++ b/ci/run-sys-cargo-test.sh @@ -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 diff --git a/ci/run_windows_tests.ps1 b/ci/run_windows_tests.ps1 index faf9a1a74..3b6ee67d9 100644 --- a/ci/run_windows_tests.ps1 +++ b/ci/run_windows_tests.ps1 @@ -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 } } diff --git a/ci/windows-docker/install_cargo_utils.ps1 b/ci/windows-docker/install_cargo_utils.ps1 index 5c45aeb8d..bfbfd982d 100644 --- a/ci/windows-docker/install_cargo_utils.ps1 +++ b/ci/windows-docker/install_cargo_utils.ps1 @@ -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