Skip to content

Commit

Permalink
use strategy matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniilShmelev committed Mar 2, 2022
1 parent 3d6018a commit 81c3529
Showing 1 changed file with 37 additions and 41 deletions.
78 changes: 37 additions & 41 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,42 @@
pool:
vmImage: ubuntu-20.04
vmImage: ubuntu-18.04

parameters:
- name: versionSpec
type: object
default:
- '6.x'
- '8.x'
- '10.x'
- '12.x'
- '14.x'
strategy:
matrix:
'Node 6':
versionSpec: '6.x'
'Node 8':
versionSpec: '8.x'
'Node 10':
versionSpec: '10.x'
'Node 12':
versionSpec: '12.x'
'Node 14':
versionSpec: '14.x'

jobs:
- job: build_test_and_publish
displayName: Build, test and publish
steps:
#build on node 8.x
- task: NodeTool@0
inputs:
versionSpec: '8.x'
displayName: Install node
steps:
- task: NodeTool@0
inputs:
versionSpec: $(versionSpec)
displayName: Install node

- script: npm install
displayName: npm install
- script: npm install
displayName: npm install

- script: npm run build
displayName: npm run build
#run unit tests on different node versions
- ${{ each version in parameters.versionSpec }}:
- task: NodeTool@0
inputs:
versionSpec: ${{ version }}
displayName: Install node
- script: npm run units
displayName: npm run units
- script: npm run test
displayName: npm run test
#publish if needed
- task: PublishBuildArtifacts@1
condition: and(succeeded(), in(variables['publishBuild'], 'true'))
inputs:
PathtoPublish: "_build"
ArtifactName: "drop"
ArtifactType: "Container"
displayName: Publish build artifacts
- script: npm run build
displayName: npm run build

- script: npm run units
displayName: npm run units

- script: npm run test
displayName: npm run test

#publish if needed
- task: PublishBuildArtifacts@1
condition: and(succeeded(), in(variables['publishBuild'], 'true'))
inputs:
PathtoPublish: "_build"
ArtifactName: "drop"
ArtifactType: "Container"
displayName: Publish build artifacts

0 comments on commit 81c3529

Please sign in to comment.