Skip to content

Commit 43f11c4

Browse files
authored
Verify that coverage-reporter-version option is recognized (#229)
* Add test for coverage-reporter-version. * Add logic to handle when coverage-reporter-version is empty, in addition to when it is null/unset. * Apply fail-on-error logic to error when user tries to set coverage-reporter-version on MacOS (not available there).
1 parent c258231 commit 43f11c4

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

Diff for: .github/workflows/test.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
os: [ubuntu-latest, windows-latest, macos-latest]
1717
action: [report, done, build-number-report, build-number-done] # Note: We're also testing 'install' since it's implicit in each action
1818
fail_on_error: [true, false]
19+
coverage_reporter_version: ['v0.6.14', 'latest', '']
1920
steps:
2021
- name: Checkout code
2122
uses: actions/checkout@v3
@@ -40,10 +41,11 @@ jobs:
4041
uses: ./
4142
with:
4243
github-token: ${{ secrets.GITHUB_TOKEN }}
43-
fail-on-error: ${{ matrix.fail_on_error }}
4444
debug: true
45+
fail-on-error: ${{ matrix.fail_on_error }}
4546
build-number: ${{ (matrix.action == 'build-number-report' || matrix.action == 'build-number-done') && github.sha || '' }} # Only set 'build-number' to `${{ github.sha }}` when testing `build-number-report` or `build-number-done`
4647
parallel-finished: ${{ matrix.action == 'done' || matrix.action == 'build-number-done' }} # Only set `parallel-finished` to `true` when testing `done` or `build-number-done`
48+
coverage-reporter-version: ${{ matrix.coverage_reporter_version != '' && matrix.coverage_reporter_version || '' }}
4749
env:
4850
CI: true
49-
continue-on-error: ${{ matrix.fail_on_error }}
51+
continue-on-error: true

Diff for: action.yml

+7-3
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,11 @@ runs:
105105
shell: bash
106106
run: |
107107
echo "The coverage-reporter-version parameter is not available on macOS." >&2
108-
exit 1
108+
if [[ "${{ inputs.fail-on-error }}" == "true" ]]; then
109+
exit 1
110+
else
111+
exit 0
112+
fi
109113
110114
- name: Install coveralls reporter (Linux)
111115
if: runner.os == 'Linux'
@@ -120,7 +124,7 @@ runs:
120124
cd ~/bin/
121125
122126
# Determine which version of coverage-reporter to download
123-
if [ "$COVERAGE_REPORTER_VERSION" == "latest" ]; then
127+
if [ -z "$COVERAGE_REPORTER_VERSION" ] || [ "$COVERAGE_REPORTER_VERSION" == "latest" ]; then
124128
asset_path="latest/download"
125129
else
126130
asset_path="download/${COVERAGE_REPORTER_VERSION}"
@@ -167,7 +171,7 @@ runs:
167171
# Try to download the binary and checksum file
168172
New-Item -Path $env:HOME\bin -ItemType directory -Force
169173
Push-Location $env:HOME\bin
170-
if($env:COVERAGE_REPORTER_VERSION -eq "latest") {
174+
if ([string]::IsNullOrEmpty($env:COVERAGE_REPORTER_VERSION) -or $env:COVERAGE_REPORTER_VERSION -eq "latest") {
171175
Invoke-WebRequest -Uri "https://github.com/coverallsapp/coverage-reporter/releases/latest/download/coveralls-windows.exe" -OutFile "coveralls.exe"
172176
Invoke-WebRequest -Uri "https://github.com/coverallsapp/coverage-reporter/releases/latest/download/coveralls-checksums.txt" -OutFile "sha256sums.txt"
173177
} else {

0 commit comments

Comments
 (0)