From 72d2fbfb3dd1bf27e1bdc7107be72c70749c6876 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sun, 15 Nov 2026 00:34:08 +0000 Subject: [PATCH] ci: allow limiting unsharded Rust test threads --- .github/workflows/sonarcloud.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 89995be..54efdc6 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -67,6 +67,13 @@ on: type: number required: false default: 4 + rust-test-threads: + description: >- + Optional positive Rust test-harness thread count for the single-job cargo llvm-cov path + (shards <= 1). Empty keeps the test harness default; ignored by sharded nextest runs. + type: string + required: false + default: "" secrets: SONAR_TOKEN: description: "Legacy or repository-level SonarCloud analysis token" @@ -269,13 +276,19 @@ jobs: CARGO_PROFILE_DEV_DEBUG: "0" SQLX_OFFLINE_INPUT: ${{ inputs.sqlx-offline }} CARGO_FEATURES: ${{ inputs.cargo-features }} + RUST_TEST_THREADS_INPUT: ${{ inputs.rust-test-threads }} run: | # Opt-in build settings; validated because they reach the cargo command line. if [[ ! "$CARGO_FEATURES" =~ ^[A-Za-z0-9_/,-]*$ ]]; then echo "::error::cargo-features may only hold feature names, '/', '-', '_' and ',', got '$CARGO_FEATURES'" exit 1 fi + if [[ -n "$RUST_TEST_THREADS_INPUT" && ! "$RUST_TEST_THREADS_INPUT" =~ ^[1-9][0-9]*$ ]]; then + echo "::error::rust-test-threads must be a positive integer, got '$RUST_TEST_THREADS_INPUT'" + exit 1 + fi if [ "$SQLX_OFFLINE_INPUT" = true ]; then export SQLX_OFFLINE=true; fi + if [ -n "$RUST_TEST_THREADS_INPUT" ]; then export RUST_TEST_THREADS="$RUST_TEST_THREADS_INPUT"; fi features=() if [ -n "$CARGO_FEATURES" ]; then features=(--features "$CARGO_FEATURES"); fi # show-env sets the instrumentation flags the same way the unsharded run gets them.