refactor(mqtt): dry #1365
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Audit | |
on: [push] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
directory: [".", "lib"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Checkout dependency | |
uses: actions/checkout@v4 | |
with: | |
repository: rddl-network/bc-slip39-go | |
path: bc-slip39-go | |
- name: Build dependency | |
run: | | |
pushd bc-slip39-go | |
./deps.sh | |
popd | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.22" | |
- name: Verify dependencies | |
run: go mod verify | |
- name: Build | |
run: | | |
pushd ${{ matrix.directory }} | |
go build -v ./... | |
proto: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
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@v4 | |
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 | |
strategy: | |
matrix: | |
directory: [".", "lib"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.22" | |
- name: Run gofmt | |
run: | | |
pushd ${{ matrix.directory }} | |
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then exit 1; fi | |
govet: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
directory: [".", "lib"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Checkout dependency | |
uses: actions/checkout@v4 | |
with: | |
repository: rddl-network/bc-slip39-go | |
path: bc-slip39-go | |
- name: Build dependency | |
run: | | |
pushd bc-slip39-go | |
./deps.sh | |
popd | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.22" | |
- name: Run go vet | |
run: | | |
pushd ${{ matrix.directory }} | |
go vet ./... | |
staticcheck: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
directory: [".", "lib"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Checkout dependency | |
uses: actions/checkout@v4 | |
with: | |
repository: rddl-network/bc-slip39-go | |
path: bc-slip39-go | |
- name: Build dependency | |
run: | | |
pushd bc-slip39-go | |
./deps.sh | |
popd | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.22" | |
- name: Install staticcheck | |
run: go install honnef.co/go/tools/cmd/staticcheck@latest | |
- name: Run staticcheck | |
run: | | |
pushd ${{ matrix.directory }} | |
staticcheck ./... | |
golangci-lint: | |
strategy: | |
matrix: | |
directory: [".", "lib"] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.22" | |
- name: Install golangci-lint | |
run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest | |
- name: Run golangci-lint | |
run: | | |
pushd ${{ matrix.directory }} | |
golangci-lint run | |
gotest: | |
strategy: | |
matrix: | |
directory: [".", "lib"] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Checkout dependency | |
uses: actions/checkout@v4 | |
with: | |
repository: rddl-network/bc-slip39-go | |
path: bc-slip39-go | |
- name: Build dependency | |
run: | | |
pushd bc-slip39-go | |
./deps.sh | |
popd | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.22" | |
- name: Run tests | |
run: | | |
pushd ${{ matrix.directory }} | |
# 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 |