diff --git a/azure-pipelines-steps-node.yml b/azure-pipelines-steps-node.yml new file mode 100644 index 000000000..8e2591383 --- /dev/null +++ b/azure-pipelines-steps-node.yml @@ -0,0 +1,16 @@ +parameters: +- name: nodeVersion + type: string + +steps: + # npm install + - task: Npm@1 + displayName: (azure-pipelines-task-lib) npm install + inputs: + command: install + workingDir: node + + - task: NodeTool@0 + displayName: (azure-pipelines-task-lib) use node ${{parameters.nodeVersion}} + inputs: + versionSpec: ${{parameters.nodeVersion}} diff --git a/azure-pipelines-steps-test-build.yml b/azure-pipelines-steps-test-build.yml new file mode 100644 index 000000000..38ca9e3e9 --- /dev/null +++ b/azure-pipelines-steps-test-build.yml @@ -0,0 +1,10 @@ +steps: + # test + - script: node make.js test + workingDirectory: node + displayName: (azure-pipelines-task-lib) node make.js test + + # build + - script: node make.js build + displayName: (azure-pipelines-task-lib) node make.js build + workingDirectory: node diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 40296671f..2c430a0ce 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -3,6 +3,9 @@ trigger: - features/* - releases/* +variables: + nodeVersion: 16.13.0 + jobs: ################################################# - job: windows @@ -16,31 +19,22 @@ jobs: # azure-pipelines-task-lib ################################################################################ - # npm install - - task: Npm@1 - displayName: (azure-pipelines-task-lib) npm install - inputs: - command: install - workingDir: node + - template: azure-pipelines-steps-node.yml + parameters: + nodeVersion: $(nodeVersion) - # use node 16.13.0 - - task: NodeTool@0 - displayName: (azure-pipelines-task-lib) use node 16.13.0 - inputs: - versionSpec: "16.13.0" - - # build/test + # test - script: | chcp 437 node make.js test workingDirectory: node displayName: (azure-pipelines-task-lib) node make.js test - # build/test + # build - script: | chcp 437 - node make.js test - displayName: (azure-pipelines-task-lib) node make.js test + node make.js build + displayName: (azure-pipelines-task-lib) node make.js build workingDirectory: node ################################################################################ @@ -66,33 +60,17 @@ jobs: pool: vmImage: ubuntu-18.04 - steps: - ################################################################################ - # azure-pipelines-task-lib - ################################################################################ - - # npm install - - task: Npm@1 - displayName: (azure-pipelines-task-lib) npm install - inputs: - command: install - workingDir: node + steps: + - template: azure-pipelines-steps-node.yml + parameters: + nodeVersion: $(nodeVersion) + - template: azure-pipelines-steps-test-build.yml - # use node 16.13.0 - - task: NodeTool@0 - displayName: (azure-pipelines-task-lib) use node 16.13.0 + - task: PublishPipelineArtifact@1 inputs: - versionSpec: "16.13.0" - - # build/test - - script: node make.js test - workingDirectory: node - displayName: (azure-pipelines-task-lib) node make.js test - - # build/test - - script: node make.js test - displayName: (azure-pipelines-task-lib) node make.js test - workingDirectory: node + targetPath: 'node/_build' + artifactType: 'pipeline' + artifactName: 'npm-package' # For CI runs on master, automatically publish packages - bash: | @@ -113,29 +91,7 @@ jobs: vmImage: macOS-10.15 steps: - ################################################################################ - # azure-pipelines-task-lib - ################################################################################ - - # npm install - - task: Npm@1 - displayName: (azure-pipelines-task-lib) npm install - inputs: - command: install - workingDir: node - - # use node 16.13.0 - - task: NodeTool@0 - displayName: (azure-pipelines-task-lib) use node 16.13.0 - inputs: - versionSpec: "16.13.0" - - # build/test - - script: node make.js test - workingDirectory: node - displayName: (azure-pipelines-task-lib) node make.js test - - # build/test - - script: node make.js test - displayName: (azure-pipelines-task-lib) node make.js test - workingDirectory: node + - template: azure-pipelines-steps-node.yml + parameters: + nodeVersion: $(nodeVersion) + - template: azure-pipelines-steps-test-build.yml