Skip to content

Commit 47efd65

Browse files
committed
Add proto machinery and CI test
Signed-off-by: Adolfo García Veytia (Puerco) <puerco@carabiner.dev>
1 parent 2063bb3 commit 47efd65

3 files changed

Lines changed: 37 additions & 0 deletions

File tree

.github/workflows/go-test.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,21 @@ jobs:
2020
go-version: "1.24"
2121
check-latest: true
2222

23+
- name: Setup Buf
24+
uses: bufbuild/buf-setup-action@a47c93e0b1648d5651a065437926377d060baa99 # v1.50.0
25+
26+
- name: Setup protoc
27+
uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # @v3.0.0
28+
2329
- name: Run Go tests
2430
run: |
2531
go test ./sourcetool/...
2632
2733
- name: Check generated fakes
2834
run: |
2935
hack/verify-fakes.sh
36+
37+
- name: Check protobuf generated codew
38+
run: |
39+
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
40+
hack/verify-protos.sh

Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1+
BOLD := \033[1m
2+
CYAN := \033[36m
3+
GREEN := \033[32m
4+
WHITE := \033[37m
5+
RESET := \033[0m
6+
7+
.PHONY: help
8+
help:
9+
@printf "${BOLD}${WHITE}SLSA Source Tooling Makefile Help\n=================================${RESET}\n"
10+
@grep -Eh '^[a-zA-Z_-]+:.*?## .*$$' ${MAKEFILE_LIST} | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "${BOLD}${CYAN}%-25s${RESET}%s\n", $$1, $$2}'
11+
112
.PHONY: fakes
213
fakes: ## Rebuild the implementation fakes
314
go generate ./sourcetool/...
415

16+
.PHONY: proto
17+
proto: ## Rebuild the policies and provenance predicate from protocol buffer definitions
18+
buf generate

hack/verify-protos.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
3+
set -o errexit
4+
set -o nounset
5+
set -o pipefail
6+
7+
set -o xtrace
8+
9+
source hack/common.sh
10+
11+
make proto
12+
git diff --exit-code || exit_with_msg "Code from protocol definitions is not up to date. Please run 'make proto' and commit the result"

0 commit comments

Comments
 (0)