2020-02-11 18:43:19 +00:00
|
|
|
name: staticcheck
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2020-06-15 17:47:11 +00:00
|
|
|
- main
|
2020-02-11 18:43:19 +00:00
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- '*'
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
2020-04-19 20:56:51 +00:00
|
|
|
- name: Set up Go
|
2022-03-16 19:46:16 +00:00
|
|
|
uses: actions/setup-go@v3
|
2020-02-11 18:43:19 +00:00
|
|
|
with:
|
2022-03-15 22:58:54 +00:00
|
|
|
go-version: 1.18
|
2020-02-11 18:43:19 +00:00
|
|
|
|
|
|
|
- name: Check out code
|
2022-03-22 22:56:34 +00:00
|
|
|
uses: actions/checkout@v3
|
2020-02-11 18:43:19 +00:00
|
|
|
|
2022-07-26 16:20:53 +00:00
|
|
|
- name: Run gofmt (goimports)
|
|
|
|
run: go run golang.org/x/tools/cmd/goimports -d --format-only .
|
|
|
|
|
2020-07-16 15:41:18 +00:00
|
|
|
- name: Run go vet
|
|
|
|
run: go vet ./...
|
|
|
|
|
2021-05-03 17:55:49 +00:00
|
|
|
- name: Install staticcheck
|
|
|
|
run: "GOBIN=~/.local/bin go install honnef.co/go/tools/cmd/staticcheck"
|
|
|
|
|
2020-03-06 21:04:11 +00:00
|
|
|
- name: Print staticcheck version
|
2021-05-03 17:55:49 +00:00
|
|
|
run: "staticcheck -version"
|
|
|
|
|
|
|
|
- name: Run staticcheck (linux/amd64)
|
2021-08-26 22:39:42 +00:00
|
|
|
env:
|
|
|
|
GOOS: linux
|
|
|
|
GOARCH: amd64
|
|
|
|
run: "staticcheck -- $(go list ./... | grep -v tempfork)"
|
2021-05-03 17:55:49 +00:00
|
|
|
|
|
|
|
- name: Run staticcheck (darwin/amd64)
|
2021-08-26 22:39:42 +00:00
|
|
|
env:
|
|
|
|
GOOS: darwin
|
|
|
|
GOARCH: amd64
|
|
|
|
run: "staticcheck -- $(go list ./... | grep -v tempfork)"
|
2021-05-03 17:55:49 +00:00
|
|
|
|
|
|
|
- name: Run staticcheck (windows/amd64)
|
2021-08-26 22:39:42 +00:00
|
|
|
env:
|
|
|
|
GOOS: windows
|
|
|
|
GOARCH: amd64
|
|
|
|
run: "staticcheck -- $(go list ./... | grep -v tempfork)"
|
2020-03-06 21:04:11 +00:00
|
|
|
|
2021-05-03 17:55:49 +00:00
|
|
|
- name: Run staticcheck (windows/386)
|
2021-08-26 22:39:42 +00:00
|
|
|
env:
|
|
|
|
GOOS: windows
|
|
|
|
GOARCH: "386"
|
|
|
|
run: "staticcheck -- $(go list ./... | grep -v tempfork)"
|
2020-02-11 18:43:19 +00:00
|
|
|
|
|
|
|
- uses: k0kubun/action-slack@v2.0.0
|
|
|
|
with:
|
|
|
|
payload: |
|
|
|
|
{
|
|
|
|
"attachments": [{
|
|
|
|
"text": "${{ job.status }}: ${{ github.workflow }} <https://github.com/${{ github.repository }}/commit/${{ github.sha }}/checks|${{ env.COMMIT_DATE }} #${{ env.COMMIT_NUMBER_OF_DAY }}> " +
|
|
|
|
"(<https://github.com/${{ github.repository }}/commit/${{ github.sha }}|" + "${{ github.sha }}".substring(0, 10) + ">) " +
|
|
|
|
"of ${{ github.repository }}@" + "${{ github.ref }}".split('/').reverse()[0] + " by ${{ github.event.head_commit.committer.name }}",
|
|
|
|
"color": "danger"
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
env:
|
|
|
|
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|
|
|
|
if: failure() && github.event_name == 'push'
|