-
Notifications
You must be signed in to change notification settings - Fork 0
executable file
·66 lines (53 loc) · 1.59 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: Test/Lint/Fmt/Vet
on:
push:
branches:
- main
pull_request:
jobs:
test:
runs-on: ubuntu-latest
container: golang:1
steps:
- name: Mark workspace safe
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- uses: actions/checkout@v4
- name: Build
run: go build -o /dev/null ./...
- name: Test
run: go test ./... -coverprofile=coverage.txt -covermode=atomic
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: Starttoaster/go-proxmox
files: ./coverage.txt
- name: Check gofmt changes
run: |
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
echo "Check local formatting with gofmt, the following files have formatting deviations:"
gofmt -s -l .
exit 1
fi
- name: Vet
run: go vet ./...
- name: Verify Go modules
run: |
go mod download
go mod verify
- name: Run govulncheck
run: |
go install golang.org/x/vuln/cmd/govulncheck@latest
govulncheck -test ./...
- name: Run errcheck
run: |
go install github.com/kisielk/errcheck@latest
errcheck ./...
- name: Run staticcheck
run: |
go install honnef.co/go/tools/cmd/staticcheck@latest
staticcheck ./...
- name: Run golint
run: |
go install golang.org/x/lint/golint@latest
golint -set_exit_status ./...