Skip to content

Commit b2c6c7e

Browse files
Danny McCormickphated
Danny McCormick
authored andcommitted
Build: Add Azure Pipelines CI (#2299)
1 parent ed27cbe commit b2c6c7e

File tree

4 files changed

+131
-5
lines changed

4 files changed

+131
-5
lines changed

.ci/.azure-pipelines-steps.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
steps:
2+
- script: npm i -g npm@$(npm_version)
3+
displayName: Use legacy npm version $(npm_version)
4+
condition: ne(variables['npm_version'], '')
5+
6+
- task: NodeTool@0
7+
inputs:
8+
versionSpec: '$(node_version)'
9+
displayName: Use Node $(node_version)
10+
11+
- script: npm install
12+
displayName: npm install
13+
14+
- script: npm test
15+
displayName: Run tests
16+
17+
- script: npm run coveralls
18+
displayName: Run coveralls
19+
env:
20+
# Pretend to be AppVeyor for now
21+
APPVEYOR: true
22+
APPVEYOR_BUILD_NUMBER: $(Build.BuildNumber)
23+
APPVEYOR_BUILD_ID: $(Agent.OS)_$(node_version)
24+
APPVEYOR_REPO_COMMIT: $(Build.SourceVersion)
25+
APPVEYOR_REPO_BRANCH: $(Build.SourceBranchName)
26+
# Overwrite the GitLab Service Name
27+
COVERALLS_SERVICE_NAME: Azure Pipelines
28+
COVERALLS_REPO_TOKEN: $(COVERALLS_REPO_TOKEN_SECRET)
29+
COVERALLS_PARALLEL: true
30+
CI_PULL_REQUEST: $(System.PullRequest.PullRequestNumber)
31+
32+
- script: npm run azure-pipelines
33+
displayName: Write tests to xml
34+
35+
- task: PublishTestResults@2
36+
inputs:
37+
testResultsFiles: '**/test.xunit'
38+
condition: succeededOrFailed()

.ci/.azure-pipelines.yml

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
trigger:
2+
- master
3+
- releases/*
4+
5+
jobs:
6+
- job: Test_Linux
7+
displayName: Run Tests on Linux
8+
pool:
9+
vmImage: "Ubuntu 16.04"
10+
strategy:
11+
matrix:
12+
Node_v10:
13+
node_version: 10
14+
Node_v8:
15+
node_version: 8
16+
Node_v6:
17+
node_version: 6
18+
Node_v4:
19+
node_version: 4
20+
Node_v0_12:
21+
node_version: 0.12
22+
Node_v0_10:
23+
node_version: 0.10
24+
steps:
25+
- template: .azure-pipelines-steps.yml
26+
27+
- job: Test_Windows
28+
displayName: Run Tests on Windows
29+
pool:
30+
vmImage: vs2017-win2016
31+
strategy:
32+
matrix:
33+
Node_v10:
34+
node_version: 10
35+
Node_v8:
36+
node_version: 8
37+
Node_v6:
38+
node_version: 6
39+
Node_v4:
40+
node_version: 4
41+
npm_version: 2
42+
Node_v0_12:
43+
node_version: 0.12
44+
npm_version: 2
45+
Node_v0_10:
46+
node_version: 0.10
47+
npm_version: 2
48+
steps:
49+
- template: .azure-pipelines-steps.yml
50+
51+
- job: Test_MacOS
52+
displayName: Run Tests on MacOS
53+
pool:
54+
vmImage: macos-10.13
55+
strategy:
56+
matrix:
57+
Node_v10:
58+
node_version: 10
59+
Node_v8:
60+
node_version: 8
61+
Node_v6:
62+
node_version: 6
63+
Node_v4:
64+
node_version: 4
65+
Node_v0_12:
66+
node_version: 0.12
67+
Node_v0_10:
68+
node_version: 0.10
69+
steps:
70+
- template: .azure-pipelines-steps.yml
71+
72+
- job: Notify_Coveralls
73+
displayName: Notify Coveralls that the parallel report is done
74+
pool:
75+
vmImage: "Ubuntu 16.04"
76+
dependsOn:
77+
- Test_Linux
78+
- Test_Windows
79+
- Test_MacOS
80+
steps:
81+
- script: curl -k https://coveralls.io/webhook?repo_token=$COVERALLS_REPO_TOKEN -d "payload[build_num]=$BUILD_NAME&payload[status]=done"
82+
env:
83+
COVERALLS_REPO_TOKEN: $(COVERALLS_REPO_TOKEN_SECRET)
84+
BUILD_NAME: $(Build.BuildNumber)

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ lib-cov
1212

1313
# Coverage directory used by tools like istanbul
1414
coverage
15+
.nyc_output
1516

1617
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
1718
.grunt
@@ -29,3 +30,6 @@ node_modules
2930

3031
# Garbage files
3132
.DS_Store
33+
34+
# Test results
35+
test.xunit

package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
"scripts": {
2626
"lint": "eslint .",
2727
"pretest": "npm run lint",
28-
"test": "mocha --async-only",
29-
"cover": "istanbul cover _mocha --report lcovonly",
30-
"coveralls": "npm run cover && istanbul-coveralls"
28+
"test": "nyc mocha --async-only",
29+
"azure-pipelines": "nyc mocha --async-only --reporter xunit -O output=test.xunit",
30+
"coveralls": "nyc report --reporter=text-lcov | coveralls"
3131
},
3232
"dependencies": {
3333
"glob-watcher": "^5.0.0",
@@ -36,13 +36,13 @@
3636
"vinyl-fs": "^3.0.0"
3737
},
3838
"devDependencies": {
39+
"coveralls": "github:phated/node-coveralls#2.x",
3940
"eslint": "^2.13.1",
4041
"eslint-config-gulp": "^3.0.1",
4142
"expect": "^1.20.2",
42-
"istanbul": "^0.4.3",
43-
"istanbul-coveralls": "^1.0.3",
4443
"mkdirp": "^0.5.1",
4544
"mocha": "^3.0.0",
45+
"nyc": "^10.3.2",
4646
"rimraf": "^2.2.5"
4747
},
4848
"keywords": [

0 commit comments

Comments
 (0)