Skip to content

Commit d02967f

Browse files
committed
[gh-actions] Add lint and build file
1 parent a1ec0a9 commit d02967f

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

.github/workflows/run-build.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: run-build
2+
on:
3+
push:
4+
branches:
5+
- master
6+
- dev
7+
pull_request:
8+
branches:
9+
- master
10+
11+
jobs:
12+
linters:
13+
# go vet and go fmt are mandatory.
14+
# Other linters are optional but should dispay issues.
15+
name: Linters
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v2
19+
- name: Setup go 1.16
20+
uses: actions/setup-go@v2
21+
with:
22+
go-version: '1.16'
23+
- name: Run go vet
24+
run: go vet ./...
25+
- name: Run gofmt
26+
run: |
27+
gofmt -s -l .
28+
if [ "$(gofmt -l . | wc -l)" -gt 0 ]; then exit 1; fi
29+
- name: Run golint
30+
run: |
31+
go get golang.org/x/lint/golint
32+
golint ./...
33+
continue-on-error: true
34+
- name: Run staticcheck
35+
run: |
36+
go get honnef.co/go/tools/cmd/staticcheck
37+
staticcheck ./...
38+
continue-on-error: true
39+
- name: Run errcheck
40+
run: |
41+
go get github.com/kisielk/errcheck
42+
errcheck ./...
43+
continue-on-error: true
44+
45+
build:
46+
name: build
47+
strategy:
48+
matrix:
49+
go-version: [1.14.x, 1.15.x, 1.16.x]
50+
platform: [ubuntu-latest]
51+
runs-on: ${{ matrix.platform }}
52+
steps:
53+
- name: Install Go
54+
uses: actions/setup-go@v1
55+
with:
56+
go-version: ${{ matrix.go-version }}
57+
- name: Checkout code
58+
uses: actions/checkout@v2
59+
- name: Run unit tests
60+
run: go build ./cmd/ginvalid

0 commit comments

Comments
 (0)