Julian Strobl ee4089f847
Remove planetmint-go from API endpoints (#287)
* feat: let the ci check if there are malformed api endpoints

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2024-01-16 10:39:32 +01:00

184 lines
4.0 KiB
YAML

---
name: Audit
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.21"
- name: Verify dependencies
run: go mod verify
- name: Build
run: go build -v ./...
proto:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check proto files
run: |
if [ "$(find . -name 'query.proto' -exec grep 'option (google.api.http).* = ./planetmint/planetmint-go/' {} \; | wc -l)" -gt 0 ]; then exit 1; fi
ignite:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check generated files
run: |
curl https://get.ignite.com/cli@v0.27.1 | bash
./ignite chain init --clear-cache --yes
rm ignite
if [ "$(git diff --stat | wc -l)" -gt 0 ]; then exit 1; fi
gofmt:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.21"
- name: Run gofmt
run: if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then exit 1; fi
govet:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.21"
- name: Run go vet
run: go vet ./...
staticcheck:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.21"
- name: Install staticcheck
run: go install honnef.co/go/tools/cmd/staticcheck@latest
- name: Run staticcheck
run: |
staticcheck ./...
golangci-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.21"
- name: Install golangci-lint
run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
- name: Run golangci-lint
run: |
golangci-lint run
golangci-lint-lib:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.21"
- name: Install golangci-lint
run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
- name: Run golangci-lint
run: |
pushd lib
golangci-lint run
gotest:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.21"
- name: Run tests
run: |
# Exclude generated .pb.go and .pb.gw.go files from test and coverage
go test -coverprofile cover.out -race -vet=off -v $(go list ./... | grep -v types)
# Print coverage by function
go tool cover -func=cover.out
gotest-lib:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.21"
- name: Run tests
run: |
pushd lib
go test -coverprofile cover.out -race -vet=off -v ./...
go tool cover -func=cover.out