File tree Expand file tree Collapse file tree 1 file changed +61
-0
lines changed Expand file tree Collapse file tree 1 file changed +61
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Go coverage
2+
3+ permissions :
4+ contents : read
5+
6+ on :
7+ pull_request :
8+ branches : ["main"]
9+ push :
10+ branches : ["main"]
11+ workflow_dispatch :
12+
13+ concurrency :
14+ group : ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
15+ cancel-in-progress : true
16+
17+ defaults :
18+ run :
19+ shell : bash
20+
21+ jobs :
22+ go-coverage :
23+ name : Go coverage
24+ runs-on : ubuntu-24.04
25+ permissions :
26+ pull-requests : write
27+ # container:
28+ # image: ghcr.io/tektoncd/plumbing/coverage:latest
29+
30+ steps :
31+ - name : Checkout
32+ uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
33+ with :
34+ path : ${{ github.workspace }}/src/github.com/tektoncd/chains
35+
36+ - name : Generate coverage
37+ working-directory : ${{ github.workspace }}/src/github.com/tektoncd/chains
38+ # -covermode=count
39+ run : |
40+ go test -cover -coverprofile=coverage.txt ./... || true
41+ echo "Generated coverage profile"
42+
43+ # - name: Run go-coverage
44+ # working-directory: ${{ github.workspace }}/src/github.com/tektoncd/chains
45+ # run: |
46+ # /coverage --profile-name=coverage_profile.txt --cov-target=. --cov-threshold-percentage=0
47+
48+ - name : Archive coverage results
49+ uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
50+ working-directory : ${{ github.workspace }}/src/github.com/tektoncd/chains
51+ with :
52+ name : code-coverage
53+ path : coverage.txt
54+
55+ - name : Comment on PR
56+ if : github.event_name == 'pull_request' # Do not run when workflow is triggered by push to main branch
57+ uses : fgrosse/go-coverage-report@8c1d1a09864211d258937b1b1a5b849f7e4f2682 # v1.2.0
58+ continue-on-error : true # This may fail if artifact on main branch does not exist (first run or expired)
59+ with :
60+ coverage-artifact-name : " code-coverage"
61+ coverage-file-name : " coverage.txt"
You can’t perform that action at this time.
0 commit comments