Skip to content

Commit 7910e4f

Browse files
committed
chore(tests): adds appveyor test config
We need to run our test suite against both windows and linux. In order to accomplish this we need this config so that when linux tests are done, the windows tests on appveyor are triggered. Unfortunately since we have to use travis encrypted environment variables, it will be a bit trickier for people to run the test suite locally since pull request tests will fail.
1 parent 4160696 commit 7910e4f

File tree

4 files changed

+73
-21
lines changed

4 files changed

+73
-21
lines changed

.travis.yml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,31 @@ sudo: false
22
language: node_js
33
cache:
44
directories:
5-
- node_modules
5+
- node_modules
66
branches:
7-
only:
8-
- master
7+
except:
8+
- /^v\d+\.\d+\.\d+$/
99
notifications:
1010
email: false
1111
node_js:
12-
- '4'
13-
- '0.12'
14-
- '0.10'
12+
- '4'
13+
- '0.12'
14+
- '0.10'
1515
before_install:
16-
# Prevent "tell me who you are" errors
17-
- git config --global user.name "TravisCI"
18-
- npm i -g npm@^2.0.0
16+
- git config --global user.name "TravisCI"
17+
- npm i -g npm@^2.0.0
1918
before_script:
20-
- npm prune
21-
- 'curl -Lo travis_after_all.py https://git.io/vLSON'
19+
- npm prune
20+
- curl -Lo travis_after_all.py https://git.io/vLSON
2221
script:
23-
- npm run test
24-
- npm run check-coverage
22+
- npm run test
23+
- npm run test:windows
24+
- npm run check-coverage
2525
after_success:
26-
- python travis_after_all.py
27-
- export $(cat .to_export_back)
28-
- npm run report-coverage
29-
- npm run semantic-release
30-
branches:
31-
except:
32-
- "/^v\\d+\\.\\d+\\.\\d+$/"
26+
- python travis_after_all.py
27+
- export $(cat .to_export_back)
28+
- npm run report-coverage
29+
- npm run semantic-release
30+
env:
31+
global:
32+
secure: OO4CoV+EKtMQjNWz4vsOAuV4AZHeBJnlr0VMHLI7YK5ay31p8k+40FVoO7tnWnmB7OSfxOQpu7Bpb3d1saru5Y8oBDsFrkhFvdyPiy8FslPk6YC9GjKVYLzS+YJtJsH88eDbRgTOtFHACchY1G3zSGyhQNIYqdKt35OP//41vYDs3P6JDgd/OFXF+rTFRvwmt+Btu2GZXPuFNI1naPaTTrWMsZ8msw3i51sXgpP1KIEssye6DYulOm5YwsYhmyyitjAORtbfWXYCrfjA7Fm5ZqtbR97r/+8r3iyZk4cZCakKPN6SAO1erpAATrvjDKFvgBhH67eAa1Qf1Uki4Cp2rwaDDdP9BEgldwlw/Lrsy29unybK94LWGZF0EGZfdvoFg678ujCumYvAJM3jOxRPJqj0vedcyfOs6KDQ9qfX3TwRhsqDy6AqlMzdQ6kyqlo75JaY1U/2iRPZe2dfOzUy2I6eLvUe/YzwPrbttlv/iqFHgQA0F2bbCwKSX8JmRIz5fmLFBlt8G0wdq+8dgKUZfFzb0nbtPGzEcCOOlVhCUxrTtLrH/w8og5O17NoiUuwaHCQSmSig/Xc8698+Ljla2nSNhN+Mm90PdYiadyHfy6+rOit7uaVN9MWCAkUEeicLRL2Rj5IOj5ItDNmDEWneLmNOQH1PB5154UBejCy868g=

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"semantic-release": "semantic-release pre && npm publish && semantic-release post",
1414
"start": "npm run test:watch",
1515
"test": "istanbul cover -x ./test _mocha -- -R spec test/tests/index.js --compilers js:babel/register",
16-
"test:watch": "nodemon -q --ignore test/.tmp/ --ignore test/artifacts/ --ignore coverage/ --exec \"npm run test\" --"
16+
"test:watch": "nodemon -q --ignore test/.tmp/ --ignore test/artifacts/ --ignore coverage/ --exec \"npm run test\" --",
17+
"test:windows": "node ./test/tools/trigger-appveyor-tests.js"
1718
},
1819
"config": {
1920
"commitizen": {
@@ -45,6 +46,7 @@
4546
"author": "Jim Cummins <[email protected]> (https://github.com/jimthedev)",
4647
"license": "MIT",
4748
"devDependencies": {
49+
"axios": "0.7.0",
4850
"chai": "3.4.1",
4951
"codecov.io": "0.1.6",
5052
"ghooks": "0.3.2",
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# export \
2+
# AV_ACCOUNTNAME=my_appveyor_username \
3+
# AV_PROJECTSLUG=cz-cli \
4+
# AV_BRANCH=master \
5+
# AV_TOKEN=my_appveyor_api_token
6+
7+
command="node trigger-appveyor-tests.js"
8+
9+
safeRunCommand() {
10+
"$@"
11+
12+
if [ $? != 0 ]; then
13+
printf "Error when executing command: '$1 $2'"
14+
exit $ERROR_CODE
15+
fi
16+
}
17+
safeRunCommand $command
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
var axios = require('axios');
2+
3+
axios({
4+
method: 'post',
5+
url: 'https://ci.appveyor.com/api/builds',
6+
headers: {
7+
'Content-type': 'application/json',
8+
'Authorization': 'Bearer ' + process.env.AV_TOKEN
9+
},
10+
data: {
11+
accountName: process.env.AV_ACCOUNTNAME,
12+
projectSlug: process.env.AV_PROJECTSLUG,
13+
branch: process.env.AV_BRANCH ? process.env.AV_BRANCH : process.env.TRAVIS_BRANCH
14+
}
15+
})
16+
.then(function(response){
17+
if(response.data && response.data.buildId && response.data.buildId>1)
18+
{
19+
console.log('Linux build complete. Windows build starting at: https://ci.appveyor.com/project/' + process.env.AV_ACCOUNTNAME + '/' + process.env.AV_PROJECTSLUG + '/build/' + response.data.version);
20+
} else {
21+
console.error(response);
22+
die();
23+
}
24+
})
25+
.catch(function(err) {
26+
console.error(err);
27+
die();
28+
});
29+
30+
function die() {
31+
console.error('\nERROR: I could not start the Windows test suite on AppVeyor.\n\nPlease ensure that you\'ve set the following environment variables: AV_ACCOUNTNAME, AV_BRANCH, AV_PROJECTSLUG and the following secure (encrypted) TravisCI environment variables: AV_BEARER. \n\nHint: Are you sure you\'ve regenerated the encrypted / secure environment variabes in the .travis.yml? The ones included by default in that file are the repo maintainers and will not work on your fork of this project.\n');
32+
process.exit(1);
33+
}

0 commit comments

Comments
 (0)