Skip to content

Commit f4c4316

Browse files
authored
Merge pull request #139 from fatih/improve-ci
Improve CI
2 parents 4e981ce + 6974279 commit f4c4316

File tree

1 file changed

+25
-9
lines changed

1 file changed

+25
-9
lines changed

.github/workflows/go.yml

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,40 @@
11
name: build
2-
on: [push, pull_request]
3-
jobs:
2+
on:
3+
push:
4+
branches:
5+
- master
6+
- main
7+
pull_request:
48

5-
test-build:
9+
jobs:
10+
test:
611
name: Test & Build
712
runs-on: ubuntu-latest
813
steps:
914

10-
- name: Set up Go 1.15
11-
uses: actions/setup-go@v1
15+
- name: Set up Go 1.16
16+
uses: actions/setup-go@v2
1217
with:
13-
go-version: 1.15.3
14-
id: go
18+
go-version: ^1.16
1519

1620
- name: Check out code into the Go module directory
1721
uses: actions/checkout@v2
22+
23+
- name: Run go mod tidy
24+
run: |
25+
set -e
26+
go mod tidy
27+
output=$(git status -s)
28+
if [ -z "${output}" ]; then
29+
exit 0
30+
fi
31+
echo 'We wish to maintain a tidy state for go mod. Please run `go mod tidy` on your branch, commit and push again.'
32+
echo 'Running `go mod tidy` on this CI test yields with the following changes:'
33+
echo "$output"
34+
exit 1
1835
1936
- name: Test
20-
run: |
21-
go test -race ./...
37+
run: go test -race ./...
2238

2339
- name: Build
2440
run: go build ./...

0 commit comments

Comments
 (0)