From 5e6d246a66c218aed01bc2ebe0c85748218f39e6 Mon Sep 17 00:00:00 2001 From: Brian Torres Date: Fri, 9 Feb 2024 10:58:39 -0800 Subject: [PATCH 1/5] add build number to inputs and pass it to the binary --- action.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/action.yml b/action.yml index ab37dc7f..b93b7291 100644 --- a/action.yml +++ b/action.yml @@ -22,6 +22,9 @@ inputs: flag-name: description: 'Job flag name, e.g. "Unit", "Functional", or "Integration". Will be shown in the Coveralls UI.' required: false + build-number: + description: 'Override the build number autodetected by CI. This is useful if your CI tool assigns a different build number per parallel build.' + required: false parallel: description: 'Set to true if you are running parallel jobs, then use "parallel-finished: true" for the last action.' required: false @@ -195,6 +198,7 @@ runs: 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' || '' }} env: COVERALLS_DEBUG: ${{ inputs.debug }} @@ -216,6 +220,7 @@ runs: ${{ 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 }} From 780c46a44f0f85dd2950b1c7f3e1cf36cce5e8b0 Mon Sep 17 00:00:00 2001 From: James Kessler Date: Fri, 11 Oct 2024 15:57:00 -0700 Subject: [PATCH 2/5] Tweak input option description. Add build-number to test matrix. --- .github/workflows/test.yml | 23 +++++++++++++++++++++++ action.yml | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 568363b1..e6e91a94 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -46,3 +46,26 @@ jobs: env: CI: true continue-on-error: ${{ matrix.fail_on_error }} + + - name: Test report with build-number input option + if: ${{ matrix.action == 'report' }} + uses: ./ + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + fail-on-error: ${{ matrix.fail_on_error }} + debug: true + build-number: ${{ github.sha }} + env: + CI: true + + - name: Test done with build-number input option + if: ${{ matrix.action == 'done' }} + uses: ./ + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + fail-on-error: ${{ matrix.fail_on_error }} + debug: true + parallel-finished: true + build-number: ${{ github.sha }} + env: + CI: true \ No newline at end of file diff --git a/action.yml b/action.yml index b93b7291..d4e7697f 100644 --- a/action.yml +++ b/action.yml @@ -23,7 +23,7 @@ inputs: description: 'Job flag name, e.g. "Unit", "Functional", or "Integration". Will be shown in the Coveralls UI.' required: false build-number: - description: 'Override the build number autodetected by CI. This is useful if your CI tool assigns a different build number per parallel build.' + description: 'Override the build number autodetected from CI. This is useful if your CI tool assigns a different build number per parallel build.' required: false parallel: description: 'Set to true if you are running parallel jobs, then use "parallel-finished: true" for the last action.' From 850e2aa42938bbacd2730a59d126fbe94cb8e854 Mon Sep 17 00:00:00 2001 From: James Kessler Date: Fri, 11 Oct 2024 16:04:55 -0700 Subject: [PATCH 3/5] Integrate build-number test into existing test matrix. --- .github/workflows/test.yml | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e6e91a94..fbb604d5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,7 +14,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] - action: [report, done] # Note: We're also testing 'install' since it's implicitly in each of these two actions + action: [report, done, build-number] # Note: We're also testing 'install' since it's implicit in each action fail_on_error: [true, false] steps: - name: Checkout code @@ -36,36 +36,14 @@ jobs: run: | echo "Running on Windows" - - name: Run Test Action + - name: Test Action uses: ./ with: github-token: ${{ secrets.GITHUB_TOKEN }} fail-on-error: ${{ matrix.fail_on_error }} debug: true - parallel-finished: ${{ matrix.action == 'done' }} # Only set 'parallel-finished' to true when testing 'done' + build-number: ${{ matrix.action == 'build-number' && github.sha || '' }} # Only set 'build-number' to `${{ github.sha }}` when testing `build-number` + parallel-finished: ${{ matrix.action == 'done' }} # Only set `parallel-finished` to `true` when testing `done` env: CI: true continue-on-error: ${{ matrix.fail_on_error }} - - - name: Test report with build-number input option - if: ${{ matrix.action == 'report' }} - uses: ./ - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - fail-on-error: ${{ matrix.fail_on_error }} - debug: true - build-number: ${{ github.sha }} - env: - CI: true - - - name: Test done with build-number input option - if: ${{ matrix.action == 'done' }} - uses: ./ - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - fail-on-error: ${{ matrix.fail_on_error }} - debug: true - parallel-finished: true - build-number: ${{ github.sha }} - env: - CI: true \ No newline at end of file From 6e612180ed083c3fc3d93cfabbd9c59ffdc4fb0f Mon Sep 17 00:00:00 2001 From: James Kessler Date: Fri, 11 Oct 2024 16:18:32 -0700 Subject: [PATCH 4/5] Make sure build-number gets tested in the done command as well; requires splitting the build-number action into build-number-report and build-number-done. --- .github/workflows/test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fbb604d5..3a6802f1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,7 +14,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] - action: [report, done, build-number] # Note: We're also testing 'install' since it's implicit in each action + 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] steps: - name: Checkout code @@ -42,8 +42,8 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} fail-on-error: ${{ matrix.fail_on_error }} debug: true - build-number: ${{ matrix.action == 'build-number' && github.sha || '' }} # Only set 'build-number' to `${{ github.sha }}` when testing `build-number` - parallel-finished: ${{ matrix.action == 'done' }} # Only set `parallel-finished` to `true` when testing `done` + 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` env: CI: true continue-on-error: ${{ matrix.fail_on_error }} From f46044558ab0e6bc7dd4b556df167945931fab09 Mon Sep 17 00:00:00 2001 From: James Kessler Date: Fri, 11 Oct 2024 16:32:36 -0700 Subject: [PATCH 5/5] Tweak description copy. --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index d4e7697f..e9032638 100644 --- a/action.yml +++ b/action.yml @@ -23,7 +23,7 @@ inputs: description: 'Job flag name, e.g. "Unit", "Functional", or "Integration". Will be shown in the Coveralls UI.' required: false build-number: - description: 'Override the build number autodetected from CI. This is useful if your CI tool assigns a different build number per parallel build.' + description: 'Override the build number autodetected from CI. This is useful if your CI tool assigns a different build number per each parallel build.' required: false parallel: description: 'Set to true if you are running parallel jobs, then use "parallel-finished: true" for the last action.'