diff --git a/azure-pipelines-steps-node.yml b/azure-pipelines-steps-node.yml index a7444bfb8..c63eeae42 100644 --- a/azure-pipelines-steps-node.yml +++ b/azure-pipelines-steps-node.yml @@ -1,16 +1,49 @@ parameters: -- name: nodeVersion +- name: os type: string steps: - # npm install -- task: Npm@1 - displayName: npm install - inputs: - command: install - workingDir: node - - task: NodeTool@0 - displayName: use node ${{parameters.nodeVersion}} + displayName: use node $(nodeVersion) inputs: - versionSpec: ${{parameters.nodeVersion}} + versionSpec: $(nodeVersion) + +- script: npm ci + displayName: (task-lib) npm ci + workingDirectory: node + +- script: npm test + workingDirectory: node + displayName: (task-lib) npm test + +# Only on Linux. For CI runs on master, automatically publish packages +- ${{ if eq(parameters.os, 'Linux') }}: + - bash: | + echo //registry.npmjs.org/:_authToken=\${NPM_TOKEN} > .npmrc + npm publish || true # Ignore publish failures, usually will happen because package already exists + displayName: (task-lib) npm publish + workingDirectory: node/_build + condition: and(succeeded(), in(variables['build.reason'], 'IndividualCI', 'BatchedCI', 'Manual'), in(variables['build.sourcebranch'], 'refs/heads/master')) + env: + NPM_TOKEN: $(npm-automation.token) + + # PublishPipelineArtifact step is configured in the base template. + # See the templateContext section in the azure-pipelines.yml file + +# Only on Windows. Build VstsTaskSdk for powershell +- ${{ if eq(parameters.os, 'Windows_NT') }}: + # Build step for .NET source code. This is needed to enable CodeQL for C# code + - task: DotNetCoreCLI@2 + displayName: 'Build .NET project(s)' + inputs: + command: build + projects: 'powershell/CompiledHelpers/VstsTaskSdk.csproj' + arguments: '--configuration Release' + + - script: npm ci + displayName: (VstsTaskSdk) npm ci + workingDirectory: powershell + + - script: npm test + displayName: (VstsTaskSdk) npm test + workingDirectory: powershell diff --git a/azure-pipelines-steps-test-build.yml b/azure-pipelines-steps-test-build.yml deleted file mode 100644 index 0789bb88a..000000000 --- a/azure-pipelines-steps-test-build.yml +++ /dev/null @@ -1,10 +0,0 @@ -steps: - # test -- script: node make.js test - workingDirectory: node - displayName: node make.js test - - # build -- script: node make.js build - displayName: node make.js build - workingDirectory: node diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 02c0bea8c..5e87603a9 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -7,9 +7,9 @@ trigger: - releases/* variables: - - group: npm-tokens - - name: nodeVersion - value: '16.13.0' +- group: npm-tokens +- name: nodeVersion + value: '16.13.0' resources: repositories: @@ -38,7 +38,6 @@ extends: ################################################# - job: windows ################################################# - displayName: windows pool: name: 1ES-ABTT-Shared-Pool image: abtt-windows-2022 @@ -46,20 +45,11 @@ extends: steps: - template: /azure-pipelines-steps-node.yml@self parameters: - nodeVersion: $(nodeVersion) - - template: /azure-pipelines-steps-test-build.yml@self - - - task: DotNetCoreCLI@2 - displayName: 'Build .NET project(s)' - inputs: - command: build - projects: '**/*.csproj' - arguments: '--configuration Release' + os: Windows_NT ################################################# - job: linux ################################################# - displayName: Linux pool: name: 1ES-ABTT-Shared-Pool image: abtt-ubuntu-2204 @@ -73,22 +63,11 @@ extends: steps: - template: /azure-pipelines-steps-node.yml@self parameters: - nodeVersion: $(nodeVersion) - - template: /azure-pipelines-steps-test-build.yml@self - # For CI runs on master, automatically publish packages - - bash: | - echo //registry.npmjs.org/:_authToken=\${NPM_TOKEN} > .npmrc - npm publish || true # Ignore publish failures, usually will happen because package already exists - displayName: npm publish - workingDirectory: node/_build - condition: and(succeeded(), in(variables['build.reason'], 'IndividualCI', 'BatchedCI', 'Manual'), in(variables['build.sourcebranch'], 'refs/heads/master')) - env: - NPM_TOKEN: $(npm-automation.token) + os: Linux ################################################# - job: macOS ################################################# - displayName: macOS pool: name: Azure Pipelines image: macOS-latest @@ -96,6 +75,4 @@ extends: steps: - template: /azure-pipelines-steps-node.yml@self parameters: - nodeVersion: $(nodeVersion) - - - template: /azure-pipelines-steps-test-build.yml@self + os: Darwin \ No newline at end of file