Skip to content

Commit

Permalink
[ci] Generate unit test coverage on PR (#759)
Browse files Browse the repository at this point in the history
  • Loading branch information
ian-shim authored Sep 13, 2024
1 parent bccff55 commit 0d64c9a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/actions/test-coverage/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ runs:
go-version: ${{inputs.go-version}}

- name: Download coverage artifact
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: coverage
path: .
Expand Down
1 change: 1 addition & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- [ ] I've made sure the lint is passing in this PR.
- [ ] I've made sure the tests are passing. Note that there might be a few flaky tests, in that case, please comment that they are not relevant.
- [ ] I've checked the new test coverage and the coverage percentage didn't drop.
- Testing Strategy
- [ ] Unit tests
- [ ] Integration tests
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ jobs:
name: coverage
path: coverage.out

- name: Extract coverage
shell: bash
run: |
COVERAGE=$(go tool cover -func="coverage.out" | tail -1 | grep -Eo '[0-9]+\.[0-9]')
echo "coverage: $COVERAGE% of statements"
coverage-report:
name: Coverage Report
needs: unit-tests
Expand Down

0 comments on commit 0d64c9a

Please sign in to comment.