Skip to content

Commit 9698cf1

Browse files
committed
Merge pull request #44 from fwalch/nvim-nightly
Travis: Use Neovim nightly and separate flake jobs.
2 parents 3958696 + 7561919 commit 9698cf1

File tree

2 files changed

+81
-22
lines changed

2 files changed

+81
-22
lines changed

.travis.yml

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,42 @@ env:
55
- NOSE_VERBOSE=2
66
- NOSE_WITH_COVERAGE=true
77
- NOSE_COVER_PACKAGE=neovim
8+
matrix:
9+
- CI_TARGET=tests
10+
matrix:
11+
include:
12+
- python: 2.7
13+
env: CI_TARGET=flake
14+
- python: 3.4
15+
env: CI_TARGET=flake
816
python:
917
# If the build matrix gets bigger, also update the number of runs
1018
# at the bottom of .scrutinizer.yml.
11-
- "2.6"
12-
- "2.7"
13-
- "3.2"
14-
- "3.3"
15-
- "3.4"
16-
- "pypy"
19+
- 2.6
20+
- 2.7
21+
- 3.2
22+
- 3.3
23+
- 3.4
24+
- pypy
1725
before_install:
18-
- sudo apt-get update -qq
19-
- sudo apt-get install expect -q
20-
- git clone --depth=1 -b master git://github.com/neovim/neovim nvim
21-
- sudo git clone --depth=1 git://github.com/neovim/deps /opt/neovim-deps
22-
- pip install -q flake8 flake8-import-order flake8-docstrings pep8-naming
23-
- pip install -q scrutinizer-ocular
26+
- if [ $CI_TARGET = tests ]; then
27+
sudo apt-get update -qq;
28+
sudo apt-get install expect -q;
29+
eval "$(curl -Ss https://raw.githubusercontent.com/neovim/bot-ci/master/scripts/travis-setup.sh) nightly-x64";
30+
pip install -q scrutinizer-ocular;
31+
else
32+
pip install -q flake8 flake8-import-order flake8-docstrings pep8-naming;
33+
fi
2434
install:
2535
- pip install .
26-
- prefix="/opt/neovim-deps/64"
27-
- eval $($prefix/usr/bin/luarocks path)
28-
- export PATH="$prefix/usr/bin:$PATH"
29-
- export PKG_CONFIG_PATH="$prefix/usr/lib/pkgconfig"
30-
- export USE_BUNDLED_DEPS=OFF
31-
- cd nvim && make && cd ..
3236
script:
33-
- ./nvim/scripts/run-api-tests.exp "nosetests" "./nvim/build/bin/nvim -u NONE"
34-
- NVIM_SPAWN_ARGV='["./nvim/build/bin/nvim", "-u", "NONE", "--embed"]' nosetests
35-
- flake8 --exclude ./neovim/plugins neovim
37+
- if [ $CI_TARGET = tests ]; then
38+
./scripts/run-api-tests.exp "nosetests" "nvim -u NONE";
39+
NVIM_SPAWN_ARGV='["nvim", "-u", "NONE", "--embed"]' nosetests;
40+
else
41+
flake8 --exclude ./neovim/plugins neovim;
42+
fi
3643
after_script:
37-
- ocular
44+
- if [ $CI_TARGET = tests ]; then
45+
ocular;
46+
fi

scripts/run-api-tests.exp

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/usr/bin/env expect
2+
3+
if {$argc < 2} {
4+
puts "Need commands for running the tests and for starting nvim"
5+
exit 1
6+
}
7+
8+
set timeout 60
9+
set run_tests [split [lindex $argv 0] " "]
10+
set run_nvim [split [lindex $argv 1] " "]
11+
12+
# don't echo to stdout
13+
log_user 0
14+
# set NVIM_LISTEN_ADDRESS, so nvim will listen on a known socket
15+
set env(NVIM_LISTEN_ADDRESS) "/tmp/nvim-[exec date +%s%N].sock"
16+
# start nvim
17+
spawn {*}$run_nvim
18+
# save the job descriptor
19+
set nvim_id $spawn_id
20+
# Reset function that can be invoked by test runners to put nvim in a cleaner
21+
# state
22+
send {
23+
:echo "read"."y"
24+
}
25+
# wait until nvim is ready
26+
expect "ready"
27+
# run tests
28+
spawn {*}$run_tests
29+
set tests_id $spawn_id
30+
set status 1
31+
# listen for test output in the background
32+
expect_background {
33+
* {
34+
# show test output to the user
35+
send_user -- $expect_out(buffer)
36+
}
37+
eof {
38+
# collect the exit status code
39+
set spawn_id $tests_id
40+
catch wait result
41+
set status [lindex $result 3]
42+
set spawn_id $nvim_id
43+
# quit nvim
44+
send ":qa!\r"
45+
}
46+
}
47+
# switch back nvim and wait until it exits
48+
set spawn_id $nvim_id
49+
expect eof
50+
exit $status

0 commit comments

Comments
 (0)