Skip to content

Commit 980db82

Browse files
author
Ben Walker
committed
storage: Simplify makefile to remove docker
Also, all output goes into gen/ instead of v1/gen. Signed-off-by: Ben Walker <[email protected]>
1 parent 283e60e commit 980db82

14 files changed

+48
-38
lines changed

.github/workflows/storage.yml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,19 @@ 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
4749
run: git diff --exit-code
4850
working-directory: storage
49-
50-
- name: Upload build artifact
51-
uses: actions/upload-artifact@v3
52-
with:
53-
path: storage/v1/gen/go/*.pb.go
54-
retention-days: 1

storage/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
gen/

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 gen/$(CURRENT_VERSION)/$(1)
12+
protoc --proto_path=../common/$(CURRENT_VERSION) --proto_path=$(CURRENT_VERSION) \
13+
--$(1)_out=gen/$(CURRENT_VERSION)/$(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

storage/v1/backend_aio.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
syntax = "proto3";
55
package opi_api.storage.v1;
6-
option go_package = "github.com/opiproject/opi-api/storage/v1/gen/go";
6+
option go_package = "github.com/opiproject/opi-api/storage/gen/v1/go";
77

88
import "google/protobuf/empty.proto";
99
import "object_key.proto";

storage/v1/backend_iscsi.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
syntax = "proto3";
55
package opi_api.storage.v1;
6-
option go_package = "github.com/opiproject/opi-api/storage/v1/gen/go";
6+
option go_package = "github.com/opiproject/opi-api/storage/gen/v1/go";
77

88
// Back End (network-facing) APIs.
99

storage/v1/backend_null.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
syntax = "proto3";
55
package opi_api.storage.v1;
6-
option go_package = "github.com/opiproject/opi-api/storage/v1/gen/go";
6+
option go_package = "github.com/opiproject/opi-api/storage/gen/v1/go";
77
import "uuid.proto";
88

99
// Back End (network-facing) APIs.

storage/v1/backend_nvme_pcie.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
syntax = "proto3";
55
package opi_api.storage.v1;
6-
option go_package = "github.com/opiproject/opi-api/storage/v1/gen/go";
6+
option go_package = "github.com/opiproject/opi-api/storage/gen/v1/go";
77

88
// Back End (network-facing) APIs.
99

storage/v1/backend_nvme_tcp.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
syntax = "proto3";
55
package opi_api.storage.v1;
6-
option go_package = "github.com/opiproject/opi-api/storage/v1/gen/go";
6+
option go_package = "github.com/opiproject/opi-api/storage/gen/v1/go";
77

88
// Back End (network-facing) APIs.
99

storage/v1/common.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
syntax = "proto3";
66
package opi_api.storage.v1;
7-
option go_package = "github.com/opiproject/opi-api/storage/v1/gen/go";
7+
option go_package = "github.com/opiproject/opi-api/storage/gen/v1/go";
88

99
// The controller PCI-ID is used to address a given virtual controller. Virtual
1010
// controllers are organized into devices with Physical functions and SRIOV

storage/v1/frontend_nvme_pcie.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
syntax = "proto3";
55
package opi_api.storage.v1;
6-
option go_package = "github.com/opiproject/opi-api/storage/v1/gen/go";
6+
option go_package = "github.com/opiproject/opi-api/storage/gen/v1/go";
77
import "common.proto";
88
import "uuid.proto";
99

storage/v1/frontend_virtio_blk.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
syntax = "proto3";
55
package opi_api.storage.v1;
6-
option go_package = "github.com/opiproject/opi-api/storage/v1/gen/go";
6+
option go_package = "github.com/opiproject/opi-api/storage/gen/v1/go";
77
import "common.proto";
88

99
// Front End (host-facing) APIs.

storage/v1/frontend_virtio_fs.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
syntax = "proto3";
55
package opi_api.storage.v1;
6-
option go_package = "github.com/opiproject/opi-api/storage/v1/gen/go";
6+
option go_package = "github.com/opiproject/opi-api/storage/gen/v1/go";
77

88
// Front End (host-facing) APIs.
99

storage/v1/frontend_virtio_scsi.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
syntax = "proto3";
55
package opi_api.storage.v1;
6-
option go_package = "github.com/opiproject/opi-api/storage/v1/gen/go";
6+
option go_package = "github.com/opiproject/opi-api/storage/gen/v1/go";
77
import "common.proto";
88

99
// Front End (host-facing) APIs.

storage/v1/middleend.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
syntax = "proto3";
55
package opi_api.storage.v1;
6-
option go_package = "github.com/opiproject/opi-api/storage/v1/gen/go";
6+
option go_package = "github.com/opiproject/opi-api/storage/gen/v1/go";
77

88
// Middle End (Storage Services) APIs.
99

0 commit comments

Comments
 (0)