File tree Expand file tree Collapse file tree 2 files changed +60
-7
lines changed Expand file tree Collapse file tree 2 files changed +60
-7
lines changed Original file line number Diff line number Diff line change 12
12
- name : Checkout
13
13
uses : actions/checkout@v2
14
14
15
+ - name : Ensure Go Version
16
+ uses : actions/setup-go@v2
17
+ with :
18
+ go-version : ' ^1.16'
19
+
20
+ - name : Lint
21
+ uses : golangci/golangci-lint-action@v2
22
+ with :
23
+ version : v1.32.2
24
+ args : --timeout=5m
25
+
26
+ - name : Get Kubebuilder Version
27
+ id : get-kubebuilder-version
28
+ run : echo "::set-output name=version::$(make kubebuilder-version-ci)"
29
+ shell : bash
30
+
31
+ - name : Ensure etcd
32
+ id : Ensure-etcd
33
+ uses : actions/cache@v2
34
+ with :
35
+ path : ~/go/bin/etcd
36
+ key : ${{ runner.os }}-kubebuilder-${{ steps.get-kubebuilder-version.outputs.version }}-etcd
37
+
38
+ - name : Ensure kube-apiserver
39
+ id : ensure-kube-apiserver
40
+ uses : actions/cache@v2
41
+ with :
42
+ path : ~/go/bin/kube-apiserver
43
+ key : ${{ runner.os }}-kubebuilder-${{ steps.get-kubebuilder-version.outputs.version }}-kube-apiserver
44
+
45
+ - name : Ensure Kubebuilder Metadata
46
+ id : ensure-kubebuilder-metadata
47
+ uses : actions/cache@v2
48
+ with :
49
+ path : ~/.kubebuilder/${{ steps.get-kubebuilder-version.outputs.version }}
50
+ key : ${{ runner.os }}-kubebuilder-${{ steps.get-kubebuilder-version.outputs.version }}
51
+
52
+ - name : Install Kubebuilder
53
+ run : make kubebuilder
54
+
55
+ - name : Run tests
56
+ run : make test
57
+
15
58
- name : Figure out if running fork PR
16
59
id : fork
17
60
run : ' ["${{ secrets.DOCKER_REGISTRY_TOKEN }}" == ""] && echo "::set-output name=is_fork_pr::true" || echo "::set-output name=is_fork_pr::false"'
24
67
password : ${{ secrets.DOCKER_REGISTRY_TOKEN }}
25
68
if : steps.fork.outputs.is_fork_pr == 'false'
26
69
27
- - name : Lint
28
- uses : golangci/golangci-lint-action@v2
29
- with :
30
- version : v1.32.2
31
- args : --timeout=5m
32
-
33
70
- name : Build Docker image
34
71
run : |
35
72
export DOCKER_TAG=pr-${GITHUB_HEAD_REF}
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ all: manager
28
28
29
29
# Run tests
30
30
test : generate fmt vet manifests
31
- go test ./... -coverprofile cover.out -v
31
+ KUBEBUILDER_ASSETS= ${GOBIN} go test ./... -coverprofile cover.out -v
32
32
33
33
# todo: Modify Dockerfile to include the version magic
34
34
# Build manager binary
@@ -183,3 +183,19 @@ install-configmap-sidecars:
183
183
# Todo: Add release version when the changes in main branch are released
184
184
crd-cwnp-for-testing :
185
185
curl https://raw.githubusercontent.com/metal-stack/firewall-controller/master/config/crd/bases/metal-stack.io_clusterwidenetworkpolicies.yaml -o external/test/crd-clusterwidenetworkpolicy.yaml
186
+
187
+ KUBEBUILDER_VERSION: =2.3.2
188
+ kubebuilder :
189
+ ifeq (,$(wildcard ~/.kubebuilder/${KUBEBUILDER_VERSION}) )
190
+ { \
191
+ os=$$(go env GOOS) ;\
192
+ arch=$$(go env GOARCH) ;\
193
+ curl -L https://go.kubebuilder.io/dl/${KUBEBUILDER_VERSION}/$${os}/$${arch} | tar -xz -C /tmp/ ;\
194
+ mv /tmp/kubebuilder_${KUBEBUILDER_VERSION}_$${os}_$${arch}/bin/* ${GOBIN} ;\
195
+ mkdir -p ~/.kubebuilder ;\
196
+ touch ~/.kubebuilder/${KUBEBUILDER_VERSION} ;\
197
+ }
198
+ endif
199
+
200
+ kubebuilder-version-ci :
201
+ @echo ${KUBEBUILDER_VERSION}
You can’t perform that action at this time.
0 commit comments