Skip to content

Commit dfe99ea

Browse files
authored
Run tests in GitHub Actions (#426)
1 parent 7d984ef commit dfe99ea

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

.github/workflows/test.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: test
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
jobs:
8+
test:
9+
strategy:
10+
matrix:
11+
go-version: [ 1.16.x, 1.17.x ]
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Install Go
15+
uses: actions/setup-go@v2
16+
with:
17+
go-version: ${{ matrix.go-version }}
18+
- name: Checkout code
19+
uses: actions/checkout@v2
20+
- name: Go cache
21+
uses: actions/cache@v2
22+
with:
23+
path: |
24+
~/go/pkg/mod
25+
~/.cache/go-build
26+
key: ${{ runner.os }}-go-cache-${{ hashFiles('**/go.sum') }}
27+
restore-keys: |
28+
${{ runner.os }}-go-cache
29+
- name: Run gofmt
30+
run: gofmt -d -e . 2>&1 | tee outfile && test -z "$(cat outfile)" && rm outfile
31+
- name: Run golint
32+
run: |
33+
go install golang.org/x/lint/golint@latest
34+
golint -set_exit_status ./...
35+
cd _examples && golint -set_exit_status ./... && cd ..
36+
- name: Run go vet
37+
run: |
38+
go vet ./...
39+
cd _examples && go vet ./... && cd ..
40+
- name: Run go test
41+
run: |
42+
go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
43+
cd _examples && go test -v -race ./... && cd ..
44+
- name: Run godog
45+
run: |
46+
go install ./cmd/godog
47+
godog -f progress --strict
48+
- name: Report on code coverage
49+
if: matrix.go-version == '1.17.x'
50+
uses: codecov/codecov-action@v1
51+
with:
52+
file: ./coverage.txt

0 commit comments

Comments
 (0)