-
Notifications
You must be signed in to change notification settings - Fork 39
91 lines (80 loc) · 3.5 KB
/
workflow.yaml
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
name: test
on:
push:
paths-ignore:
- "**.md"
pull_request:
paths-ignore:
- "**.md"
permissions:
contents: read
jobs:
lint:
permissions:
contents: read # for actions/checkout to fetch code
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
name: "Lint"
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Harden Runner
uses: step-security/harden-runner@cba0d00b1fc9a034e1e642ea0f1103c282990604 # v2.5.0
with:
egress-policy: audit
- name: Set up Go 1.20
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v3.5.0
with:
go-version: "1.20"
- name: Check out code into the Go module directory
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- name: Lint
uses: golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5 # v3.4.0
with:
version: v1.51.0
args: --timeout 5m
test:
name: "Unit test"
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Harden Runner
uses: step-security/harden-runner@cba0d00b1fc9a034e1e642ea0f1103c282990604 # v2.5.0
with:
egress-policy: audit
- name: Set up Go 1.20
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
go-version: "1.20"
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- name: Install kubebuilder
run: |
curl -L -O "https://github.com/kubernetes-sigs/kubebuilder/releases/download/v${KUBEBUILDER_VERSION}/kubebuilder_$(go env GOOS)_$(go env GOARCH)" && \
curl -L -O "https://dl.k8s.io/v${KUBERNETES_VERSION}/kubernetes-server-$(go env GOOS)-$(go env GOARCH).tar.gz" && \
curl -L -O "https://dl.k8s.io/v${KUBERNETES_VERSION}/kubernetes-client-$(go env GOOS)-$(go env GOARCH).tar.gz" && \
curl -L -O "https://github.com/etcd-io/etcd/releases/download/v${ETCD_VERSION}/etcd-v${ETCD_VERSION}-$(go env GOOS)-$(go env GOARCH).tar.gz" && \
tar -zxvf kubernetes-server-$(go env GOOS)-$(go env GOARCH).tar.gz && \
tar -zxvf kubernetes-client-$(go env GOOS)-$(go env GOARCH).tar.gz && \
tar -zxvf etcd-v${ETCD_VERSION}-$(go env GOOS)-$(go env GOARCH).tar.gz && \
chmod +x kubebuilder_$(go env GOOS)_$(go env GOARCH) && \
chmod +x kubernetes/server/bin/kube-apiserver && \
chmod +x kubernetes/client/bin/kubectl && \
chmod +x etcd-v${ETCD_VERSION}-$(go env GOOS)-$(go env GOARCH)/etcd && \
sudo mkdir -p /usr/local/kubebuilder/bin && \
sudo mv kubebuilder_$(go env GOOS)_$(go env GOARCH) /usr/local/kubebuilder/bin/kubebuilder && \
sudo mv kubernetes/server/bin/kube-apiserver /usr/local/kubebuilder/bin/kube-apiserver && \
sudo mv kubernetes/server/bin/kubectl /usr/local/kubebuilder/bin/kubectl && \
sudo mv etcd-v${ETCD_VERSION}-$(go env GOOS)-$(go env GOARCH)/etcd /usr/local/kubebuilder/bin/etcd
env:
KUBEBUILDER_VERSION: 3.9.0
KUBERNETES_VERSION: 1.26.1
ETCD_VERSION: 3.5.7
- name: Unit test
run: make test
- name: Codecov Upload
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
with:
flags: unittests
file: ./cover.out
fail_ci_if_error: false