-
Notifications
You must be signed in to change notification settings - Fork 427
65 lines (54 loc) · 1.96 KB
/
go-coverage.yml
File metadata and controls
65 lines (54 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: Go coverage
permissions:
contents: read
on:
pull_request:
branches: ["main"]
push:
branches: ["main"]
# run at least once every 2 months to prevent the coverage artifact from expiring
schedule:
- cron: '14 3 3 */2 *'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
go-coverage:
name: Go coverage
runs-on: ubuntu-24.04
permissions:
pull-requests: write
steps:
- name: Harden runner
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
path: ${{ github.workspace }}/src/github.com/tektoncd/triggers
- name: Set up Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: "${{ github.workspace }}/src/github.com/tektoncd/triggers/go.mod"
- name: Generate coverage
working-directory: ${{ github.workspace }}/src/github.com/tektoncd/triggers
run: |
go test -cover -coverprofile=coverage.txt ./... || true
echo "Generated coverage profile"
- name: Archive coverage results
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: code-coverage
path: ${{ github.workspace }}/src/github.com/tektoncd/triggers/coverage.txt
- name: Comment on PR
if: github.event_name == 'pull_request'
uses: fgrosse/go-coverage-report@cbeb2ab2e32591d690337146ba02a911cc566f3f # v1.3.0
continue-on-error: true # This may fail if artifact on main branch does not exist (first run or expired)
with:
coverage-artifact-name: "code-coverage"
coverage-file-name: "coverage.txt"