From 051caf6a4db34d9247df8bded7f5adb1e5c609cc Mon Sep 17 00:00:00 2001 From: Daniel Kraic Date: Thu, 8 Aug 2024 14:09:15 +0200 Subject: [PATCH] Feature/add GitHub workflows (#5) * Add .github/workflows * Rename Github workflows * Fix workflow names * Split ci workflow to build and test workflows * Add Github workflow status badges to README.md --- .github/workflows/build.yaml | 17 +++++++++++++++++ .github/workflows/lint.yaml | 19 +++++++++++++++++++ .github/workflows/test.yaml | 17 +++++++++++++++++ .github/workflows/vulncheck.yaml | 20 ++++++++++++++++++++ Makefile | 2 +- README.md | 6 ++++++ 6 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build.yaml create mode 100644 .github/workflows/lint.yaml create mode 100644 .github/workflows/test.yaml create mode 100644 .github/workflows/vulncheck.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..ab6e7f9 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,17 @@ +name: Build + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: "1.22" + + - name: Build + run: make build-only diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000..810b145 --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,19 @@ +name: Lint + +on: [push] + +jobs: + golangci: + name: golangci + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-go@v5 + with: + go-version: "1.22" + + - name: golangci-lint + uses: golangci/golangci-lint-action@v6 + with: + version: v1.59 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..26e796e --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,17 @@ +name: Test + +on: [push] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: "1.22" + + - name: Test + run: make test-only race diff --git a/.github/workflows/vulncheck.yaml b/.github/workflows/vulncheck.yaml new file mode 100644 index 0000000..5be908f --- /dev/null +++ b/.github/workflows/vulncheck.yaml @@ -0,0 +1,20 @@ +name: Vulncheck + +on: [push] + +jobs: + vulncheck: + name: vulncheck + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-go@v5 + with: + go-version: "1.22" + + - id: govulncheck + uses: golang/govulncheck-action@v1 + with: + go-version-input: "1.22" + go-package: ./... diff --git a/Makefile b/Makefile index ec02b45..38a3f98 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ lint: vulncheck: govulncheck ./... -build-only: build-service +build-only: build-service build-example-grpc-server build-service: CGO_ENABLED=0 GOOS=linux go build $(LDFLAGS) -o $(APP_NAME) ./cmd/service/ diff --git a/README.md b/README.md index 41e47c1..8e64285 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,10 @@ # GRPC REST Proxy + +[![Build](https://github.com/eset/grpc-rest-proxy/actions/workflows/build.yaml/badge.svg)](https://github.com/eset/grpc-rest-proxy/actions/workflows/build.yaml) +[![Test](https://github.com/eset/grpc-rest-proxy/actions/workflows/test.yaml/badge.svg)](https://github.com/eset/grpc-rest-proxy/actions/workflows/test.yaml) +[![Lint](https://github.com/eset/grpc-rest-proxy/actions/workflows/lint.yaml/badge.svg)](https://github.com/eset/grpc-rest-proxy/actions/workflows/lint.yaml) +[![Vulncheck](https://github.com/eset/grpc-rest-proxy/actions/workflows/vulncheck.yaml/badge.svg)](https://github.com/eset/grpc-rest-proxy/actions/workflows/vulncheck.yaml) + Copyright © ESET 2024-2028 Service that is automatically translating REST requests to gRPC and sending them to provided endpoint. REST is defined using [Google's proto HTTP annotation](https://github.com/googleapis/googleapis/blob/master/google/api/http.proto). Our implementation is able to load proto descriptors directly from grpc endpoint using server reflection service. Main advantage of this approach is elimination of the need to recompile protobufs or grpc-rest-proxy (to incorporate changes in protos), making translation and maintenance easier.