ci: Pass RUST_VERSION to scripts and refactor cargo/cargo nextest flags handling a bit

And also pass `-jN` to clippy.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1619>
This commit is contained in:
Sebastian Dröge 2024-12-21 11:11:05 +02:00
parent 083c5bdd5c
commit 52e5e47ef5
5 changed files with 25 additions and 12 deletions

View file

@ -118,18 +118,21 @@ trigger:
extends: .debian:12 extends: .debian:12
variables: variables:
RUST_IMAGE_FULL: "1" RUST_IMAGE_FULL: "1"
RUST_VERSION: '$GST_RS_STABLE'
FDO_DISTRIBUTION_TAG: '$GST_RS_STABLE-$GST_RS_IMG_TAG' FDO_DISTRIBUTION_TAG: '$GST_RS_STABLE-$GST_RS_IMG_TAG'
FDO_DISTRIBUTION_EXEC: 'bash ci/install-rust.sh $GST_RS_STABLE $RUST_IMAGE_FULL' FDO_DISTRIBUTION_EXEC: 'bash ci/install-rust.sh $GST_RS_STABLE $RUST_IMAGE_FULL'
.debian:12-msrv: .debian:12-msrv:
extends: .debian:12 extends: .debian:12
variables: variables:
RUST_VERSION: '$GST_RS_MSRV'
FDO_DISTRIBUTION_TAG: '$GST_RS_MSRV-$GST_RS_IMG_TAG' FDO_DISTRIBUTION_TAG: '$GST_RS_MSRV-$GST_RS_IMG_TAG'
FDO_DISTRIBUTION_EXEC: 'bash ci/install-rust.sh $GST_RS_MSRV $RUST_IMAGE_FULL' FDO_DISTRIBUTION_EXEC: 'bash ci/install-rust.sh $GST_RS_MSRV $RUST_IMAGE_FULL'
.debian:12-nightly: .debian:12-nightly:
extends: .debian:12 extends: .debian:12
variables: variables:
RUST_VERSION: 'nightly'
FDO_DISTRIBUTION_TAG: 'nightly-$GST_RS_IMG_TAG' FDO_DISTRIBUTION_TAG: 'nightly-$GST_RS_IMG_TAG'
FDO_DISTRIBUTION_EXEC: 'bash ci/install-rust.sh nightly $RUST_IMAGE_FULL' FDO_DISTRIBUTION_EXEC: 'bash ci/install-rust.sh nightly $RUST_IMAGE_FULL'
@ -615,6 +618,8 @@ test windows msrv:
- job: 'windows rust docker msrv' - job: 'windows rust docker msrv'
artifacts: false artifacts: false
extends: '.msvc2019 build' extends: '.msvc2019 build'
variables:
RUST_VERSION: !reference [variables, "GST_RS_MSRV"]
test windows stable: test windows stable:
needs: needs:
@ -624,3 +629,5 @@ test windows stable:
artifacts: false artifacts: false
image: "$WINDOWS_RUST_STABLE_IMAGE" image: "$WINDOWS_RUST_STABLE_IMAGE"
extends: '.msvc2019 build' extends: '.msvc2019 build'
variables:
RUST_VERSION: !reference [variables, "GST_RS_STABLE"]

View file

