Skip to content

Commit f262d38

Browse files
committed
github/workflows: add support windows
1 parent ba06d25 commit f262d38

File tree

1 file changed

+42
-18
lines changed

1 file changed

+42
-18
lines changed

.github/workflows/test.yml

Lines changed: 42 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ on:
88
pull_request:
99
branches: "*"
1010

11+
defaults:
12+
run:
13+
shell: bash
14+
1115
jobs:
1216
test:
1317
strategy:
@@ -17,6 +21,8 @@ jobs:
1721
- ubuntu-20.04
1822
# https://github.com/actions/virtual-environments/blob/macOS-10.15/20201212.1/images/macos/macos-10.15-Readme.md
1923
- macos-10.15
24+
# https://github.com/actions/virtual-environments/blob/win19/20201210.0/images/win/Windows2019-Readme.md
25+
- windows-2019
2026
go-version:
2127
- 1.13.x
2228
- 1.14.x
@@ -41,38 +47,56 @@ jobs:
4147
with:
4248
fetch-depth: 2
4349

44-
- uses: actions/cache@v2
50+
- name: Cache Go module and build cache
51+
uses: actions/cache@v2
4552
with:
53+
key: ${{ env.OS }}-go-${{ hashFiles('**/go.sum') }}
4654
path: |
4755
~/go/pkg/mod # Module download cache
4856
~/.cache/go-build # Build cache (Linux)
4957
~/Library/Caches/go-build # Build cache (Mac)
5058
'%LocalAppData%\go-build' # Build cache (Windows)
51-
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
5259
restore-keys: |
53-
${{ runner.os }}-go-
60+
${{ env.OS }}-go-
5461
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-
6272
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'
6593
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 .)
7095
7196
- name: Test and vet
7297
run: |
73-
diff -u <(echo -n) <(gofmt -s -d .)
7498
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 ./...
76100
77101
- uses: codecov/codecov-action@v1
78102
with:

0 commit comments

Comments
 (0)