-
Notifications
You must be signed in to change notification settings - Fork 29
35 lines (32 loc) · 1.28 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
name: Run Tests
on:
pull_request:
branches:
- master
jobs:
test:
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
# if we don't do this, `gofmt` will want to rewrite all Go files due to bad line endings,
# because Git will convert all line endings to CRLF when cloning on windows
- name: Set Git to use Linux-style line endings
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: Checkout code
uses: actions/checkout@v2
- name: Format
run: if ! [ -z "$(find . -type f -name "*.go" -not -path "./vendor/*" | sed "s|^\./||" | xargs gofmt -l)" ]; then
echo -e " $(find . -type f -name "*.go" -not -path "./vendor/*" | sed "s|^\./||" | xargs gofmt -l)";
exit 1;
fi
if: matrix.platform == 'ubuntu-latest'
- name: Vet
run: go vet $(go list ./... | grep -v '/vendor/')