@ -6,7 +6,8 @@ rustc --version
cargo --version cargo --version
cpus=$(nproc || sysctl -n hw.ncpu) cpus=$(nproc || sysctl -n hw.ncpu)
CARGO_FLAGS="-j${FDO_CI_CONCURRENT:-$cpus}" CARGO_FLAGS="--color=always -j${FDO_CI_CONCURRENT:-$cpus}"
CARGO_NEXTEST_FLAGS="--profile=ci --no-tests=pass"
parent="${CI_PROJECT_DIR:-$(pwd)}" parent="${CI_PROJECT_DIR:-$(pwd)}"
@ -20,8 +21,8 @@ for crate in gstreamer* gstreamer-gl/{egl,wayland,x11}; do
echo "Building and testing $crate with $FEATURES" echo "Building and testing $crate with $FEATURES"
cargo build $CARGO_FLAGS --locked --color=always --manifest-path "$crate/Cargo.toml" $FEATURES cargo build $CARGO_FLAGS --locked --manifest-path "$crate/Cargo.toml" $FEATURES
RUST_BACKTRACE=1 G_DEBUG=fatal_warnings cargo nextest run --profile=ci --no-tests=pass $CARGO_FLAGS --color=always --manifest-path "$crate/Cargo.toml" $FEATURES RUST_BACKTRACE=1 G_DEBUG=fatal_warnings cargo nextest run $CARGO_NEXTEST_FLAGS $CARGO_FLAGS --locked --manifest-path "$crate/Cargo.toml" $FEATURES
new_report_dir="$parent/junit_reports/$crate" new_report_dir="$parent/junit_reports/$crate"
mkdir -p "$new_report_dir" mkdir -p "$new_report_dir"
@ -34,6 +35,6 @@ if [ -n "$EXAMPLES_TUTORIALS" ]; then
# List all features except windows/win32 # List all features except windows/win32
EXAMPLES_FEATURES="--features=rtsp-server,rtsp-server-record,pango-cairo,overlay-composition,gl,gst-gl-x11,gst-gl-egl,allocators,gst-play,gst-player,ges,image,cairo-rs,gst-video/v1_18" EXAMPLES_FEATURES="--features=rtsp-server,rtsp-server-record,pango-cairo,overlay-composition,gl,gst-gl-x11,gst-gl-egl,allocators,gst-play,gst-player,ges,image,cairo-rs,gst-video/v1_18"
cargo build $CARGO_FLAGS --locked --color=always --manifest-path examples/Cargo.toml --bins --examples "$EXAMPLES_FEATURES" cargo build $CARGO_FLAGS --locked --manifest-path examples/Cargo.toml --bins --examples "$EXAMPLES_FEATURES"
cargo build $CARGO_FLAGS --locked --color=always --manifest-path tutorials/Cargo.toml --bins --examples --all-features cargo build $CARGO_FLAGS --locked --manifest-path tutorials/Cargo.toml --bins --examples --all-features
fi fi

View file

