Skip to content

Commit 3df6c6a

Browse files
committed
[github workflows] control-operator it's own workflow
1 parent 6842438 commit 3df6c6a

3 files changed

Lines changed: 49 additions & 4 deletions

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: AliECS Control Operator
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- 'master'
8+
9+
jobs:
10+
control-operator-basic-check:
11+
name: Basic Make Check
12+
runs-on: ${{ matrix.os }}
13+
defaults:
14+
run:
15+
working-directory: control-operator
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
os: [macOS-latest, ubuntu-24.04]
20+
go: [ '1.26.5' ]
21+
steps:
22+
- uses: actions/checkout@v2
23+
- uses: actions/setup-go@v2
24+
with:
25+
go-version: ${{matrix.go}}
26+
- uses: arduino/setup-protoc@v3
27+
with:
28+
version: '35.1'
29+
repo-token: ${{ secrets.GITHUB_TOKEN }}
30+
- run: make
31+
- run: make test

.github/workflows/control.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,3 @@ jobs:
2323
- run: (make vendor)
2424
- run: (make)
2525
- run: (make test)
26-
- run: (cd control-operator && make)
27-
- run: (make test)

control-operator/Makefile

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ test: manifests generate fmt vet envtest ## Run tests.
127127
##@ Protobuf
128128

129129
.PHONY: generate-proto
130-
generate-proto: ## Generate protobuf and gRPC Go files from occ.proto.
130+
generate-proto: protoc-gen-go protoc-gen-go-grpc ## Generate protobuf and gRPC Go files from occ.proto.
131131
mkdir -p internal/controller/protos/generated
132-
protoc --go_out=internal/controller/protos/generated --go_opt=paths=source_relative --go-grpc_out=internal/controller/protos/generated --go-grpc_opt=paths=source_relative -I internal/controller/protos internal/controller/protos/occ.proto
132+
PATH="$(LOCALBIN):$$PATH" protoc --go_out=internal/controller/protos/generated --go_opt=paths=source_relative --go-grpc_out=internal/controller/protos/generated --go-grpc_opt=paths=source_relative -I internal/controller/protos internal/controller/protos/occ.proto
133133

134134
.PHONY: clean-proto
135135
clean-proto: ## Remove generated protobuf and gRPC Go files.
@@ -242,10 +242,14 @@ KUBECTL ?= kubectl
242242
KUSTOMIZE ?= $(LOCALBIN)/kustomize
243243
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
244244
ENVTEST ?= $(LOCALBIN)/setup-envtest
245+
PROTOC_GEN_GO ?= $(LOCALBIN)/protoc-gen-go
246+
PROTOC_GEN_GO_GRPC ?= $(LOCALBIN)/protoc-gen-go-grpc
245247

246248
## Tool Versions
247249
KUSTOMIZE_VERSION ?= v5.0.1
248250
CONTROLLER_TOOLS_VERSION ?= v0.16.5
251+
PROTOC_GEN_GO_VERSION ?= v1.36.11
252+
PROTOC_GEN_GO_GRPC_VERSION ?= v1.6.2
249253

250254
.PHONY: kustomize
251255
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary. If wrong version is installed, it will be removed before downloading.
@@ -267,6 +271,18 @@ envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
267271
$(ENVTEST): $(LOCALBIN)
268272
test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
269273

274+
.PHONY: protoc-gen-go
275+
protoc-gen-go: $(PROTOC_GEN_GO) ## Download protoc-gen-go locally if necessary. If wrong version is installed, it will be overwritten.
276+
$(PROTOC_GEN_GO): $(LOCALBIN)
277+
test -s $(LOCALBIN)/protoc-gen-go && $(LOCALBIN)/protoc-gen-go --version | grep -q $(PROTOC_GEN_GO_VERSION) || \
278+
GOBIN=$(LOCALBIN) go install google.golang.org/protobuf/cmd/protoc-gen-go@$(PROTOC_GEN_GO_VERSION)
279+
280+
.PHONY: protoc-gen-go-grpc
281+
protoc-gen-go-grpc: $(PROTOC_GEN_GO_GRPC) ## Download protoc-gen-go-grpc locally if necessary. If wrong version is installed, it will be overwritten.
282+
$(PROTOC_GEN_GO_GRPC): $(LOCALBIN)
283+
test -s $(LOCALBIN)/protoc-gen-go-grpc && $(LOCALBIN)/protoc-gen-go-grpc --version | grep -q $(subst v,,$(PROTOC_GEN_GO_GRPC_VERSION)) || \
284+
GOBIN=$(LOCALBIN) go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@$(PROTOC_GEN_GO_GRPC_VERSION)
285+
270286
.PHONY: operator-sdk
271287
OPERATOR_SDK ?= $(LOCALBIN)/operator-sdk
272288
operator-sdk: ## Download operator-sdk locally if necessary.

0 commit comments

Comments
 (0)