From b5e0e0713c91836b0de9cd440aa8b9e3a4b40d3d Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Fri, 20 Sep 2024 14:59:33 +0300 Subject: [PATCH] ci: Set build jobs according to FDO_CI_CONCURRENT when available The CI runners run multiple jobs concurrently, and as such we should only be building with the number of jobs allocated to us when the variable is set. Related to https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1545 Also move the rest of the common flags we pass to cargo together so it's a bit easier to read. Part-of: --- .gitlab-ci.yml | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ed17d995..b64907f2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -105,13 +105,14 @@ trigger: RUST_BACKTRACE: 'full' script: - rustc --version + - CARGO_FLAGS="-j${FDO_CI_CONCURRENT:-$(nproc)} --locked --color=always --all --all-targets" - - cargo build --locked --color=always --workspace --all-targets - - RUST_BACKTRACE=1 G_DEBUG=fatal_warnings cargo test --locked --color=always --workspace --all-targets - - cargo build --locked --color=always --workspace --all-targets --all-features --exclude gst-plugin-gtk4 - - RUST_BACKTRACE=1 G_DEBUG=fatal_warnings cargo test --locked --color=always --workspace --all-targets --all-features --exclude gst-plugin-gtk4 - - cargo build --locked --color=always --workspace --all-targets --no-default-features - - RUST_BACKTRACE=1 G_DEBUG=fatal_warnings cargo test --locked --color=always --workspace --all-targets --no-default-features + - cargo build $CARGO_FLAGS + - RUST_BACKTRACE=1 G_DEBUG=fatal_warnings cargo test $CARGO_FLAGS + - cargo build $CARGO_FLAGS --all-features --exclude gst-plugin-gtk4 + - RUST_BACKTRACE=1 G_DEBUG=fatal_warnings cargo test $CARGO_FLAGS --all-features --exclude gst-plugin-gtk4 + - cargo build $CARGO_FLAGS --no-default-features + - RUST_BACKTRACE=1 G_DEBUG=fatal_warnings cargo test $CARGO_FLAGS --no-default-features test msrv: extends: @@ -343,9 +344,10 @@ clippy: # csound-sys only looks at /usr/lib and /usr/local top levels CSOUND_LIB_DIR: '/usr/lib/x86_64-linux-gnu/' script: - - cargo clippy --locked --color=always --all --all-targets -- -D warnings -A unknown-lints - - cargo clippy --locked --color=always --all --all-features --all-targets --exclude gst-plugin-gtk4 -- -D warnings -A unknown-lints - - cargo clippy --locked --color=always --all --all-targets --no-default-features -- -D warnings -A unknown-lints + - CARGO_FLAGS="-j${FDO_CI_CONCURRENT:-$(nproc)} --locked --color=always --all --all-targets" + - cargo clippy $CARGO_FLAGS -- -D warnings -A unknown-lints + - cargo clippy $CARGO_FLAGS --all-features --exclude gst-plugin-gtk4 -- -D warnings -A unknown-lints + - cargo clippy $CARGO_FLAGS --no-default-features -- -D warnings -A unknown-lints deny: extends: .debian:12-stable @@ -388,7 +390,9 @@ coverage: # csound-sys only looks at /usr/lib and /usr/local top levels CSOUND_LIB_DIR: '/usr/lib/x86_64-linux-gnu/' script: - - cargo test --locked --color=always --all --all-features --exclude gst-plugin-gtk4 + - CARGO_FLAGS="-j${FDO_CI_CONCURRENT:-$(nproc)} --locked --color=always --all" + + - cargo test $CARGO_FLAGS --all-features --exclude gst-plugin-gtk4 # generate html report - mkdir -p coverage - grcov . --binary-path ./target/debug/ -s . -t html,cobertura --branch --ignore-not-existing --ignore "*target*" --ignore "*/build.rs" -o ./coverage/