@ -6,6 +6,9 @@ rustc --version
cargo --version cargo --version
cargo clippy --version cargo clippy --version
cpus=$(nproc || sysctl -n hw.ncpu)
CARGO_FLAGS="--color=always -j${FDO_CI_CONCURRENT:-$cpus}"
# Keep features in sync with run-cargo-test.sh # Keep features in sync with run-cargo-test.sh
get_features() { get_features() {
crate=$1 crate=$1
@ -25,7 +28,7 @@ for crate in gstreamer* gstreamer-gl/{egl,wayland,x11}; do
echo "Running clippy on $crate with $FEATURES" echo "Running clippy on $crate with $FEATURES"
cargo clippy --locked --color=always --manifest-path "$crate/Cargo.toml" $FEATURES --all-targets -- $CLIPPY_LINTS cargo clippy $CARGO_FLAGS --locked --manifest-path "$crate/Cargo.toml" $FEATURES --all-targets -- $CLIPPY_LINTS
fi fi
done done
@ -34,5 +37,5 @@ done
EXAMPLES_FEATURES="--features=rtsp-server,rtsp-server-record,pango-cairo,overlay-composition,gl,gst-gl-x11,gst-gl-egl,allocators,gst-play,gst-player,ges,image,cairo-rs,gst-video/v1_18" EXAMPLES_FEATURES="--features=rtsp-server,rtsp-server-record,pango-cairo,overlay-composition,gl,gst-gl-x11,gst-gl-egl,allocators,gst-play,gst-player,ges,image,cairo-rs,gst-video/v1_18"
# And also run over all the examples/tutorials # And also run over all the examples/tutorials
cargo clippy --locked --color=always --manifest-path examples/Cargo.toml --all-targets "$EXAMPLES_FEATURES" -- $CLIPPY_LINTS cargo clippy $CARGO_FLAGS --locked --manifest-path examples/Cargo.toml --all-targets "$EXAMPLES_FEATURES" -- $CLIPPY_LINTS
cargo clippy --locked --color=always --manifest-path tutorials/Cargo.toml --all-targets --all-features -- $CLIPPY_LINTS cargo clippy $CARGO_FLAGS --locked --manifest-path tutorials/Cargo.toml --all-targets --all-features -- $CLIPPY_LINTS

View file

@ -6,14 +6,15 @@ rustc --version
cargo --version cargo --version
cpus=$(nproc || sysctl -n hw.ncpu) cpus=$(nproc || sysctl -n hw.ncpu)
CARGO_FLAGS="-j${FDO_CI_CONCURRENT:-$cpus}" CARGO_FLAGS="--color=always -j${FDO_CI_CONCURRENT:-$cpus}"
CARGO_NEXTEST_FLAGS="--profile=ci --no-tests=pass"
parent="${CI_PROJECT_DIR:-$(pwd)}" parent="${CI_PROJECT_DIR:-$(pwd)}"
for crate in gstreamer*/sys gstreamer-gl/*/sys; do for crate in gstreamer*/sys gstreamer-gl/*/sys; do
if [ -e "$crate/Cargo.toml" ]; then if [ -e "$crate/Cargo.toml" ]; then
echo "Building $crate with --all-features" echo "Building $crate with --all-features"
cargo build $CARGO_FLAGS --locked --color=always --manifest-path "$crate/Cargo.toml" --all-features cargo build $CARGO_FLAGS --locked --manifest-path "$crate/Cargo.toml" --all-features
fi fi
done done
@ -44,7 +45,7 @@ for crate in gstreamer/sys \
gstreamer-video/sys \ gstreamer-video/sys \
gstreamer-webrtc/sys; do gstreamer-webrtc/sys; do
echo "Testing $crate with --all-features)" echo "Testing $crate with --all-features)"
RUST_BACKTRACE=1 cargo nextest run --profile ci --no-tests=pass $CARGO_FLAGS --locked --color=always --manifest-path $crate/Cargo.toml --all-features RUST_BACKTRACE=1 cargo nextest run $CARGO_NEXTEST_FLAGS $CARGO_FLAGS --locked --manifest-path $crate/Cargo.toml --all-features
new_report_dir="$parent/junit_reports/$crate" new_report_dir="$parent/junit_reports/$crate"
mkdir -p "$new_report_dir" mkdir -p "$new_report_dir"

View file

@ -52,6 +52,7 @@ else
} }
Write-Host "Build Jobs: $ncpus" Write-Host "Build Jobs: $ncpus"
$cargo_opts = @("--color=always", "--jobs=$ncpus") $cargo_opts = @("--color=always", "--jobs=$ncpus")
$cargo_nextest_opts=@("--profile=ci", "--no-fail-fast", "--no-tests=pass")
function Move-Junit { function Move-Junit {
param ( param (
@ -125,7 +126,7 @@ foreach($features in $features_matrix) {
$env:G_DEBUG="fatal_warnings" $env:G_DEBUG="fatal_warnings"
$env:RUST_BACKTRACE="1" $env:RUST_BACKTRACE="1"
cargo nextest run --profile=ci --no-fail-fast --no-tests=pass $cargo_opts --manifest-path $crate/Cargo.toml $env:LocalFeatures cargo nextest run $cargo_nextest_opts $cargo_opts --manifest-path $crate/Cargo.toml $env:LocalFeatures
if (!$?) { if (!$?) {
Write-Host "Tests failed to for crate: $crate" Write-Host "Tests failed to for crate: $crate"
Exit 1 Exit 1