Skip to content

Commit e0d39c0

Browse files
authored
Build/test/golint/goimports on a push or pull request (#2)
* Build/test/golint/goimports on a push or pull request * reduce number of go versions we build in CI * lint and check code formatting before running tests * Use staticcheck instead of golint Change staticcheck install command fix staticcheck command * fail goimports if errors found * only build on a push * run staticcheck on all directories * remove build step
1 parent f3c817b commit e0d39c0

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

.github/workflows/test.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
on: [push]
2+
name: Test
3+
jobs:
4+
test:
5+
strategy:
6+
matrix:
7+
go-version: [1.16.x]
8+
os: [ubuntu-latest]
9+
runs-on: ${{ matrix.os }}
10+
steps:
11+
- name: Install Go
12+
uses: actions/setup-go@v2
13+
with:
14+
go-version: ${{ matrix.go-version }}
15+
- name: Checkout code
16+
uses: actions/checkout@v2
17+
- name: Install dependencies
18+
run: |
19+
go get -u honnef.co/go/tools/cmd/staticcheck@latest
20+
go get -u golang.org/x/tools/cmd/goimports
21+
- name: Run staticcheck
22+
run: staticcheck ./...
23+
- name: Check code formatting
24+
run: test -z $(goimports -l .)
25+
- name: Run Test
26+
run: go test ./...

0 commit comments

Comments
 (0)