diff --git a/go/test/action.yml b/go/test/action.yml index 66a9f03..2f70c5e 100644 --- a/go/test/action.yml +++ b/go/test/action.yml @@ -9,13 +9,17 @@ inputs: description: A timeout value in seconds. If tests take longer than this, they will fail. Not setting this value will fallback to go test's default of 10 minutes. required: false default: "" + PARALLEL: + description: Whether to run tests in parallel. Defaults to true. + required: false + default: "true" runs: using: 'composite' steps: - name: Running go tests shell: bash - run: ${GITHUB_ACTION_PATH}/test.sh "${{ inputs.TAGS }}" "${{ inputs.TIMEOUT }}" + run: ${GITHUB_ACTION_PATH}/test.sh "${{ inputs.TAGS }}" "${{ inputs.TIMEOUT }}" "${{ inputs.PARALLEL }}" - name: Uploading test report uses: actions/upload-artifact@v4 with: diff --git a/go/test/test.sh b/go/test/test.sh index fa96f6f..d84d250 100755 --- a/go/test/test.sh +++ b/go/test/test.sh @@ -3,6 +3,7 @@ set -e TAGS=$1 TIMEOUT=$2 +PARALLEL=$3 cmd="go test 2>&1 ./... -coverprofile=coverage.out" @@ -31,6 +32,10 @@ if [ -n "$TIMEOUT" ]; then cmd="$cmd -timeout ${TIMEOUT}s" fi +if [ "$PARALLEL" = "false" ]; then + cmd="$cmd -p 1" +fi + echo "$cmd | tee test-report.out" eval "$cmd" | tee test-report.out