Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci code coverage report #3

Merged
merged 35 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
b9005a3
Add job to create code coverage report
fgrosse Mar 10, 2024
ab5fa3b
Get changed files
fgrosse Mar 10, 2024
80c76fb
Get changed files as JSON file
fgrosse Mar 10, 2024
8e2e1a7
Ignore non-go, tests and files from vendor
fgrosse Mar 10, 2024
579b158
Add -mod=readonly
fgrosse Mar 10, 2024
fda9c51
Add more "changed" files for testing
fgrosse Mar 10, 2024
28820ef
First attempt to use go-coverage-report
fgrosse Mar 11, 2024
4df9c20
Debugging go install
fgrosse Mar 11, 2024
79552f9
Setup Go to fetch go-coverage-report
fgrosse Mar 11, 2024
567207d
Pin version of tj-actions/changed-files
fgrosse Mar 11, 2024
8a11b88
Fix downloading code coverage results
fgrosse Mar 11, 2024
8bc2d60
Download code coverage results from target branch
fgrosse Mar 11, 2024
259186a
Download coverage profiles into .github/outputs
fgrosse Mar 11, 2024
191f977
Update the last comment if it exists
fgrosse Mar 11, 2024
0c6d062
Delete old coverage report comment instead of updating it in place
fgrosse Mar 11, 2024
f7850c0
Fix "Comment on pull request" step
fgrosse Mar 11, 2024
69775a0
Fix "Download code coverage results from target branch" step
fgrosse Mar 11, 2024
54fdb4f
Use GitHub action from other repo
fgrosse Mar 11, 2024
8838d0a
Update go-coverage-report
fgrosse Mar 11, 2024
3f3b6b9
Only execute coverage report job on "pull_request" events
fgrosse Mar 12, 2024
dcde7b6
Use new version of go-coverage-report action
fgrosse Mar 12, 2024
88fc093
Use new action version
fgrosse Mar 12, 2024
92348c4
Update version of GitHub action
fgrosse Mar 12, 2024
ddbf35a
Add with
fgrosse Mar 12, 2024
fa1cecf
Update version of go-coverage-report
fgrosse Mar 12, 2024
d37f6f8
Update go-coverage-report version
fgrosse Mar 14, 2024
ffd28b6
Update version
fgrosse Mar 14, 2024
0342af0
Test using sha256sum
fgrosse Mar 18, 2024
fdb422d
Use go-coverage-report@v1.0.0
fgrosse Mar 18, 2024
254f33a
Limit permissions of code coverage CI job
fgrosse Apr 5, 2024
254d271
Test removing `contents: read` permission
fgrosse Jul 25, 2024
901c447
Add back permissions to download code coverage artifacts
fgrosse Jul 25, 2024
1157977
Restore code from main branch
fgrosse Jul 25, 2024
8a0649b
go mod tidy
fgrosse Jul 25, 2024
9589c52
Use newer version of fgrosse/go-coverage-report
fgrosse Jul 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: CI

on:
pull_request:
types: [opened, reopened, synchronize]
push:
branches:
- 'main'
Expand All @@ -20,10 +21,21 @@ jobs:
go-version: ^1.22

- name: Test
run: go test -v -cover -coverprofile=coverage.txt -covermode=count ./...
run: go test -cover -coverprofile=coverage.txt -mod=readonly ./...

- name: Archive code coverage results
uses: actions/upload-artifact@v4
with:
name: code-coverage
path: coverage.txt

code_coverage:
name: "Code coverage report"
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
needs: unit_tests
permissions:
contents: read # to download code coverage results from unit_tests job
pull-requests: write # write permission needed to comment on PR
steps:
- uses: fgrosse/go-coverage-report@v1.0.2
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
coverage.txt
*coverage.txt
.github/outputs
Loading