Skip to content

Commit

Permalink
Merge pull request #1496 from NodeRedis/@salakar/travis-windows
Browse files Browse the repository at this point in the history
fix: windows CI
  • Loading branch information
Salakar authored Feb 9, 2020
2 parents 8f72799 + 4623cec commit 43bc8df
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 60 deletions.
39 changes: 25 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,47 @@
language: node_js
sudo: required

env:
- CXX=g++-4.8 TRAVIS=true

addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
os:
- windows
- linux

node_js:
- "6"
- "8"
- "10"
- "12"
- "13"

before_install:
- 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
- if [[ ! -f ./stunnel-5.54/configure ]]; then tar -xzf stunnel.tar.gz; fi
- if [[ ! -f ./stunnel-5.54/src/stunnel ]]; then cd ./stunnel-5.54; ./configure; make; cd ..; fi
- export PATH="$PATH:$(pwd)/stunnel-5.54/src"
- |-
case $TRAVIS_OS_NAME in
linux)
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
if [[ ! -f ./stunnel-5.54/configure ]]; then tar -xzf stunnel.tar.gz; fi
if [[ ! -f ./stunnel-5.54/src/stunnel ]]; then cd ./stunnel-5.54; ./configure; make; cd ..; fi
export PATH="$PATH:$(pwd)/stunnel-5.54/src"
;;
esac
- |-
case $TRAVIS_OS_NAME in
windows)
choco install redis-64
redis-server --service-install
redis-server --service-start
redis-cli config set stop-writes-on-bgsave-error no
;;
esac
cache:
directories:
- "$HOME/AppData/Local/Temp/chocolatey"
- "$TRAVIS_BUILD_DIR/stunnel-5.54"

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

after_success: npm run coveralls
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
<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>
<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>
<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>
<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>
<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>
<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>
</p>
Expand Down
45 changes: 0 additions & 45 deletions appveyor.yml

This file was deleted.

16 changes: 16 additions & 0 deletions test/node_redis.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,22 @@ var fork = require('child_process').fork;
var redis = config.redis;
var client;

// Currently Travis Windows builds hang after completing if any processes are still running,
// we shutdown redis-server after all tests complete (can't do this in a
// `after_script` Travis hook as it hangs before the `after` life cycles)
// to workaround the issue.
//
// See: https://github.com/travis-ci/travis-ci/issues/8082
after(function (done) {
if (process.platform !== 'win32' || !process.env.CI) {
return done();
}
process.nextTick(function () {
require('cross-spawn').sync('redis-server', ['--service-stop'], {});
done();
});
});

describe('The node_redis client', function () {

describe("The 'add_command' method", function () {
Expand Down

0 comments on commit 43bc8df

Please sign in to comment.