Skip to content

Commit 4a46214

Browse files
committed
Refactor CI workflow
Signed-off-by: zeroalphat <taichi-takemura@cybozu.co.jp>
1 parent a448200 commit 4a46214

File tree

3 files changed

+30
-4
lines changed

3 files changed

+30
-4
lines changed

.github/workflows/ci.yaml

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,36 @@ on:
44
push:
55
branches:
66
- 'main'
7-
env:
8-
go-version: "1.23"
97
jobs:
8+
build:
9+
name: Build binaries
10+
runs-on: ubuntu-24.04
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-go@v5
14+
with:
15+
go-version-file: "go.mod"
16+
- run: make lint
17+
- run: make build
1018
test:
1119
name: Small tests
1220
runs-on: ubuntu-24.04
1321
steps:
1422
- uses: actions/checkout@v4
1523
- uses: actions/setup-go@v5
1624
with:
17-
go-version: ${{ env.go-version }}
25+
go-version-file: "go.mod"
26+
- run: make test
27+
- run: make check-generate
28+
e2e:
29+
name: End-to-end tests
30+
runs-on: ubuntu-24.04
31+
steps:
32+
- uses: actions/checkout@v4
33+
- uses: actions/setup-go@v5
34+
with:
35+
go-version-file: "go.mod"
36+
- run: make start
37+
working-directory: test/e2e
1838
- run: make test
39+
working-directory: test/e2e

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and Cust
2727
.PHONY: generate
2828
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
2929
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
30+
31+
.PHONY: check-generate
32+
check-generate:
33+
$(MAKE) manifests generate k8s-client-gen
34+
git diff --exit-code --name-only
3035

3136
# refer to https://github.com/statnett/image-scanner-operator/pull/668/files
3237
GO_MODULE = $(shell go list -m)

test/e2e/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ setup:
3232
GOBIN=$(BIN_DIR) go install sigs.k8s.io/kind@v$(KIND_VERSION)
3333

3434
.PHONY: start
35-
start:
35+
start: setup
3636
$(MAKE) -C ../../ docker-build
3737
$(KIND) create cluster --name=$(KIND_CLUSTER_NAME) --config=$(KIND_CONFIG) --image=kindest/node:v$(E2ETEST_K8S_VERSION) --wait 1m
3838
$(MAKE) kind-load

0 commit comments

Comments
 (0)