Skip to content
This repository was archived by the owner on May 5, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .azure-pipelines/client.test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
parameters:
name: ''
vmImage: ''

jobs:
- job: ${{ format('Test_{0}', parameters.name) }}
dependsOn:
- 'Publish'

pool:
vmImage: ${{ parameters.vmImage }}

variables:
build.path: 'test/services/keyVault'

strategy:
matrix:
Node6:
node.version: '6.x'
Node8:
node.version: '8.x'
Node10:
node.version: '10.x'
Node11:
node.version: '11.x'

steps:
- task: NodeTool@0
inputs:
versionSpec: '$(node.version)'
displayName: 'Install Node.js $(node.version)'

- task: Npm@1
inputs:
command: 'install'
displayName: 'npm install'

- task: Npm@1
inputs:
command: 'custom'
customCommand: 'run mocha -- $(build.path) --reporter mocha-junit-reporter'
displayName: 'npm run mocha'

- task: PublishTestResults@2
inputs:
testResultsFiles: '**/test-results.xml'
testRunTitle: ${{ format('{0} Node $(node.version)', parameters.name) }}
condition: succeededOrFailed()
displayName: 'Publish test results'
83 changes: 83 additions & 0 deletions .azure-pipelines/client.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
trigger:
- master

variables:
node.version: '10.x'
build.path: 'lib/services/keyVault'

jobs:
- job: 'Publish'

pool:
vmImage: 'ubuntu-16.04'

steps:
- task: NodeTool@0
inputs:
versionSpec: '$(node.version)'
displayName: 'Install Node.js $(node.version)'

- task: Npm@1
inputs:
command: 'install'
workingDir: '$(build.path)'
displayName: 'npm install'

- task: Npm@1
inputs:
command: 'custom'
customCommand: 'pack'
workingDir: '$(build.path)'
displayName: 'npm pack'

- task: CopyFiles@2
inputs:
sourceFolder: '$(build.path)'
contents: '*.tgz'
targetFolder: $(Build.ArtifactStagingDirectory)
displayName: 'Copy Package'

- task: PublishBuildArtifacts@1
displayName: 'Publish Package'

- job: 'Audit'

pool:
vmImage: 'ubuntu-16.04'

steps:
- task: NodeTool@0
inputs:
versionSpec: '$(node.version)'
displayName: 'Install Node.js $(node.version)'

- task: Npm@1
inputs:
command: 'custom'
customCommand: 'i --package-lock-only'
workingDir: '$(build.path)'
displayName: 'npm i --package-lock-only'

- powershell: "npm audit --json | ConvertFrom-Json | Select-Object -expandProperty 'metadata' | select-object -expandproperty 'vulnerabilities' | %{ if ($_.low + $_.moderate + $_.high + $_.critical -ne 0) { write-error 'FAILED! Your package has vulnerabilities. Check npm audit' }}"
workingDirectory: '$(build.path)'
displayName: 'npm audit'

- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
condition: succeededOrFailed()
displayName: 'Component Detection'

- template: client.test.yml
parameters:
name: Linux
vmImage: 'ubuntu-16.04'

- template: client.test.yml
parameters:
name: macOS
vmImage: 'macOS-10.13'

- template: client.test.yml
parameters:
name: Windows
vmImage: 'vs2017-win2016'

8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,10 @@ packages

# Coverage report
coverage
.nyc_output
.nyc_output

# Output of 'npm pack'
*.tgz

# Test Results
test-results.xml
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@
"json-stable-stringify": "^1.0.1",
"minami": "devigned/minami#master",
"mocha": "^5.2.0",
"mocha-junit-reporter": "^1.18.0",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Required for pipeline to publish test results

"nock": "0.16",
"node-forge": "0.6.30",
"nyc": "^11.2.1",
Expand Down Expand Up @@ -168,6 +169,7 @@
"ci": "node scripts/unit.js testlist.txt",
"runtime-install": "node scripts/runtime-install.js",
"coverage": "node scripts/unit-coverage.js testlistarm.txt testlist.txt",
"debug": "node --inspect scripts/unit-arm.js testlistarm.txt"
"debug": "node --inspect scripts/unit-arm.js testlistarm.txt",
"mocha": "mocha"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this script so the pipeline can call "npm run mocha" with options to run a subset of tests.

}
}