-
Notifications
You must be signed in to change notification settings - Fork 3
43 lines (43 loc) · 1.34 KB
/
test.yml
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
on:
pull_request:
push:
branches:
- main
name: Test
jobs:
test:
strategy:
fail-fast: false
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Check mod tidy
run: make mod-tidy-check
- name: Test
run: make test-ci
- name: Determine skip-codecov
uses: actions/github-script@v7
id: skip-codecov
with:
script: |
// Sets `ref` to the SHA of the current pull request's head commit,
// or, if not present, to the SHA of the commit that triggered the
// event.
const ref = '${{ github.event.pull_request.head.sha || github.event.after }}';
const { repo, owner } = context.repo;
const { data: commit } = await github.rest.repos.getCommit({ owner, repo, ref });
const commitMessage = commit.commit.message;
const skip = commitMessage.includes("[skip codecov]") || commitMessage.includes("[skip-codecov]");
core.setOutput("skip", skip);
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
if: ${{ steps.skip-codecov.outputs.skip != 'true' }}
with:
file: covreport
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}