Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support windows test #92

Merged
merged 3 commits into from
Jan 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@ coverage:
<<: *projects
flags:
- "macos-1.15"
windows-1.13:
<<: *projects
flags:
- "windows-1.13"
windows-1.14:
<<: *projects
flags:
- "windows-1.14"
windows-1.15:
<<: *projects
flags:
- "windows-1.15"
patch:
default: false
linux-1.13:
Expand All @@ -59,6 +71,12 @@ coverage:
<<: *patch
macos-1.15:
<<: *patch
windows-1.13:
<<: *patch
windows-1.14:
<<: *patch
windows-1.15:
<<: *patch
changes:
default:
if_ci_failed: error
Expand All @@ -73,6 +91,9 @@ coverage:
- "macos-1.13"
- "macos-1.14"
- "macos-1.15"
- "windows-1.13"
- "windows-1.14"
- "windows-1.15"

flags:
linux-1.13:
Expand All @@ -99,6 +120,18 @@ flags:
paths:
- /
carryforward: true
windows-1.13:
paths:
- /
carryforward: true
windows-1.14:
paths:
- /
carryforward: true
windows-1.15:
paths:
- /
carryforward: true

comment:
behavior: default
Expand Down
60 changes: 42 additions & 18 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:
pull_request:
branches: "*"

defaults:
run:
shell: bash

jobs:
test:
strategy:
Expand All @@ -17,6 +21,8 @@ jobs:
- ubuntu-20.04
# https://github.com/actions/virtual-environments/blob/macOS-10.15/20201212.1/images/macos/macos-10.15-Readme.md
- macos-10.15
# https://github.com/actions/virtual-environments/blob/win19/20201210.0/images/win/Windows2019-Readme.md
- windows-2019
go-version:
- 1.13.x
- 1.14.x
Expand All @@ -41,38 +47,56 @@ jobs:
with:
fetch-depth: 2

- uses: actions/cache@v2
- name: Cache Go module and build cache
uses: actions/cache@v2
with:
key: ${{ env.OS }}-go-${{ hashFiles('**/go.sum') }}
path: |
~/go/pkg/mod # Module download cache
~/.cache/go-build # Build cache (Linux)
~/Library/Caches/go-build # Build cache (Mac)
'%LocalAppData%\go-build' # Build cache (Windows)
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
${{ env.OS }}-go-

- name: Install nvim binary for Linux
if: runner.os == 'Linux'
run: |
curl -SLO https://github.com/go-nvim/neovim/releases/download/nightly/nvim-linux64.tar.gz
tar xzf nvim-linux64.tar.gz
mv nvim-linux64 /home/runner/nvim
echo "/home/runner/nvim/bin" >> $GITHUB_PATH
- name: Cache nvim binary for linux and darwin
uses: actions/cache@v2
id: cache-nvim
if: env.OS != 'windows'
with:
key: ${{ env.OS }}-nvim-${{ hashFiles('~/nvim/bin/nvim') }}
path: |
~/nvim
restore-keys: |
${{ env.OS }}-nvim-

- name: Install nvim binary for macOS
if: runner.os == 'MacOS'
- name: Cache nvim binary for Windows
uses: actions/cache@v2
id: cache-nvim-windows
if: env.OS == 'windows'
with:
key: ${{ env.OS }}-nvim-${{ hashFiles('~/nvim/nvim.exe') }}
path: |
~/nvim
restore-keys: |
${{ env.OS }}-nvim-

- name: Install nvim binary
uses: rhysd/action-setup-vim@v1
if: steps.cache-nvim.outputs.cache-hit != 'true' || steps.cache-nvim-windows.outputs.cache-hit != 'true'
with:
neovim: true
version: nightly

- name: gofmt
if: env.OS != 'windows'
run: |
curl -SLO https://github.com/go-nvim/neovim/releases/download/nightly/nvim-macos.tar.gz
tar xzf nvim-macos.tar.gz
mv nvim-osx64 /Users/runner/nvim
echo "/Users/runner/nvim/bin" >> $GITHUB_PATH
diff -u <(echo -n) <(gofmt -s -d .)

- name: Test and vet
run: |
diff -u <(echo -n) <(gofmt -s -d .)
go vet ./...
go test -v -race -covermode=atomic -coverpkg=./... -coverprofile=coverage.out ./...
go test -v -race -count=1 -covermode=atomic -coverpkg=./... -coverprofile=coverage.out ./...

- uses: codecov/codecov-action@v1
with:
Expand Down
13 changes: 11 additions & 2 deletions nvim/nvim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"os"
"path/filepath"
"reflect"
"runtime"
"sort"
"strings"
"sync/atomic"
Expand All @@ -20,11 +21,15 @@ func newChildProcess(tb testing.TB) (v *Nvim, cleanup func()) {
tb.Helper()

ctx := context.Background()
n, err := NewChildProcess(
opts := []ChildProcessOption{
ChildProcessArgs("-u", "NONE", "-n", "--embed", "--headless", "--noplugin"),
ChildProcessContext(ctx),
ChildProcessLogf(tb.Logf),
)
}
if runtime.GOOS == "windows" {
opts = append(opts, ChildProcessCommand("nvim.exe"))
}
n, err := NewChildProcess(opts...)
if err != nil {
tb.Fatal(err)
}
Expand Down Expand Up @@ -1554,6 +1559,10 @@ func clearBuffer(tb testing.TB, v *Nvim, buffer Buffer) {
}

func TestDial(t *testing.T) {
if runtime.GOOS == "windows" {
t.Skip("not supported dial unix socket on windows GOOS")
}

t.Parallel()

v1, cleanup := newChildProcess(t)
Expand Down
11 changes: 9 additions & 2 deletions nvim/plugin/register_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package plugin_test

import (
"os"
"runtime"
"strings"
"testing"

Expand All @@ -14,10 +15,16 @@ func newEmbeddedPlugin(t *testing.T) (*plugin.Plugin, func()) {
if v := os.Getenv("VIM"); v != "" {
env = append(env, "VIM="+v)
}
v, err := nvim.NewChildProcess(

opts := []nvim.ChildProcessOption{
nvim.ChildProcessArgs("-u", "NONE", "-n", "--embed"),
nvim.ChildProcessEnv(env),
nvim.ChildProcessLogf(t.Logf))
nvim.ChildProcessLogf(t.Logf),
}
if runtime.GOOS == "windows" {
opts = append(opts, nvim.ChildProcessCommand("nvim.exe"))
}
v, err := nvim.NewChildProcess(opts...)
if err != nil {
t.Fatal(err)
}
Expand Down