-
Notifications
You must be signed in to change notification settings - Fork 2
58 lines (58 loc) · 1.77 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Checks
on:
push:
branches:
- master
pull_request:
types:
- synchronize
jobs:
setup:
name: Setup
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Parse Go mod file
id: go_mod_parse
run: echo "::set-output name=go_mod_json::$(go mod edit -json)"
- name: Setup specific Go version
# DBG:
#uses: actions/setup-go@v2
#with:
# go-version: ${{ fromJSON(steps.go_mod_parse.outputs.go_mod_json).Go }}
run:
echo "${{ steps.go_mod_parse.outputs }}"
echo "${{ steps.go_mod_parse.outputs.go_mod_json }}"
echo "${{ fromJSON(steps.go_mod_parse.outputs.go_mod_json) }}"
echo "${{ fromJSON(steps.go_mod_parse.outputs.go_mod_json).Go }}"
- name: Restore cache
uses: actions/cache@v2
with:
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
%LocalAppData%\go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-
test:
name: Run tests
needs: setup
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Windows
if: matrix.os == 'windows-latest'
run: go test -v -tags system .\...
- name: '*nix'
if: matrix.os != 'windows-latest'
# The CI has an old version of Go by default.
# setup-go installs the version we want, but
# root won't have that binary in its `secure_path`.
run: sudo $(which go) test -v -tags system ./...