remove errcheck, opt for lin #21
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
# This workflow will build a golang project | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go | |
name: Build | |
on: | |
push: | |
branches: [ "main" ] | |
# pull_request: | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
fmt: | |
name: Go Fmt | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- name: fmt | |
uses: danhunsaker/[email protected] | |
with: | |
run: fmt | |
token: ${{ secrets.GITHUB_TOKEN }} | |
imports: | |
name: Go Imports | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- name: imports | |
uses: danhunsaker/[email protected] | |
with: | |
run: imports | |
token: ${{ secrets.GITHUB_TOKEN }} | |
vet: | |
name: Go Vet | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- name: vet | |
uses: danhunsaker/[email protected] | |
with: | |
run: vet | |
token: ${{ secrets.GITHUB_TOKEN }} | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- name: lint | |
uses: danhunsaker/[email protected] | |
with: | |
run: errcheck | |
token: ${{ secrets.GITHUB_TOKEN }} | |
shadow: | |
name: Shadow Analyzer | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- name: shadow | |
uses: danhunsaker/[email protected] | |
with: | |
run: shadow | |
token: ${{ secrets.GITHUB_TOKEN }} | |
misspell: | |
name: Spell Check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- name: misspell | |
uses: danhunsaker/[email protected] | |
with: | |
run: misspell | |
token: ${{ secrets.GITHUB_TOKEN }} | |
gocyclo: | |
name: Cyclomatic Complexity | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- name: gocyclo | |
uses: danhunsaker/[email protected] | |
with: | |
run: cyclo | |
token: ${{ secrets.GITHUB_TOKEN }} | |
flags: "-over 20" | |
staticcheck: | |
name: Static Check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- name: staticcheck | |
uses: danhunsaker/[email protected] | |
with: | |
run: staticcheck | |
token: ${{ secrets.GITHUB_TOKEN }} | |
ineffassign: | |
name: Ineffectual Assignments | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- name: ineffassign | |
uses: danhunsaker/[email protected] | |
with: | |
run: ineffassign | |
token: ${{ secrets.GITHUB_TOKEN }} | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
go: [ '1.22.4', '1.23' ] | |
steps: | |
- name: Checkout Code ${{ matrix.go }} | |
uses: actions/checkout@v4 | |
- name: Set up Go ${{ matrix.go }} | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ matrix.go }} | |
- name: Tidy and Vendor ${{ matrix.go }} | |
run: | | |
go get -u | |
go mod tidy | |
go mod vendor | |
- name: Set Up GoTestFmt ${{ matrix.go }} | |
uses: GoTestTools/gotestfmt-action@v2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
version: v2.0.0 | |
- name: Test ${{ matrix.go }} | |
run: | | |
set -euo pipefail | |
go test -json -v ./... 2>&1 | tee /tmp/gotest.log | gotestfmt | |
- name: Archive markdown artifacts ${{ matrix.go }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: archive-markdown | |
path: | | |
docs | |
- name: Build Markdown Pages ${{ matrix.go }} | |
run: | | |
go install github.com/princjef/gomarkdoc/cmd/gomarkdoc@latest | |
gomarkdoc --output=docs/code/hydra.md ./hydra | |
- name: Setup git Config ${{ matrix.go }} | |
run: | | |
git config user.name "GitHub Actions Bot" | |
git config user.email "<[email protected]>" | |
- name: Commit Docs ${{ matrix.go }} | |
run: | | |
# Stage the file, commit and push | |
git checkout gh-pages 2>/dev/null || git checkout -b gh-pages | |
git add ./docs/code | |
git commit -m "gh-pages gomarkdoc GHABOT" | |
git push -f origin gh-pages | |
git checkout main | |
- name: Build ${{ matrix.go }} | |
run: go build -v ./... |