Skip to content

Commit b757c3e

Browse files
authored
⚒ improve azure-pipelines.yml (#173)
1 parent a85d541 commit b757c3e

File tree

4 files changed

+92
-82
lines changed

4 files changed

+92
-82
lines changed

.azure-pipelines/lint-job.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
jobs:
2+
- job: lint
3+
displayName: Lint
4+
pool:
5+
vmImage: Ubuntu-16.04
6+
steps:
7+
- task: NodeTool@0
8+
displayName: Install Node.js
9+
inputs:
10+
versionSpec: 12.x
11+
12+
- script: npm install
13+
displayName: Install Packages
14+
15+
- script: npm run -s lint
16+
displayName: Lint

.azure-pipelines/test-job.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
parameters:
2+
name: ""
3+
displayName: ""
4+
vmImage: ""
5+
nodeVersion: ""
6+
eslintVersion: ""
7+
8+
jobs:
9+
- job: ${{parameters.name}}
10+
displayName: ${{parameters.displayName}}
11+
pool:
12+
vmImage: ${{parameters.vmImage}}
13+
steps:
14+
- task: NodeTool@0
15+
displayName: Install Node.js
16+
inputs:
17+
versionSpec: ${{parameters.nodeVersion}}
18+
19+
- script: npm install && npm install --no-save async
20+
displayName: Install Packages
21+
22+
- script: |
23+
# We need to execute this command twice because of npm's bug.
24+
# See also: https://npm.community/t/error-node-modules-staging-eslint-e7cf6846-node-modules-eslint
25+
npm install --no-save eslint@${{parameters.eslintVersion}}
26+
npm install --no-save eslint@${{parameters.eslintVersion}}
27+
displayName: Install Specific ESLint
28+
condition: ne('${{parameters.eslintVersion}}', '')
29+
30+
- script: npm run -s test:ci
31+
displayName: Test
32+
33+
- script: npm run -s codecov -- -t $(CODECOV_TOKEN)
34+
displayName: Send Coverage

azure-pipelines.yml

Lines changed: 39 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -2,89 +2,47 @@ trigger:
22
- master
33

44
jobs:
5-
- job: lint
6-
displayName: Lint code
7-
pool:
5+
- template: .azure-pipelines/lint-job.yml
6+
7+
- template: .azure-pipelines/test-job.yml
8+
parameters:
9+
name: test_on_linux_node12_eslint5
10+
displayName: Test on Node 12, ESLint 5, Linux
811
vmImage: Ubuntu-16.04
9-
steps:
10-
- task: NodeTool@0
11-
displayName: Install Node.js
12-
inputs:
13-
versionSpec: 12.x
14-
- script: npm install
15-
displayName: Install Packages
16-
- script: npm run -s lint
17-
displayName: Lint code
12+
nodeVersion: 12.x
1813

19-
- job: tests_on_linux
20-
displayName: Test on Linux
21-
pool:
22-
vmImage: 'Ubuntu-16.04'
23-
strategy:
24-
matrix:
25-
"Node.js v12":
26-
node_version: 12.x
27-
"Node.js v10":
28-
node_version: 10.x
29-
"Node.js v8.10.0":
30-
node_version: "8.10.0"
31-
steps:
32-
- task: NodeTool@0
33-
displayName: Install Node.js
34-
inputs:
35-
versionSpec: $(node_version)
36-
- script: npm install && npm install --no-save async
37-
displayName: Install Packages
38-
- script: npm test
39-
displayName: Test
40-
- script: npm run -s codecov -- -t $(CODECOV_TOKEN)
41-
displayName: Send Coverage
14+
- template: .azure-pipelines/test-job.yml
15+
parameters:
16+
name: test_on_linux_node10_eslint5
17+
displayName: Test on Node 10, ESLint 5, Linux
18+
vmImage: Ubuntu-16.04
19+
nodeVersion: 10.x
4220

43-
- job: tests_on_linux_with_eslint6
44-
displayName: Test ESLint 6 on Linux
45-
pool:
46-
vmImage: 'Ubuntu-16.04'
47-
steps:
48-
- task: NodeTool@0
49-
displayName: Install Node.js
50-
inputs:
51-
versionSpec: 12.x
52-
# It needs twice due to npm's bug: https://npm.community/t/error-node-modules-staging-eslint-e7cf6846-node-modules-eslint
53-
- script: npm install && npm install --no-save async eslint@^6.0.0-rc.0 && npm install --no-save async eslint@^6.0.0-rc.0
54-
displayName: Install Packages
55-
- script: npm test
56-
displayName: Test
57-
- script: npm run -s codecov -- -t $(CODECOV_TOKEN)
58-
displayName: Send Coverage
21+
- template: .azure-pipelines/test-job.yml
22+
parameters:
23+
name: test_on_linux_node8_eslint5
24+
displayName: Test on Node 8, ESLint 5, Linux
25+
vmImage: Ubuntu-16.04
26+
nodeVersion: 8.x
27+
28+
- template: .azure-pipelines/test-job.yml
29+
parameters:
30+
name: test_on_linux_node12_eslint6rc
31+
displayName: Test on Node 12, ESLint 6 RC, Linux
32+
vmImage: Ubuntu-16.04
33+
nodeVersion: 12.x
34+
eslintVersion: ^6.0.0-rc.0
5935

60-
- job: tests_on_windows
61-
displayName: Test on Windows
62-
pool:
63-
vmImage: 'Windows-2019'
64-
steps:
65-
- task: NodeTool@0
66-
displayName: Install Node.js
67-
inputs:
68-
versionSpec: 12.x
69-
- script: npm install && npm install --no-save async
70-
displayName: Install Packages
71-
- script: npm test
72-
displayName: Test
73-
- script: npm run -s codecov -- -t $(CODECOV_TOKEN)
74-
displayName: Send Coverage
36+
- template: .azure-pipelines/test-job.yml
37+
parameters:
38+
name: test_on_windows_node12_eslint5
39+
displayName: Test on Node 12, ESLint 5, Windows
40+
vmImage: Windows-2019
41+
nodeVersion: 12.x
7542

76-
- job: tests_on_macos
77-
displayName: Test on macOS
78-
pool:
79-
vmImage: 'macOS-10.14'
80-
steps:
81-
- task: NodeTool@0
82-
displayName: Install Node.js
83-
inputs:
84-
versionSpec: 12.x
85-
- script: npm install && npm install --no-save async
86-
displayName: Install Packages
87-
- script: npm test
88-
displayName: Test
89-
- script: npm run -s codecov -- -t $(CODECOV_TOKEN)
90-
displayName: Send Coverage
43+
- template: .azure-pipelines/test-job.yml
44+
parameters:
45+
name: test_on_macos_node12_eslint5
46+
displayName: Test on Node 12, ESLint 5, macOS
47+
vmImage: macOS-10.14
48+
nodeVersion: 12.x

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,12 @@
3636
"scripts": {
3737
"build": "node scripts/update.js",
3838
"clean": "rimraf .nyc_output coverage",
39-
"codecov": "codecov --disable=gcov",
39+
"codecov": "nyc report --reporter text-lcov | codecov --pipe --disable=gcov",
4040
"coverage": "opener ./coverage/lcov-report/index.html",
4141
"lint": "eslint lib scripts tests/lib .eslintrc.js",
42+
"pretest": "npm run -s lint",
4243
"test": "nyc npm run -s test:_mocha",
44+
"test:ci": "nyc npm run -s test:_mocha",
4345
"test:_mocha": "_mocha \"tests/lib/**/*.js\" --reporter progress",
4446
"preversion": "npm t && npm run -s build",
4547
"version": "eslint lib/rules --fix && git add lib/rules",

0 commit comments

Comments
 (0)