Skip to content

Commit 170ef51

Browse files
committed
feat(docker): optional Codecov coverage upload
Add a docker__codecov_upload input (default false) and an optional CODECOV_TOKEN secret to the reusable pipeline. When enabled, coverage produced by the test step is uploaded via codecov/codecov-action@v7 right after tests, before the extra post-test step and docker push.
1 parent 6897a5a commit 170ef51

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

.github/workflows/pipeline.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ on:
5151
type: string
5252
description: "Host directory used for ci-share in compose file"
5353
default: "./ci-share"
54+
docker__codecov_upload:
55+
type: boolean
56+
description: "Upload coverage to Codecov after tests (requires CODECOV_TOKEN secret)"
57+
default: false
5458
# -- Extra steps
5559
docker__post_test__extra_step_01:
5660
type: string
@@ -78,6 +82,10 @@ on:
7882
type: boolean
7983
description: "Create github release (use this with tags)"
8084
default: false
85+
secrets:
86+
CODECOV_TOKEN:
87+
description: "Codecov upload token (used when docker__codecov_upload is enabled)"
88+
required: false
8189
outputs:
8290
# Docker
8391
docker_image_name:
@@ -286,6 +294,13 @@ jobs:
286294
docker compose run --rm "$SERVICE_NAME" \
287295
${{ inputs.docker__compose_test_cmd }}
288296
297+
- name: ☂️ Upload coverage to Codecov
298+
if: ${{ inputs.docker__codecov_upload }}
299+
uses: codecov/codecov-action@v7
300+
with:
301+
token: ${{ secrets.CODECOV_TOKEN }}
302+
fail_ci_if_error: true
303+
289304
- name: ${{ inputs.docker__post_test__extra_step_01 }}
290305
if: ${{ inputs.docker__post_test__extra_step_01_command != '' }}
291306
env:

0 commit comments

Comments
 (0)