From ca5ca58f32527fdfb57b4f7c8da9b7695db45e4f Mon Sep 17 00:00:00 2001 From: James Kessler Date: Mon, 14 Oct 2024 16:34:08 -0700 Subject: [PATCH 1/6] Add test for coverage-reporter-version. --- .github/workflows/test.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3a6802f1..80611757 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,6 +16,7 @@ jobs: os: [ubuntu-latest, windows-latest, macos-latest] action: [report, done, build-number-report, build-number-done] # Note: We're also testing 'install' since it's implicit in each action fail_on_error: [true, false] + coverage_reporter_version: ['v0.6.14', 'latest', ''] steps: - name: Checkout code uses: actions/checkout@v3 @@ -40,10 +41,16 @@ jobs: uses: ./ with: github-token: ${{ secrets.GITHUB_TOKEN }} - fail-on-error: ${{ matrix.fail_on_error }} debug: true + fail-on-error: ${{ matrix.fail_on_error }} 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` parallel-finished: ${{ matrix.action == 'done' || matrix.action == 'build-number-done' }} # Only set `parallel-finished` to `true` when testing `done` or `build-number-done` + coverage-reporter-version: ${{ matrix.coverage_reporter_version != '' && matrix.coverage_reporter_version || '' }} env: CI: true continue-on-error: ${{ matrix.fail_on_error }} + + - name: (Debug) Print coverage-reporter-version + run: | + echo "coverage-reporter-version: ${{ matrix.coverage_reporter_version }}" + From 4305b116c7bef24039697a9a90e6efcf66ad1b10 Mon Sep 17 00:00:00 2001 From: James Kessler Date: Mon, 14 Oct 2024 17:08:33 -0700 Subject: [PATCH 2/6] Add logic to handle when coverage-reporter-version is empty, in addition to when it is null/unset. --- action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index e9032638..fc556a27 100644 --- a/action.yml +++ b/action.yml @@ -120,7 +120,7 @@ runs: cd ~/bin/ # Determine which version of coverage-reporter to download - if [ "$COVERAGE_REPORTER_VERSION" == "latest" ]; then + if [ -z "$COVERAGE_REPORTER_VERSION" ] || [ "$COVERAGE_REPORTER_VERSION" == "latest" ]; then asset_path="latest/download" else asset_path="download/${COVERAGE_REPORTER_VERSION}" @@ -167,7 +167,7 @@ runs: # Try to download the binary and checksum file New-Item -Path $env:HOME\bin -ItemType directory -Force Push-Location $env:HOME\bin - if($env:COVERAGE_REPORTER_VERSION -eq "latest") { + if ([string]::IsNullOrEmpty($env:COVERAGE_REPORTER_VERSION) -or $env:COVERAGE_REPORTER_VERSION -eq "latest") { Invoke-WebRequest -Uri "https://github.com/coverallsapp/coverage-reporter/releases/latest/download/coveralls-windows.exe" -OutFile "coveralls.exe" Invoke-WebRequest -Uri "https://github.com/coverallsapp/coverage-reporter/releases/latest/download/coveralls-checksums.txt" -OutFile "sha256sums.txt" } else { From b72adce3cb2ece4d46cb01d591a9ea58b9a9a775 Mon Sep 17 00:00:00 2001 From: James Kessler Date: Tue, 15 Oct 2024 08:49:35 -0700 Subject: [PATCH 3/6] Set continue-on-error to inverse of fail-on-error. --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 80611757..ce71a824 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -48,7 +48,7 @@ jobs: coverage-reporter-version: ${{ matrix.coverage_reporter_version != '' && matrix.coverage_reporter_version || '' }} env: CI: true - continue-on-error: ${{ matrix.fail_on_error }} + continue-on-error: ${{ matrix.fail_on_error == 'false' }} # Inverse of fail-on-error - name: (Debug) Print coverage-reporter-version run: | From e3138555e90d28c64d4a88cd7385fe92a0ff3ee7 Mon Sep 17 00:00:00 2001 From: James Kessler Date: Tue, 15 Oct 2024 08:57:44 -0700 Subject: [PATCH 4/6] Make sure failing step never fails workflow with continue-on-error: true. --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ce71a824..8a0c7bec 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -48,7 +48,7 @@ jobs: coverage-reporter-version: ${{ matrix.coverage_reporter_version != '' && matrix.coverage_reporter_version || '' }} env: CI: true - continue-on-error: ${{ matrix.fail_on_error == 'false' }} # Inverse of fail-on-error + continue-on-error: true - name: (Debug) Print coverage-reporter-version run: | From a35a81d619480732b8b3ef5009ad71438e162179 Mon Sep 17 00:00:00 2001 From: James Kessler Date: Tue, 15 Oct 2024 09:30:56 -0700 Subject: [PATCH 5/6] Remove debug step. No longer needed. --- .github/workflows/test.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8a0c7bec..4fbb2e0e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -49,8 +49,3 @@ jobs: env: CI: true continue-on-error: true - - - name: (Debug) Print coverage-reporter-version - run: | - echo "coverage-reporter-version: ${{ matrix.coverage_reporter_version }}" - From dacb8c2703ec535e3c52ba3959bd5726171e3b75 Mon Sep 17 00:00:00 2001 From: James Kessler Date: Tue, 15 Oct 2024 09:31:52 -0700 Subject: [PATCH 6/6] Apply fail-on-error logic to error state when user tries to set coverage-reporter-version on MacOS, which is not available there. --- action.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index fc556a27..e6fafad2 100644 --- a/action.yml +++ b/action.yml @@ -105,7 +105,11 @@ runs: shell: bash run: | echo "The coverage-reporter-version parameter is not available on macOS." >&2 - exit 1 + if [[ "${{ inputs.fail-on-error }}" == "true" ]]; then + exit 1 + else + exit 0 + fi - name: Install coveralls reporter (Linux) if: runner.os == 'Linux'