Repository navigation
64 lines (60 loc) · 2.14 KB
/
Copy pathci.yml
File metadata and controls
64 lines (60 loc) · 2.14 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
# Checks every pull request, on the result of its merge into main, and every
# push to main: formatting, go vet and the unit tests, on the three platforms
# the release binaries are built for. Linux also runs the tests Windows skips
# (Unix access rights, tools/testclusters.sh).
#
# govulncheck runs as its own job: it can turn red because a vulnerability was
# published for the Go toolchain or a dependency, not because of the change
# under review.
#
# Not run here: the integration tests (-tags integration), which need the
# real clusters started by tools/testclusters.sh.
name: CI
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
jobs:
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
# Actions pinned to a commit: a tag can be moved to other code.
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# Installs the Go of go.mod's toolchain line, the one the release
# binaries are built with.
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
# On Linux only: Windows checks the files out with CRLF line endings,
# which gofmt would report in every file.
- name: gofmt
if: runner.os == 'Linux'
run: |
unformatted="$(gofmt -l .)"
if [ -n "$unformatted" ]; then
echo "Not formatted with gofmt:"
echo "$unformatted"
exit 1
fi
- run: go vet ./...
- run: go test ./...
govulncheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
# Pinned to the version run locally; go run checks it against the
# module checksum database.
- run: go run golang.org/x/vuln/cmd/govulncheck@v1.8.0 ./...