-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathaction.yml
More file actions
44 lines (39 loc) · 1.14 KB
/
action.yml
File metadata and controls
44 lines (39 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
name: Coverage
description: "Runs code-coverage checker."
inputs:
enforce:
description: 'Whether to enforce coverage thresholds.'
required: false
default: 'false'
runs:
using: composite
steps:
- uses: ./.github/actions/get-go-version
id: go-version
- name: Test with coverage
shell: bash
id: test-coverage
run: |
set +e
make test-coverage
status=$?
echo "coverage_status=$status" >> $GITHUB_OUTPUT
- name: Upload coverage results
uses: actions/upload-artifact@v7
with:
name: Coverage-result-${{ steps.go-version.outputs.version }}
path: build/coverage*
- name: Enforce coverage
shell: bash
run: |
if [ "${STEPS_TEST_COVERAGE_OUTPUTS_COVERAGE_STATUS}" != "0" ]; then
echo "Code isn't fully covered!"
if [ "${INPUTS_ENFORCE}" == "true" ]; then
exit 1
fi
else
echo "Code is fully covered!"
fi
env:
STEPS_TEST_COVERAGE_OUTPUTS_COVERAGE_STATUS: ${{ steps.test-coverage.outputs.coverage_status }}
INPUTS_ENFORCE: ${{ inputs.enforce }}