File tree Expand file tree Collapse file tree 1 file changed +60
-0
lines changed Expand file tree Collapse file tree 1 file changed +60
-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
+ # run at least once every 2 months to prevent the coverage artifact from expiring
12
+ schedule :
13
+ - cron : ' 14 3 2 */2 *'
14
+ workflow_dispatch :
15
+
16
+ concurrency :
17
+ group : ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
18
+ cancel-in-progress : true
19
+
20
+ defaults :
21
+ run :
22
+ shell : bash
23
+
24
+ jobs :
25
+ go-coverage :
26
+ name : Go coverage
27
+ runs-on : ubuntu-24.04
28
+ permissions :
29
+ pull-requests : write
30
+
31
+ steps :
32
+ - name : Harden runner
33
+ uses : step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
34
+ with :
35
+ egress-policy : audit
36
+
37
+ - name : Checkout
38
+ uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
39
+ with :
40
+ path : ${{ github.workspace }}/src/github.com/tektoncd/pipeline
41
+
42
+ - name : Generate coverage
43
+ working-directory : ${{ github.workspace }}/src/github.com/tektoncd/pipeline
44
+ run : |
45
+ go test -cover -coverprofile=coverage.txt ./... || true
46
+ echo "Generated coverage profile"
47
+
48
+ - name : Archive coverage results
49
+ uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
50
+ with :
51
+ name : code-coverage
52
+ path : ${{ github.workspace }}/src/github.com/tektoncd/pipeline/coverage.txt
53
+
54
+ - name : Comment on PR
55
+ if : github.event_name == 'pull_request'
56
+ uses : fgrosse/go-coverage-report@8c1d1a09864211d258937b1b1a5b849f7e4f2682 # v1.2.0
57
+ continue-on-error : true # This may fail if artifact on main branch does not exist (first run or expired)
58
+ with :
59
+ coverage-artifact-name : " code-coverage"
60
+ coverage-file-name : " coverage.txt"
You can’t perform that action at this time.
0 commit comments