mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-03-30 15:08:28 +00:00

* [staticcheck] Fix comments on exported functions and structs * [ci] Improve staticcheck setup - Add global staticcheck.conf file - Ignore: at least one file in a package should have a package comment (ST1000) - Ignore deprecation warnings. They are reported by golangci-lint and there we have a proper way to exclude generated files. Signed-off-by: Julian Strobl <jmastr@mailbox.org>
61 lines
1.5 KiB
YAML
61 lines
1.5 KiB
YAML
---
|
|
name: Audit
|
|
|
|
on: [push]
|
|
|
|
jobs:
|
|
audit:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
go-version: [ '1.20', '1.21' ]
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v4
|
|
with:
|
|
go-version: ${{ matrix.go-version }}
|
|
|
|
- name: Verify dependencies
|
|
run: go mod verify
|
|
|
|
- name: Build
|
|
run: go build -v ./...
|
|
|
|
- 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
|
|
|
|
- name: Run gofmt
|
|
run: if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then exit 1; fi
|
|
|
|
- name: Run go vet
|
|
run: go vet ./...
|
|
|
|
- name: Install staticcheck
|
|
run: go install honnef.co/go/tools/cmd/staticcheck@latest
|
|
|
|
- name: Run staticcheck
|
|
run: |
|
|
staticcheck ./...
|
|
|
|
- name: Install golangci-lint
|
|
run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
|
|
|
|
- name: Run golangci-lint
|
|
run: (golangci-lint run && cd lib && golangci-lint run)
|
|
|
|
- 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
|