Skip to content

fix(ci): restore gofumpt and coverage gates #203

fix(ci): restore gofumpt and coverage gates

fix(ci): restore gofumpt and coverage gates #203

Workflow file for this run

name: ci
on:
pull_request:
push:
branches:
- main
permissions:
contents: read
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
cache: true
- name: Lint
uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0
with:
version: v2.12.2
- name: Install analyzers
run: |
go install honnef.co/go/tools/cmd/staticcheck@v0.7.0
go install mvdan.cc/gofumpt@v0.11.0
go install github.com/securego/gosec/v2/cmd/gosec@v2.28.0
go install golang.org/x/tools/cmd/deadcode@v0.48.0
- name: Vet
run: go vet ./...
- name: Staticcheck
run: '"$(go env GOPATH)/bin/staticcheck" ./...'
- name: Deadcode
run: |
output_file=$(mktemp)
"$(go env GOPATH)/bin/deadcode" -test ./... > "$output_file"
if [ -s "$output_file" ]; then
cat "$output_file"
exit 1
fi
- name: Gofumpt
run: |
changed="$("$(go env GOPATH)/bin/gofumpt" -l .)"
if [ -n "$changed" ]; then
printf 'gofumpt wants changes in:\n%s\n' "$changed"
exit 1
fi
- name: Gosec
run: |
"$(go env GOPATH)/bin/gosec" -exclude=G101,G115,G202,G301,G304 ./...
test:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
cache: true
- name: Test with coverage
run: go test -count=1 ./... -coverprofile=coverage.out
- name: Test with race detector
run: go test -count=1 -race ./...
- name: Enforce coverage floor
run: ./scripts/coverage.sh 85.0
- name: Build
run: go build ./cmd/wacrawl
deps:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
cache: true
- name: Verify module cache
run: go mod verify
- name: Check go.mod tidy
run: |
go mod tidy
git diff --exit-code -- go.mod go.sum
- name: Install govulncheck
run: go install golang.org/x/vuln/cmd/govulncheck@v1.6.0
- name: Run govulncheck
run: '"$(go env GOPATH)/bin/govulncheck" ./...'
release-check:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
cache: true
- name: Snapshot release build
uses: goreleaser/goreleaser-action@f06c13b6b1a9625abc9e6e439d9c05a8f2190e94 # v7.2.3
with:
distribution: goreleaser
version: "~> v2"
args: release --snapshot --clean --skip=publish
- name: Test macOS release scripts
run: bash scripts/test-macos-release.sh
secrets:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
cache: true
- name: Install gitleaks
run: go install github.com/zricethezav/gitleaks/v8@v8.30.1
- name: Scan git history
run: |
"$(go env GOPATH)/bin/gitleaks" git --no-banner --redact
- name: Scan working tree
run: |
"$(go env GOPATH)/bin/gitleaks" dir . --no-banner --redact