mirror of
https://github.com/storytold/craft-common-actions.git
synced 2026-11-15 15:02:24 +00:00
ci: allow limiting unsharded Rust test threads
This commit is contained in:
1 parent
a3f9743cb2
commit
72d2fbfb3d
1 file changed
+13
@@ -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.
|
||||
|
||||
Reference in new issue
Block a user