8
8
pull_request :
9
9
branches : " *"
10
10
11
+ defaults :
12
+ run :
13
+ shell : bash
14
+
11
15
jobs :
12
16
test :
13
17
strategy :
17
21
- ubuntu-20.04
18
22
# https://github.com/actions/virtual-environments/blob/macOS-10.15/20201212.1/images/macos/macos-10.15-Readme.md
19
23
- macos-10.15
24
+ # https://github.com/actions/virtual-environments/blob/win19/20201210.0/images/win/Windows2019-Readme.md
25
+ - windows-2019
20
26
go-version :
21
27
- 1.13.x
22
28
- 1.14.x
@@ -41,38 +47,56 @@ jobs:
41
47
with :
42
48
fetch-depth : 2
43
49
44
- - uses : actions/cache@v2
50
+ - name : Cache Go module and build cache
51
+ uses : actions/cache@v2
45
52
with :
53
+ key : ${{ env.OS }}-go-${{ hashFiles('**/go.sum') }}
46
54
path : |
47
55
~/go/pkg/mod # Module download cache
48
56
~/.cache/go-build # Build cache (Linux)
49
57
~/Library/Caches/go-build # Build cache (Mac)
50
58
'%LocalAppData%\go-build' # Build cache (Windows)
51
- key : ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
52
59
restore-keys : |
53
- ${{ runner.os }}-go-
60
+ ${{ env.OS }}-go-
54
61
55
- - name : Install nvim binary for Linux
56
- if : runner.os == 'Linux'
57
- run : |
58
- curl -SLO https://github.com/go-nvim/neovim/releases/download/nightly/nvim-linux64.tar.gz
59
- tar xzf nvim-linux64.tar.gz
60
- mv nvim-linux64 /home/runner/nvim
61
- echo "/home/runner/nvim/bin" >> $GITHUB_PATH
62
+ - name : Cache nvim binary for linux and darwin
63
+ uses : actions/cache@v2
64
+ id : cache-nvim
65
+ if : env.OS != 'windows'
66
+ with :
67
+ key : ${{ env.OS }}-nvim-${{ hashFiles('~/nvim/bin/nvim') }}
68
+ path : |
69
+ ~/nvim
70
+ restore-keys : |
71
+ ${{ env.OS }}-nvim-
62
72
63
- - name : Install nvim binary for macOS
64
- if : runner.os == 'MacOS'
73
+ - name : Cache nvim binary for Windows
74
+ uses : actions/cache@v2
75
+ id : cache-nvim-windows
76
+ if : env.OS == 'windows'
77
+ with :
78
+ key : ${{ env.OS }}-nvim-${{ hashFiles('~/nvim/nvim.exe') }}
79
+ path : |
80
+ ~/nvim
81
+ restore-keys : |
82
+ ${{ env.OS }}-nvim-
83
+
84
+ - name : Install nvim binary
85
+ uses : rhysd/action-setup-vim@v1
86
+ if : steps.cache-nvim.outputs.cache-hit != 'true' || steps.cache-nvim-windows.outputs.cache-hit != 'true'
87
+ with :
88
+ neovim : true
89
+ version : nightly
90
+
91
+ - name : gofmt
92
+ if : env.OS != 'windows'
65
93
run : |
66
- curl -SLO https://github.com/go-nvim/neovim/releases/download/nightly/nvim-macos.tar.gz
67
- tar xzf nvim-macos.tar.gz
68
- mv nvim-osx64 /Users/runner/nvim
69
- echo "/Users/runner/nvim/bin" >> $GITHUB_PATH
94
+ diff -u <(echo -n) <(gofmt -s -d .)
70
95
71
96
- name : Test and vet
72
97
run : |
73
- diff -u <(echo -n) <(gofmt -s -d .)
74
98
go vet ./...
75
- go test -v -race -covermode=atomic -coverpkg=./... -coverprofile=coverage.out ./...
99
+ go test -v -race -count=1 - covermode=atomic -coverpkg=./... -coverprofile=coverage.out ./...
76
100
77
101
- uses : codecov/codecov-action@v1
78
102
with :
0 commit comments