-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (77 loc) · 2.04 KB
/
Copy pathtest.yml
File metadata and controls
94 lines (77 loc) · 2.04 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: Test
on:
push:
branches:
- '**'
pull_request:
workflow_call:
permissions:
contents: read
concurrency:
group: test-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache: true
- name: Verify modules
run: go mod verify
- name: Vet
run: go vet ./...
- name: Test with race detector and coverage
run: go test -race -covermode=atomic -coverprofile=coverage.out ./...
- name: Enforce coverage threshold
shell: bash
run: |
coverage="$(go tool cover -func=coverage.out | awk '/^total:/ {gsub("%", "", $3); print $3}')"
echo "Total coverage: ${coverage}%"
awk -v coverage="${coverage}" 'BEGIN { if (coverage + 0 < 85) exit 1 }'
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache: true
- name: Go lint
uses: golangci/golangci-lint-action@v9
with:
version: v2.12.0
- name: Shell lint
run: shellcheck generate_certs.sh packaging/*.sh
vulnerability-scan:
runs-on: ubuntu-latest
steps:
- name: Govulncheck
uses: golang/govulncheck-action@v1
with:
go-version-file: go.mod
go-package: ./...
release-snapshot:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache: true
- name: Build release snapshot
uses: goreleaser/goreleaser-action@v7
with:
distribution: goreleaser
version: v2.17.1
args: release --snapshot --clean