Skip to content

Commit 0e32a2c

Browse files
committed
ci: Coverage gate? 👷
1 parent 520c8e1 commit 0e32a2c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

‎.github/workflows/ci.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,19 @@ jobs:
2727
run: go install github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@latest
2828

2929
# Run tests with nice formatting. Save the original log in /tmp/gotest.log
30-
- name: Run tests
30+
- name: Run tests and Check Coverage
3131
run: |
3232
set -euo pipefail
3333
go test -json -race -covermode=atomic -coverprofile=coverage.out ./... 2>&1 | tee /tmp/gotest.log | gotestfmt
3434
COVERAGE=$(cat /tmp/gotest.log | sed -nr "s/.*coverage:.([0-9.]+).*/\1/p" | uniq)
3535
echo "COVERAGE=${COVERAGE}" >> $GITHUB_ENV
36-
echo "Coverage is: ${COVERAGE}%"
36+
37+
- name: Check coverage tolerance
38+
if: ${{ env.COVERAGE < 80 }}
39+
uses: actions/github-script@v3
40+
with:
41+
script: |
42+
core.setFailed('Coverage test below tolerance')
3743
3844
- name: Update coverage badge
3945
uses: cybercinch/dynamic-badges-action@master

0 commit comments

Comments
 (0)