diff --git a/.github/workflows/testo.yml b/.github/workflows/testo.yml index 74f3645..d05ebb4 100644 --- a/.github/workflows/testo.yml +++ b/.github/workflows/testo.yml @@ -81,7 +81,7 @@ on: type: string testo-additional-args: description: Additional Testo arguments, separated by whitespace. - default: "--log-junit=junit.xml" + default: "" required: false type: string testo-configuration: @@ -104,6 +104,11 @@ on: default: required: false type: string + testo-junit-file: + description: JUnit report file, passed with `--log-junit` and uploaded to Codecov as test results; empty disables it. + default: junit.xml + required: false + type: string testo-path: description: Path to the Testo executable. default: vendor/bin/testo @@ -191,6 +196,7 @@ jobs: exclude-group: ${{ inputs.testo-exclude-group }} filter: ${{ inputs.testo-filter }} group: ${{ inputs.testo-group }} + junit-file: ${{ inputs.testo-junit-file }} path: ${{ inputs.testo-path }} suite: ${{ inputs.testo-suite }} type: ${{ inputs.testo-type }} diff --git a/CHANGELOG.md b/CHANGELOG.md index dda9fb1..399954b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## v3.0.2 Under development +- feat(testo): add junit-file input for JUnit report and update additional args handling. + ## v3.0.1 October 26, 2026 - ci(actions): add the reusable `testo.yml` workflow and the `testo` composite action to run Testo suites with coverage and Codecov uploads. diff --git a/actions/phpunit/action.yml b/actions/phpunit/action.yml index e675985..628206f 100644 --- a/actions/phpunit/action.yml +++ b/actions/phpunit/action.yml @@ -87,8 +87,9 @@ runs: PHPUNIT_CMD="$PHPUNIT_CMD $DEBUG_INPUT" fi + # Line breaks are replaced with spaces so the command stays a single `GITHUB_OUTPUT` line. if [ -n "$ADDITIONAL_ARGS" ]; then - PHPUNIT_CMD="$PHPUNIT_CMD $ADDITIONAL_ARGS" + PHPUNIT_CMD="$PHPUNIT_CMD ${ADDITIONAL_ARGS//[$'\r\n']/ }" fi echo "command=$PHPUNIT_CMD" >> "$GITHUB_OUTPUT" @@ -116,7 +117,12 @@ runs: report_type: test_results - name: Upload coverage to Codecov. - if: ${{ !cancelled() && inputs.coverage-driver != 'none' }} + if: >- + ${{ + !cancelled() + && inputs.coverage-driver != '' + && inputs.coverage-driver != 'none' + }} uses: codecov/codecov-action@0fb7174895f61a3b6b78fc075e0cd60383518dac # v5.5.5 with: token: ${{ inputs.coverage-token }} diff --git a/actions/testo/action.yml b/actions/testo/action.yml index da92ed7..7d55bf6 100644 --- a/actions/testo/action.yml +++ b/actions/testo/action.yml @@ -5,7 +5,7 @@ description: Run Testo tests with coverage and configurable options. inputs: additional-args: description: Additional Testo arguments, separated by whitespace. - default: "--log-junit=junit.xml" + default: "" required: false configuration: description: Testo configuration file, passed with `--config`. @@ -39,6 +39,10 @@ inputs: description: Group to run, passed with `--group`. default: "" required: false + junit-file: + description: JUnit report file, passed with `--log-junit` and uploaded to Codecov as test results; empty disables it. + default: junit.xml + required: false path: description: Path to the Testo executable. default: vendor/bin/testo @@ -67,6 +71,7 @@ runs: EXCLUDE_GROUP_INPUT: ${{ inputs.exclude-group }} FILTER_INPUT: ${{ inputs.filter }} GROUP_INPUT: ${{ inputs.group }} + JUNIT_FILE: ${{ inputs.junit-file }} PATH_INPUT: ${{ inputs.path }} SUITE_INPUT: ${{ inputs.suite }} TYPE_INPUT: ${{ inputs.type }} @@ -85,6 +90,7 @@ runs: args+=("--coverage-$COVERAGE_FORMAT=$COVERAGE_FILE") fi + add_param "--log-junit" "$JUNIT_FILE" add_param "--config" "$CONFIG_INPUT" add_param "--suite" "$SUITE_INPUT" add_param "--filter" "$FILTER_INPUT" @@ -97,8 +103,9 @@ runs: add_param "--type" "$TYPE_INPUT" # Additional arguments are whitespace-separated; each word is passed as one argument. + # Line breaks are replaced with spaces so multi-line values split like the Windows step. if [ -n "$ADDITIONAL_ARGS" ]; then - read -r -a extra <<< "$ADDITIONAL_ARGS" + read -r -a extra <<< "${ADDITIONAL_ARGS//[$'\r\n']/ }" if [ "${#extra[@]}" -gt 0 ]; then args+=("${extra[@]}") @@ -123,6 +130,7 @@ runs: EXCLUDE_GROUP_INPUT: ${{ inputs.exclude-group }} FILTER_INPUT: ${{ inputs.filter }} GROUP_INPUT: ${{ inputs.group }} + JUNIT_FILE: ${{ inputs.junit-file }} PATH_INPUT: ${{ inputs.path }} SUITE_INPUT: ${{ inputs.suite }} TYPE_INPUT: ${{ inputs.type }} @@ -139,6 +147,7 @@ runs: $testoArgs += "--coverage-$($env:COVERAGE_FORMAT)=$($env:COVERAGE_FILE)" } + Add-Param '--log-junit' $env:JUNIT_FILE Add-Param '--config' $env:CONFIG_INPUT Add-Param '--suite' $env:SUITE_INPUT Add-Param '--filter' $env:FILTER_INPUT @@ -164,14 +173,20 @@ runs: } - name: Upload test results to Codecov. - if: ${{ !cancelled() }} + if: ${{ !cancelled() && inputs.junit-file != '' }} uses: codecov/codecov-action@0fb7174895f61a3b6b78fc075e0cd60383518dac # v5.5.5 with: token: ${{ inputs.coverage-token }} + files: ./${{ inputs.junit-file }} report_type: test_results - name: Upload coverage to Codecov. - if: ${{ !cancelled() && inputs.coverage-driver != 'none' }} + if: >- + ${{ + !cancelled() + && inputs.coverage-driver != '' + && inputs.coverage-driver != 'none' + }} uses: codecov/codecov-action@0fb7174895f61a3b6b78fc075e0cd60383518dac # v5.5.5 with: token: ${{ inputs.coverage-token }}