@@ -103,8 +103,11 @@ runs:
103103 [ "${{ inputs.debug }}" == "true" ] && set -x
104104
105105 # Try to install coverage-reporter via Homebrew
106- brew tap coverallsapp/coveralls --quiet
107- brew install coveralls --quiet
106+ if ! brew tap coverallsapp/coveralls --quiet || ! brew install coveralls --quiet; then
107+ echo "Failed to install coveralls via Homebrew (macOS)."
108+ [ "${{ inputs.fail-on-error }}" == "false" ] && exit 0
109+ exit 1
110+ fi
108111
109112 # Check if the binary exists in the possible locations
110113 if [ -f /usr/local/bin/coveralls ]; then
@@ -113,6 +116,7 @@ runs:
113116 echo "/opt/homebrew/bin" >> $GITHUB_PATH
114117 else
115118 echo "Coveralls binary not found after installation (MacOS)."
119+ [ "${{ inputs.fail-on-error }}" == "false" ] && exit 0
116120 exit 1
117121 fi
118122
@@ -220,6 +224,7 @@ runs:
220224 # Check if the binary exists
221225 if [ ! -f ~/bin/coveralls ]; then
222226 echo "Coveralls binary not found after extraction (Linux)."
227+ [ "${{ inputs.fail-on-error }}" == "false" ] && exit 0
223228 exit 1
224229 fi
225230
@@ -247,39 +252,55 @@ runs:
247252 # Try to download the binary and checksum file
248253 New-Item -Path $env:HOME\bin -ItemType directory -Force
249254 Push-Location $env:HOME\bin
250- if ([string]::IsNullOrEmpty($env:COVERAGE_REPORTER_VERSION) -or $env:COVERAGE_REPORTER_VERSION -eq "latest") {
251- Invoke-WebRequest -Uri "https://github.com/coverallsapp/coverage-reporter/releases/latest/download/coveralls-windows.exe" -OutFile "coveralls.exe"
252- Invoke-WebRequest -Uri "https://github.com/coverallsapp/coverage-reporter/releases/latest/download/coveralls-checksums.txt" -OutFile "sha256sums.txt"
253- } else {
254- Invoke-WebRequest -Uri "https://github.com/coverallsapp/coverage-reporter/releases/download/$env:COVERAGE_REPORTER_VERSION/coveralls-windows.exe" -OutFile "coveralls.exe"
255- Invoke-WebRequest -Uri "https://github.com/coverallsapp/coverage-reporter/releases/download/$env:COVERAGE_REPORTER_VERSION/coveralls-checksums.txt" -OutFile "sha256sums.txt"
255+ try {
256+ if ([string]::IsNullOrEmpty($env:COVERAGE_REPORTER_VERSION) -or $env:COVERAGE_REPORTER_VERSION -eq "latest") {
257+ Invoke-WebRequest -Uri "https://github.com/coverallsapp/coverage-reporter/releases/latest/download/coveralls-windows.exe" -OutFile "coveralls.exe"
258+ Invoke-WebRequest -Uri "https://github.com/coverallsapp/coverage-reporter/releases/latest/download/coveralls-checksums.txt" -OutFile "sha256sums.txt"
259+ } else {
260+ Invoke-WebRequest -Uri "https://github.com/coverallsapp/coverage-reporter/releases/download/$env:COVERAGE_REPORTER_VERSION/coveralls-windows.exe" -OutFile "coveralls.exe"
261+ Invoke-WebRequest -Uri "https://github.com/coverallsapp/coverage-reporter/releases/download/$env:COVERAGE_REPORTER_VERSION/coveralls-checksums.txt" -OutFile "sha256sums.txt"
262+ }
263+ } catch {
264+ Write-Host "Failed to download coveralls binary or checksum (Windows)."
265+ if ("${{ inputs.fail-on-error }}" -eq "false") {
266+ exit 0
267+ }
268+ exit 1
256269 }
257270
258271 # Try to verify the downloaded binary
259272 if ((Get-FileHash coveralls.exe).Hash -ne (Get-Content sha256sums.txt | Select-String 'windows.exe' | ForEach-Object { ($_ -split "\s+")[0] })) {
260273 Write-Host "Checksum verification failed (Windows)."
274+ if ("${{ inputs.fail-on-error }}" -eq "false") {
275+ exit 0
276+ }
261277 exit 1
262278 }
263279
264280 # Check if the binary exists
265281 if (!(Test-Path -Path "$env:HOME\bin\coveralls.exe")) {
266282 Write-Host "Coveralls binary not found after download and verification (Windows)."
283+ if ("${{ inputs.fail-on-error }}" -eq "false") {
284+ exit 0
285+ }
267286 exit 1
268287 }
269288
270289 # Cleanup
271290 Remove-Item sha256sums.txt -Force
272291 echo $env:HOME\bin | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
273292
274- - name : Done report
275- if : inputs.parallel-finished == 'true'
276- shell : ${{ startsWith(runner.os, 'Windows') && 'pwsh' || 'bash' }}
277- run : >-
278- coveralls done
279- ${{ inputs.debug == 'true' && '--debug' || '' }}
280- ${{ inputs.measure == 'true' && '--measure' || '' }}
281- ${{ inputs.build-number && format('--build-number {0}', inputs.build-number) || '' }}
282- ${{ inputs.fail-on-error == 'false' && '--no-fail' || '' }}
293+ - name : Done report (Unix)
294+ if : inputs.parallel-finished == 'true' && !startsWith(runner.os, 'Windows')
295+ shell : bash
296+ run : |
297+ # Check if coveralls binary exists
298+ if ! command -v coveralls &> /dev/null; then
299+ echo "Coveralls binary not found. Skipping done report."
300+ [ "${{ inputs.fail-on-error }}" == "false" ] && exit 0
301+ exit 1
302+ fi
303+ coveralls done ${{ inputs.debug == 'true' && '--debug' || '' }} ${{ inputs.measure == 'true' && '--measure' || '' }} ${{ inputs.build-number && format('--build-number {0}', inputs.build-number) || '' }} ${{ inputs.fail-on-error == 'false' && '--no-fail' || '' }}
283304 env :
284305 COVERALLS_DEBUG : ${{ inputs.debug }}
285306 COVERALLS_CARRYFORWARD_FLAGS : ${{ inputs.carryforward }}
@@ -290,20 +311,66 @@ runs:
290311 COVERALLS_GIT_COMMIT : ${{ inputs.git-commit }}
291312 COVERALLS_REPO_TOKEN : ${{ inputs.github-token }}
292313
293- - name : Coverage report
294- if : inputs.parallel-finished != 'true'
295- shell : ${{ startsWith(runner.os, 'Windows') && 'pwsh' || 'bash' }}
296- run : >-
297- coveralls report
298- ${{ inputs.debug == 'true' && '--debug' || '' }}
299- ${{ inputs.measure == 'true' && '--measure' || '' }}
300- ${{ inputs.fail-on-error == 'false' && '--no-fail' || '' }}
301- ${{ inputs.allow-empty == 'true' && '--allow-empty' || '' }}
302- ${{ inputs.base-path && format('--base-path {0}', inputs.base-path) || '' }}
303- ${{ inputs.build-number && format('--build-number {0}', inputs.build-number) || '' }}
304- ${{ inputs.format && format('--format {0}', inputs.format) || '' }}
305- ${{ inputs.file || inputs.path-to-lcov }}
306- ${{ inputs.files }}
314+ - name : Done report (Windows)
315+ if : inputs.parallel-finished == 'true' && startsWith(runner.os, 'Windows')
316+ shell : pwsh
317+ run : |
318+ # Check if coveralls binary exists
319+ if (!(Get-Command coveralls -ErrorAction SilentlyContinue)) {
320+ Write-Host "Coveralls binary not found. Skipping done report."
321+ if ("${{ inputs.fail-on-error }}" -eq "false") {
322+ exit 0
323+ }
324+ exit 1
325+ }
326+ coveralls done ${{ inputs.debug == 'true' && '--debug' || '' }} ${{ inputs.measure == 'true' && '--measure' || '' }} ${{ inputs.build-number && format('--build-number {0}', inputs.build-number) || '' }} ${{ inputs.fail-on-error == 'false' && '--no-fail' || '' }}
327+ env :
328+ COVERALLS_DEBUG : ${{ inputs.debug }}
329+ COVERALLS_CARRYFORWARD_FLAGS : ${{ inputs.carryforward }}
330+ COVERALLS_FLAG_NAME : ${{ inputs.flag-name }}
331+ COVERALLS_PARALLEL : ${{ inputs.parallel }}
332+ COVERALLS_ENDPOINT : ${{ inputs.coveralls-endpoint }}
333+ COVERALLS_GIT_BRANCH : ${{ inputs.git-branch }}
334+ COVERALLS_GIT_COMMIT : ${{ inputs.git-commit }}
335+ COVERALLS_REPO_TOKEN : ${{ inputs.github-token }}
336+
337+ - name : Coverage report (Unix)
338+ if : inputs.parallel-finished != 'true' && !startsWith(runner.os, 'Windows')
339+ shell : bash
340+ run : |
341+ # Check if coveralls binary exists
342+ if ! command -v coveralls &> /dev/null; then
343+ echo "Coveralls binary not found. Skipping coverage report."
344+ [ "${{ inputs.fail-on-error }}" == "false" ] && exit 0
345+ exit 1
346+ fi
347+ coveralls report ${{ inputs.debug == 'true' && '--debug' || '' }} ${{ inputs.measure == 'true' && '--measure' || '' }} ${{ inputs.fail-on-error == 'false' && '--no-fail' || '' }} ${{ inputs.allow-empty == 'true' && '--allow-empty' || '' }} ${{ inputs.base-path && format('--base-path {0}', inputs.base-path) || '' }} ${{ inputs.build-number && format('--build-number {0}', inputs.build-number) || '' }} ${{ inputs.format && format('--format {0}', inputs.format) || '' }} ${{ inputs.file || inputs.path-to-lcov }} ${{ inputs.files }}
348+ env :
349+ COVERALLS_DEBUG : ${{ inputs.debug }}
350+ COVERALLS_CARRYFORWARD_FLAGS : ${{ inputs.carryforward }}
351+ COVERALLS_FLAG_NAME : ${{ inputs.flag-name }}
352+ COVERALLS_PARALLEL : ${{ inputs.parallel }}
353+ COVERALLS_ENDPOINT : ${{ inputs.coveralls-endpoint }}
354+ COVERALLS_GIT_BRANCH : ${{ inputs.git-branch }}
355+ COVERALLS_GIT_COMMIT : ${{ inputs.git-commit }}
356+ COVERALLS_REPO_TOKEN : ${{ inputs.github-token }}
357+ COVERALLS_COMPARE_REF : ${{ inputs.compare-ref }}
358+ COVERALLS_COMPARE_SHA : ${{ inputs.compare-sha }}
359+ COVERALLS_SOURCE_HEADER : github-action
360+
361+ - name : Coverage report (Windows)
362+ if : inputs.parallel-finished != 'true' && startsWith(runner.os, 'Windows')
363+ shell : pwsh
364+ run : |
365+ # Check if coveralls binary exists
366+ if (!(Get-Command coveralls -ErrorAction SilentlyContinue)) {
367+ Write-Host "Coveralls binary not found. Skipping coverage report."
368+ if ("${{ inputs.fail-on-error }}" -eq "false") {
369+ exit 0
370+ }
371+ exit 1
372+ }
373+ coveralls report ${{ inputs.debug == 'true' && '--debug' || '' }} ${{ inputs.measure == 'true' && '--measure' || '' }} ${{ inputs.fail-on-error == 'false' && '--no-fail' || '' }} ${{ inputs.allow-empty == 'true' && '--allow-empty' || '' }} ${{ inputs.base-path && format('--base-path {0}', inputs.base-path) || '' }} ${{ inputs.build-number && format('--build-number {0}', inputs.build-number) || '' }} ${{ inputs.format && format('--format {0}', inputs.format) || '' }} ${{ inputs.file || inputs.path-to-lcov }} ${{ inputs.files }}
307374 env :
308375 COVERALLS_DEBUG : ${{ inputs.debug }}
309376 COVERALLS_CARRYFORWARD_FLAGS : ${{ inputs.carryforward }}
0 commit comments