Skip to content

Commit 43bc8df

Browse files
authored
Merge pull request #1496 from NodeRedis/@salakar/travis-windows
fix: windows CI
2 parents 8f72799 + 4623cec commit 43bc8df

File tree

4 files changed

+41
-60
lines changed

4 files changed

+41
-60
lines changed

.travis.yml

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,47 @@
11
language: node_js
22
sudo: required
33

4-
env:
5-
- CXX=g++-4.8 TRAVIS=true
6-
7-
addons:
8-
apt:
9-
sources:
10-
- ubuntu-toolchain-r-test
11-
packages:
12-
- g++-4.8
4+
os:
5+
- windows
6+
- linux
137

148
node_js:
159
- "6"
1610
- "8"
11+
- "10"
1712
- "12"
1813
- "13"
1914

2015
before_install:
21-
- if [[ ! -f stunnel.tar.gz ]]; then wget -O stunnel.tar.gz ftp://ftp.stunnel.org/stunnel/archive/5.x/stunnel-5.54.tar.gz; fi
22-
- if [[ ! -f ./stunnel-5.54/configure ]]; then tar -xzf stunnel.tar.gz; fi
23-
- if [[ ! -f ./stunnel-5.54/src/stunnel ]]; then cd ./stunnel-5.54; ./configure; make; cd ..; fi
24-
- export PATH="$PATH:$(pwd)/stunnel-5.54/src"
16+
- |-
17+
case $TRAVIS_OS_NAME in
18+
linux)
19+
if [[ ! -f stunnel.tar.gz ]]; then wget -O stunnel.tar.gz ftp://ftp.stunnel.org/stunnel/archive/5.x/stunnel-5.54.tar.gz; fi
20+
if [[ ! -f ./stunnel-5.54/configure ]]; then tar -xzf stunnel.tar.gz; fi
21+
if [[ ! -f ./stunnel-5.54/src/stunnel ]]; then cd ./stunnel-5.54; ./configure; make; cd ..; fi
22+
export PATH="$PATH:$(pwd)/stunnel-5.54/src"
23+
;;
24+
esac
25+
- |-
26+
case $TRAVIS_OS_NAME in
27+
windows)
28+
choco install redis-64
29+
redis-server --service-install
30+
redis-server --service-start
31+
redis-cli config set stop-writes-on-bgsave-error no
32+
;;
33+
esac
2534
2635
cache:
2736
directories:
37+
- "$HOME/AppData/Local/Temp/chocolatey"
2838
- "$TRAVIS_BUILD_DIR/stunnel-5.54"
2939

30-
after_success: npm run coveralls
3140
before_script:
3241
# Add an IPv6 config - see the corresponding Travis issue
3342
# https://github.com/travis-ci/travis-ci/issues/8361
3443
- if [ "${TRAVIS_OS_NAME}" == "linux" ]; then
3544
sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6';
3645
fi
46+
47+
after_success: npm run coveralls

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
<a href="https://www.npmjs.com/package/redis"><img src="https://img.shields.io/npm/dm/redis.svg?style=flat-square" alt="NPM downloads"></a>
1313
<a href="https://www.npmjs.com/package/redis"><img src="https://img.shields.io/npm/v/redis.svg?style=flat-square" alt="NPM version"></a>
1414
<a href="https://travis-ci.org/NodeRedis/node-redis"><img src="https://travis-ci.org/NodeRedis/node-redis.svg?style=flat-square&branch=master" alt="Build Status" /></a>
15-
<a href="https://ci.appveyor.com/project/BridgeAR/node-redis/branch/master"><img src="https://img.shields.io/appveyor/ci/BridgeAR/node-redis/master.svg?style=flat-square&label=Windows%20Tests" alt="Windows Tests" /></a>
1615
<a href="https://coveralls.io/r/NodeRedis/node-redis?branch="><img src="https://coveralls.io/repos/NodeRedis/node-redis/badge.svg?style=flat-square&branch=" alt="Coverage Status" /></a>
1716
<a href="https://twitter.com/NodeRedis"><img src="https://img.shields.io/twitter/follow/NodeRedis.svg?style=flat-square&colorA=1da1f2&colorB=&label=Follow%20on%20Twitter" alt="Follow on Twitter"></a>
1817
</p>

appveyor.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.

test/node_redis.spec.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,22 @@ var fork = require('child_process').fork;
1111
var redis = config.redis;
1212
var client;
1313

14+
// Currently Travis Windows builds hang after completing if any processes are still running,
15+
// we shutdown redis-server after all tests complete (can't do this in a
16+
// `after_script` Travis hook as it hangs before the `after` life cycles)
17+
// to workaround the issue.
18+
//
19+
// See: https://github.com/travis-ci/travis-ci/issues/8082
20+
after(function (done) {
21+
if (process.platform !== 'win32' || !process.env.CI) {
22+
return done();
23+
}
24+
process.nextTick(function () {
25+
require('cross-spawn').sync('redis-server', ['--service-stop'], {});
26+
done();
27+
});
28+
});
29+
1430
describe('The node_redis client', function () {
1531

1632
describe("The 'add_command' method", function () {

0 commit comments

Comments
 (0)