Skip to content

Commit

Permalink
⚒ improve azure-pipelines.yml (#173)
Browse files Browse the repository at this point in the history
  • Loading branch information
mysticatea committed Jun 20, 2019
1 parent a85d541 commit b757c3e
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 82 deletions.
16 changes: 16 additions & 0 deletions .azure-pipelines/lint-job.yml
@@ -0,0 +1,16 @@
jobs:
- job: lint
displayName: Lint
pool:
vmImage: Ubuntu-16.04
steps:
- task: NodeTool@0
displayName: Install Node.js
inputs:
versionSpec: 12.x

- script: npm install
displayName: Install Packages

- script: npm run -s lint
displayName: Lint
34 changes: 34 additions & 0 deletions .azure-pipelines/test-job.yml
@@ -0,0 +1,34 @@
parameters:
name: ""
displayName: ""
vmImage: ""
nodeVersion: ""
eslintVersion: ""

jobs:
- job: ${{parameters.name}}
displayName: ${{parameters.displayName}}
pool:
vmImage: ${{parameters.vmImage}}
steps:
- task: NodeTool@0
displayName: Install Node.js
inputs:
versionSpec: ${{parameters.nodeVersion}}

- script: npm install && npm install --no-save async
displayName: Install Packages

- script: |
# We need to execute this command twice because of npm's bug.
# See also: https://npm.community/t/error-node-modules-staging-eslint-e7cf6846-node-modules-eslint
npm install --no-save eslint@${{parameters.eslintVersion}}
npm install --no-save eslint@${{parameters.eslintVersion}}
displayName: Install Specific ESLint
condition: ne('${{parameters.eslintVersion}}', '')
- script: npm run -s test:ci
displayName: Test

- script: npm run -s codecov -- -t $(CODECOV_TOKEN)
displayName: Send Coverage
120 changes: 39 additions & 81 deletions azure-pipelines.yml
Expand Up @@ -2,89 +2,47 @@ trigger:
- master

jobs:
- job: lint
displayName: Lint code
pool:
- template: .azure-pipelines/lint-job.yml

- template: .azure-pipelines/test-job.yml
parameters:
name: test_on_linux_node12_eslint5
displayName: Test on Node 12, ESLint 5, Linux
vmImage: Ubuntu-16.04
steps:
- task: NodeTool@0
displayName: Install Node.js
inputs:
versionSpec: 12.x
- script: npm install
displayName: Install Packages
- script: npm run -s lint
displayName: Lint code
nodeVersion: 12.x

- job: tests_on_linux
displayName: Test on Linux
pool:
vmImage: 'Ubuntu-16.04'
strategy:
matrix:
"Node.js v12":
node_version: 12.x
"Node.js v10":
node_version: 10.x
"Node.js v8.10.0":
node_version: "8.10.0"
steps:
- task: NodeTool@0
displayName: Install Node.js
inputs:
versionSpec: $(node_version)
- script: npm install && npm install --no-save async
displayName: Install Packages
- script: npm test
displayName: Test
- script: npm run -s codecov -- -t $(CODECOV_TOKEN)
displayName: Send Coverage
- template: .azure-pipelines/test-job.yml
parameters:
name: test_on_linux_node10_eslint5
displayName: Test on Node 10, ESLint 5, Linux
vmImage: Ubuntu-16.04
nodeVersion: 10.x

- job: tests_on_linux_with_eslint6
displayName: Test ESLint 6 on Linux
pool:
vmImage: 'Ubuntu-16.04'
steps:
- task: NodeTool@0
displayName: Install Node.js
inputs:
versionSpec: 12.x
# It needs twice due to npm's bug: https://npm.community/t/error-node-modules-staging-eslint-e7cf6846-node-modules-eslint
- 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
displayName: Install Packages
- script: npm test
displayName: Test
- script: npm run -s codecov -- -t $(CODECOV_TOKEN)
displayName: Send Coverage
- template: .azure-pipelines/test-job.yml
parameters:
name: test_on_linux_node8_eslint5
displayName: Test on Node 8, ESLint 5, Linux
vmImage: Ubuntu-16.04
nodeVersion: 8.x

- template: .azure-pipelines/test-job.yml
parameters:
name: test_on_linux_node12_eslint6rc
displayName: Test on Node 12, ESLint 6 RC, Linux
vmImage: Ubuntu-16.04
nodeVersion: 12.x
eslintVersion: ^6.0.0-rc.0

- job: tests_on_windows
displayName: Test on Windows
pool:
vmImage: 'Windows-2019'
steps:
- task: NodeTool@0
displayName: Install Node.js
inputs:
versionSpec: 12.x
- script: npm install && npm install --no-save async
displayName: Install Packages
- script: npm test
displayName: Test
- script: npm run -s codecov -- -t $(CODECOV_TOKEN)
displayName: Send Coverage
- template: .azure-pipelines/test-job.yml
parameters:
name: test_on_windows_node12_eslint5
displayName: Test on Node 12, ESLint 5, Windows
vmImage: Windows-2019
nodeVersion: 12.x

- job: tests_on_macos
displayName: Test on macOS
pool:
vmImage: 'macOS-10.14'
steps:
- task: NodeTool@0
displayName: Install Node.js
inputs:
versionSpec: 12.x
- script: npm install && npm install --no-save async
displayName: Install Packages
- script: npm test
displayName: Test
- script: npm run -s codecov -- -t $(CODECOV_TOKEN)
displayName: Send Coverage
- template: .azure-pipelines/test-job.yml
parameters:
name: test_on_macos_node12_eslint5
displayName: Test on Node 12, ESLint 5, macOS
vmImage: macOS-10.14
nodeVersion: 12.x
4 changes: 3 additions & 1 deletion package.json
Expand Up @@ -36,10 +36,12 @@
"scripts": {
"build": "node scripts/update.js",
"clean": "rimraf .nyc_output coverage",
"codecov": "codecov --disable=gcov",
"codecov": "nyc report --reporter text-lcov | codecov --pipe --disable=gcov",
"coverage": "opener ./coverage/lcov-report/index.html",
"lint": "eslint lib scripts tests/lib .eslintrc.js",
"pretest": "npm run -s lint",
"test": "nyc npm run -s test:_mocha",
"test:ci": "nyc npm run -s test:_mocha",
"test:_mocha": "_mocha \"tests/lib/**/*.js\" --reporter progress",
"preversion": "npm t && npm run -s build",
"version": "eslint lib/rules --fix && git add lib/rules",
Expand Down

0 comments on commit b757c3e

Please sign in to comment.