mirror of
https://github.com/planetmint/planetmint-go.git
synced 2026-03-14 12:24:48 +00:00
63 lines
1.6 KiB
YAML
63 lines
1.6 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 | 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
|
|
env:
|
|
LINT: "//lint:file-ignore SA1019 Ignore all deprecation errors, it's generated"
|
|
run: |
|
|
# Add lint-ignore comment to beginning of files
|
|
sed -i "1i${LINT}" ./x/asset/types/query.pb.gw.go
|
|
sed -i "1i${LINT}" ./x/machine/types/query.pb.gw.go
|
|
sed -i "1i${LINT}" ./x/dao/types/query.pb.gw.go
|
|
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 --timeout 5m
|
|
|
|
- name: Run tests
|
|
run: go test -race -vet=off ./...
|