From 0893fb899914928b7a5d36a47c053805c47bd3f8 Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Thu, 19 Sep 2024 23:38:35 +0200 Subject: [PATCH] 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: --- ci/run-cargo-test.sh | 11 +++++++---- ci/run-sys-cargo-test.sh | 7 +++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ci/run-cargo-test.sh b/ci/run-cargo-test.sh index bc6eda2db..83f05a8f8 100755 --- a/ci/run-cargo-test.sh +++ b/ci/run-cargo-test.sh @@ -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 diff --git a/ci/run-sys-cargo-test.sh b/ci/run-sys-cargo-test.sh index 16394c117..932006bc1 100755 --- a/ci/run-sys-cargo-test.sh +++ b/ci/run-sys-cargo-test.sh @@ -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 @@ -33,5 +36,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