-
Notifications
You must be signed in to change notification settings - Fork 277
54 lines (44 loc) · 1.44 KB
/
Copy pathgo-coverage.yml
File metadata and controls
54 lines (44 loc) · 1.44 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
name: Go coverage
permissions:
contents: read
on:
push:
branches: ["main"]
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-latest
permissions:
id-token: write # Required to upload coverage to Codecov via OIDC
steps:
- name: Harden runner
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: "go.mod"
- name: Generate coverage
run: |
go test -coverprofile=coverage.out -covermode=atomic $(go list ./... | grep -v 'github.com/tektoncd/cli/third_party/') || true
echo "Generated coverage profile"
- name: Upload coverage to Codecov
uses: codecov/codecov-action@0b35c9ecc4f0529d0eb674914510c22f85b196b4 # v7.1.0
continue-on-error: true # job still "succeeds" even if this step fails
with:
files: coverage.out
flags: unit-tests
use_oidc: true
fail_ci_if_error: false