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 4aac0ddc5..106bb7d6c 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 @@ -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