-
Notifications
You must be signed in to change notification settings - Fork 1
100 lines (82 loc) · 2.38 KB
/
Copy path_go.yaml
File metadata and controls
100 lines (82 loc) · 2.38 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
95
96
97
98
99
100
name: Go
on:
workflow_call:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up Go
uses: actions/setup-go@v7
with:
go-version-file: go.mod
- name: Check go mod tidy
run: |
go mod tidy
git diff --exit-code go.mod go.sum
- name: golangci-lint
uses: golangci/golangci-lint-action@v9
with:
# renovate: datasource=github-releases depName=golangci/golangci-lint
version: "v2.13.2"
vulncheck:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up Go
uses: actions/setup-go@v7
with:
go-version-file: go.mod
- name: govulncheck
run: go tool govulncheck ./...
manifests:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up Go
uses: actions/setup-go@v7
with:
go-version-file: go.mod
- name: Check CRD drift
run: |
make manifests
if ! git diff --exit-code; then
echo "::error::CRDs or Helm chart CRDs are out of date. Run 'make manifests' and commit the result."
exit 1
fi
- name: Check deepcopy drift
run: |
make generate
if ! git diff --exit-code; then
echo "::error::DeepCopy methods are out of date. Run 'make generate' and commit the result."
exit 1
fi
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up Go
uses: actions/setup-go@v7
with:
go-version-file: go.mod
- name: Download envtest assets
run: go tool setup-envtest use "${ENVTEST_K8S_VERSION}" -p path
env:
ENVTEST_K8S_VERSION: "1.37.0"
- name: Run tests
run: |
KUBEBUILDER_ASSETS="$(go tool setup-envtest use "${ENVTEST_K8S_VERSION}" -p path)" \
go test ./... -race -covermode=atomic -coverprofile cover.out
env:
ENVTEST_K8S_VERSION: "1.37.0"
- name: Check coverage threshold
run: ./hack/check-coverage.sh cover.out 55
- name: Upload coverage
uses: actions/upload-artifact@v7
with:
name: coverage
path: cover.out