Skip to content

Commit 8df13e2

Browse files
author
Ben Walker
committed
storage: Simplify makefile to remove docker
Signed-off-by: Ben Walker <[email protected]>
1 parent 8703af0 commit 8df13e2

File tree

2 files changed

+36
-21
lines changed

2 files changed

+36
-21
lines changed

.github/workflows/storage.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,17 @@ jobs:
3232
- name: Checkout repository
3333
uses: actions/checkout@v3
3434

35-
- name: Set up QEMU
36-
uses: docker/setup-qemu-action@v2
35+
- name: Setup Go
36+
uses: actions/setup-go@v2
3737

38-
# Workaround: https://github.com/docker/build-push-action/issues/461
39-
- name: Setup Docker buildx
40-
uses: docker/setup-buildx-action@8c0edbc76e98fa90f69d9a2c020dcb50019dc325
38+
- name: Install Protoc
39+
uses: arduino/setup-protoc@v1
40+
41+
- name: Install protoc-gen-go
42+
run: go install google.golang.org/protobuf/cmd/[email protected]
4143

4244
- name: Build protobufs
43-
run: make
45+
run: make python go cpp
4446
working-directory: storage
4547

4648
- name: Check uncomitted auto generated protobufs

storage/Makefile

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,35 @@
22
# Copyright (C) 2022 Intel Corporation
33
# Copyright (c) 2022 Dell Inc, or its subsidiaries.
44

5-
all:
6-
rm -rf ./v1/{autogen.md,gen}
7-
mkdir -p ./v1/gen/{go,cpp,python}
5+
# Make a variable named ','. Used to pass arguments with commas to protoc_compile.
6+
, := ,
87

9-
docker run --user=$$(id -u):$$(id -g) --rm -v "${PWD}":/defs -v "${PWD}/../common/v1":/common namely/protoc-all:1.47_2 -i /common --lint -d v1 -l go -o ./v1/gen/go/ --go-source-relative
10-
docker run --user=$$(id -u):$$(id -g) --rm -v "${PWD}":/defs -v "${PWD}/../common/v1":/common namely/protoc-all:1.47_2 -i /common --lint -d v1 -l cpp -o ./v1/gen/cpp/ --go-source-relative
11-
docker run --user=$$(id -u):$$(id -g) --rm -v "${PWD}":/defs -v "${PWD}/../common/v1":/common namely/protoc-all:1.47_2 -i /common --lint -d v1 -l python -o ./v1/gen/python/ --go-source-relative
8+
CURRENT_VERSION := v1
129

13-
# protoc-gen-doc doesn't support proto include paths parameter so we have to copy
14-
# common included files to the proto directory
15-
cp ../common/v1/uuid.proto "${PWD}"/v1
16-
cp ../common/v1/object_key.proto "${PWD}"/v1
10+
define protoc_compile
11+
mkdir -p $(CURRENT_VERSION)/gen/$(1)
12+
protoc --proto_path=../common/$(CURRENT_VERSION) --proto_path=$(CURRENT_VERSION) \
13+
--$(1)_out=$(CURRENT_VERSION)/gen/$(1) \
14+
$(2) \
15+
$(CURRENT_VERSION)/*.proto
16+
endef
1717

18-
docker run --user=$$(id -u):$$(id -g) --rm -v "${PWD}"/v1/:/out -v "${PWD}"/v1:/protos pseudomuto/protoc-gen-doc --doc_opt=markdown,autogen.md
19-
docker run --user=$$(id -u):$$(id -g) --rm -v "${PWD}"/v1/:/out -w /out --entrypoint=sh ghcr.io/docker-multiarch/google-api-linter:1.36.0 -c "api-linter /out/*.proto --output-format summary"
18+
all: python cpp go doc lint
2019

21-
# remove common included files from the proto directory
22-
rm "${PWD}"/v1/uuid.proto
23-
rm "${PWD}"/v1/object_key.proto
20+
python:
21+
$(call protoc_compile,python,)
22+
23+
cpp:
24+
$(call protoc_compile,cpp,)
25+
26+
go:
27+
$(call protoc_compile,go,)
28+
29+
doc:
30+
$(call protoc_compile,doc,--doc_opt=markdown$(,)autogen.md)
31+
32+
lint:
33+
$(call protoc_compile,lint)
34+
35+
clean:
36+
rm -rf gen

0 commit comments

Comments
 (0)