add local workflow for goreport badge #1
This file contains hidden or 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: Go Report | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
go-report: | |
name: Go Code Quality | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.19' | |
- name: Check formatting | |
run: | | |
if [ -n "$(gofmt -l .)" ]; then | |
echo "The following files are not formatted correctly:" | |
gofmt -l . | |
exit 1 | |
fi | |
- name: Run go vet | |
run: go vet ./... | |
- name: Install golint | |
run: go install golang.org/x/lint/golint@latest | |
- name: Run golint | |
run: golint -set_exit_status ./... | |
- name: Install ineffassign | |
run: go install github.com/gordonklaus/ineffassign@latest | |
- name: Run ineffassign | |
run: ineffassign ./... | |
- name: Install misspell | |
run: go install github.com/client9/misspell/cmd/misspell@latest | |
- name: Run misspell | |
run: misspell -error . | |
- name: Install gocyclo | |
run: go install github.com/fzipp/gocyclo/cmd/gocyclo@latest | |
- name: Run gocyclo | |
run: gocyclo -over 15 . | |
- name: Update badge | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
uses: schneegans/dynamic-badges-action@v1.6.0 | |
with: | |
auth: ${{ secrets.GIST_SECRET }} | |
gistID: ${{ secrets.GIST_ID }} | |
filename: go-report-card.json | |
label: Go Report | |
message: A+ | |
color: brightgreen |