-
Notifications
You must be signed in to change notification settings - Fork 8
71 lines (62 loc) · 1.74 KB
/
pr-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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: test
on:
push:
branches:
- main
paths-ignore:
- "**/*.md"
- "LICENSE"
pull_request:
jobs:
test:
runs-on: ubuntu-20.04
strategy:
matrix:
go: ["1.21", "1.22"]
steps:
# Set fetch-depth: 0 to fetch commit history and tags for use in version calculation
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- name: Check go.mods
uses: evantorrie/mott-the-tidier@v1-beta
with:
gomods: |
**/go.mod
- name: download dependencies
run: |
make deps
- name: Lint files
uses: golangci/golangci-lint-action@v4
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.56.2
args: -v
skip-pkg-cache: true
only-new-issues: true
- name: Run tests
run: CGO_ENABLED=1 go test -coverprofile=coverage.txt -v ./...
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
name: go-agent test reports
fail_ci_if_error: true
files: ./coverage.txt
token: ${{ secrets.CODECOV_TOKEN }}
- name: check examples
run: make check-examples
security:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@master
- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/golang@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
args: --severity-threshold=low