ci: Only use as many cores as we're supposed to

Instead of spawning 64 compiler instances on a 64-core machine that's
being shared with 7 other jobs.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1545>
This commit is contained in:
Daniel Stone 2024-09-19 23:38:35 +02:00 committed by Jordan Petridis
parent b5bf829876
commit 7b51a7c77b
2 changed files with 12 additions and 6 deletions

View file

@ -5,6 +5,9 @@ set -ex
rustc --version
cargo --version
cpus=$(nproc || sysctl -n hw.ncpu)
CARGO_FLAGS="-j${FDO_CI_CONCURRENT:-$cpus}"
for crate in gstreamer* gstreamer-gl/{egl,wayland,x11}; do
if [ -e "$crate/Cargo.toml" ]; then
if [ -n "$ALL_FEATURES" ]; then
@ -15,8 +18,8 @@ for crate in gstreamer* gstreamer-gl/{egl,wayland,x11}; do
echo "Building and testing $crate with $FEATURES"
cargo build --locked --color=always --manifest-path "$crate/Cargo.toml" $FEATURES
RUST_BACKTRACE=1 G_DEBUG=fatal_warnings cargo test --color=always --manifest-path "$crate/Cargo.toml" $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
fi
done
@ -25,6 +28,6 @@ if [ -n "$EXAMPLES_TUTORIALS" ]; then
# 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"
cargo build --locked --color=always --manifest-path examples/Cargo.toml --bins --examples "$EXAMPLES_FEATURES"
cargo build --locked --color=always --manifest-path tutorials/Cargo.toml --bins --examples --all-features
cargo build $CARGO_FLAGS --locked --color=always --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
fi

View file

@ -5,10 +5,13 @@ set -ex
rustc --version
cargo --version
cpus=$(nproc || sysctl -n hw.ncpu)
CARGO_FLAGS="-j${FDO_CI_CONCURRENT:-$cpus}"
for crate in gstreamer*/sys gstreamer-gl/*/sys; do
if [ -e "$crate/Cargo.toml" ]; then
echo "Building $crate with --all-features"
cargo build --locked --color=always --manifest-path "$crate/Cargo.toml" --all-features
cargo build $CARGO_FLAGS --locked --color=always --manifest-path "$crate/Cargo.toml" --all-features
fi
done
@ -39,5 +42,5 @@ for crate in gstreamer/sys \
gstreamer-video/sys \
gstreamer-webrtc/sys; do
echo "Testing $crate with --all-features)"
RUST_BACKTRACE=1 cargo test --locked --color=always --manifest-path $crate/Cargo.toml --all-features
RUST_BACKTRACE=1 cargo test $CARGO_FLAGS --locked --color=always --manifest-path $crate/Cargo.toml --all-features
done