From 461e3dfdaf2e4d47584680790b9ca5f07d53eaea Mon Sep 17 00:00:00 2001 From: Miguel Angel Ajo Pelayo Date: Wed, 26 Jun 2024 13:14:28 +0200 Subject: [PATCH] Add makefile and github action scripts --- .github/workflows/generate.yaml | 24 ++++++++++++++++++++++++ .github/workflows/lint.yaml | 20 ++++++++++++++++++++ Makefile | 29 +++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+) create mode 100644 .github/workflows/generate.yaml create mode 100644 .github/workflows/lint.yaml create mode 100644 Makefile diff --git a/.github/workflows/generate.yaml b/.github/workflows/generate.yaml new file mode 100644 index 0000000..1666693 --- /dev/null +++ b/.github/workflows/generate.yaml @@ -0,0 +1,24 @@ +name: "Generate stubs" +on: + workflow_dispatch: + push: + branches: + - main + pull_request: + +permissions: + contents: read + pull-requests: read +jobs: + generate: + runs-on: "ubuntu-latest" + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + - name: Running generate + run: make generate + + - name: Verify that stubs are up-to-date + run: git diff --exit-code + diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000..2492dde --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,20 @@ +name: "Code Quality" +on: + workflow_dispatch: + push: + branches: + - main + pull_request: + +permissions: + contents: read + pull-requests: read +jobs: + lint: + runs-on: "ubuntu-latest" + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + - name: Running Linter + run: make lint diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c2ca7af --- /dev/null +++ b/Makefile @@ -0,0 +1,29 @@ +BUF_IMAGE=docker.io/bufbuild/buf:latest +BUF=podman run --volume "$(shell pwd):/workspace" --workdir /workspace docker.io/bufbuild/buf:latest + +GENERATED_GO=go/jumpstarter/v1/jumpstarter.pb.go go/jumpstarter/v1/jumpstarter_grpc.pb.go \ + go/jumpstarter/v1/router.pb.go go/jumpstarter/v1/router_grpc.pb.go +GENERATED_PYTHON=python/jumpstarter/v1/jumpstarter_pb2.py python/jumpstarter/v1/jumpstarter_pb2_grpc.py \ + python/jumpstarter/v1/router_pb2.py python/jumpstarter/v1/router_pb2_grpc.py + +all: $(GENERATED_GO) $(GENERATED_PYTHON) + +lint: + $(BUF) lint + +go/jumpstarter/v1/jumpstarter.pb.go: proto/jumpstarter/v1/jumpstarter.proto + $(BUF) generate + +go/jumpstarter/v1/jumpstarter_grpc.pb.go: proto/jumpstarter/v1/jumpstarter.proto + $(BUF) generate + + +go/jumpstarter/v1/router.pb.go: proto/jumpstarter/v1/router.proto + $(BUF) generate + +go/jumpstarter/v1/router_grpc.pb.go: proto/jumpstarter/v1/router.proto + $(BUF) generate + + + +.PHONY: lint generate \ No newline at end of file