Skip to content

Commit ce3a839

Browse files
authored
chore: Fix codecov upload (#3440)
1 parent d13c739 commit ce3a839

File tree

1 file changed

+37
-32
lines changed

1 file changed

+37
-32
lines changed

.github/workflows/tests.yml

+37-32
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ concurrency:
55
on:
66
push:
77
branches:
8-
- master
8+
- master
99
pull_request:
1010
branches:
11-
- master
11+
- master
1212

1313
name: tests
1414
env:
@@ -19,6 +19,9 @@ permissions:
1919

2020
jobs:
2121
test:
22+
permissions:
23+
contents: read
24+
id-token: write
2225
defaults:
2326
run:
2427
shell: bash
@@ -39,38 +42,40 @@ jobs:
3942
runs-on: ${{ matrix.platform }}
4043

4144
steps:
42-
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
43-
with:
44-
go-version: ${{ matrix.go-version }}
45-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
45+
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
46+
with:
47+
go-version: ${{ matrix.go-version }}
48+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4649

47-
# Get values for cache paths to be used in later steps
48-
- id: cache-paths
49-
run: |
50-
echo "go-cache=$(go env GOCACHE)" >> $GITHUB_OUTPUT
51-
echo "go-mod-cache=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT
50+
# Get values for cache paths to be used in later steps
51+
- id: cache-paths
52+
run: |
53+
echo "go-cache=$(go env GOCACHE)" >> $GITHUB_OUTPUT
54+
echo "go-mod-cache=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT
5255
53-
- name: Cache go modules
54-
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
55-
with:
56-
path: |
57-
${{ steps.cache-paths.outputs.go-cache }}
58-
${{ steps.cache-paths.outputs.go-mod-cache }}
59-
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
60-
restore-keys: ${{ runner.os }}-go-
56+
- name: Cache go modules
57+
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
58+
with:
59+
path: |
60+
${{ steps.cache-paths.outputs.go-cache }}
61+
${{ steps.cache-paths.outputs.go-mod-cache }}
62+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
63+
restore-keys: ${{ runner.os }}-go-
6164

62-
- name: Run go test
63-
run: |
64-
if [ -n "${{ matrix.update-coverage }}" ]; then
65-
script/test.sh -race -covermode atomic -coverprofile coverage.txt ./...
66-
exit
67-
fi
68-
script/test.sh -race -covermode atomic ./...
65+
- name: Run go test
66+
run: |
67+
if [ -n "${{ matrix.update-coverage }}" ]; then
68+
script/test.sh -race -covermode atomic -coverprofile coverage.txt ./...
69+
exit
70+
fi
71+
script/test.sh -race -covermode atomic ./...
6972
70-
- name: Ensure integration tests build
71-
# don't actually run tests since they hit live GitHub API
72-
run: go test -v -tags=integration -run=^$ ./test/integration
73+
- name: Ensure integration tests build
74+
# don't actually run tests since they hit live GitHub API
75+
run: go test -v -tags=integration -run=^$ ./test/integration
7376

74-
- name: Upload coverage to Codecov
75-
if: ${{ matrix.update-coverage }}
76-
uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # v5.1.2
77+
- name: Upload coverage to Codecov
78+
if: ${{ matrix.update-coverage }}
79+
uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # v5.1.2
80+
with:
81+
use_oidc: true

0 commit comments

Comments
 (0)