117 строки
4.4 KiB
YAML
117 строки
4.4 KiB
YAML
# Node.js
|
|
# Build a general Node.js project with npm.
|
|
# Add steps that analyze code, save build artifacts, deploy, and more:
|
|
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
|
|
|
|
trigger:
|
|
- master
|
|
|
|
jobs:
|
|
- job: Emulator
|
|
pool:
|
|
vmImage: windows-2019
|
|
steps:
|
|
- powershell: |
|
|
$localEtag = ""
|
|
try {
|
|
$localEtag = Get-Content "$env:ProgramFiles\Azure Cosmos DB Emulator\etag.txt"
|
|
}
|
|
catch {}
|
|
Write-Host "Local emulator etag $localEtag"
|
|
$headResponse = Invoke-WebRequest 'https://aka.ms/cosmosdb-emulator' -Method 'HEAD'
|
|
Write-Host $headResponse.headers
|
|
$remoteEtag = $headResponse.headers.ETag
|
|
Write-Host "Remote emulator etag $remoteEtag"
|
|
if($localEtag -ne $remoteEtag){
|
|
Write-Host "Emulator is out of date"
|
|
Write-Host "Downloading Cosmos Emulator"
|
|
wget "https://aka.ms/cosmosdb-emulator" -outfile "$env:temp\azure-cosmosdb-emulator.msi"
|
|
Write-Host "Finished Downloading Cosmos Emulator - $env:temp\azure-cosmosdb-emulator.msi"
|
|
dir "$env:temp"
|
|
Write-Host "Deleting Azure Cosmos DB Emulator directory"
|
|
dir "$env:ProgramFiles\"
|
|
rm "$env:ProgramFiles\Azure Cosmos DB Emulator" -Recurse -Force
|
|
Write-Host "Directory after deleting"
|
|
dir "$env:ProgramFiles\"
|
|
choco install lessmsi
|
|
choco upgrade lessmsi
|
|
Write-Host "Checking directory"
|
|
dir "$env:ProgramFiles"
|
|
mkdir "$env:ProgramFiles\Azure Cosmos DB Emulator"
|
|
lessmsi x "$env:temp\azure-cosmosdb-emulator.msi" "$env:ProgramFiles\Azure Cosmos DB Emulator\"
|
|
Set-Content -Path "$env:ProgramFiles\Azure Cosmos DB Emulator\etag.txt" -Value $remoteEtag
|
|
dir "$env:ProgramFiles\Azure Cosmos DB Emulator"
|
|
Get-Content "$env:ProgramFiles\Azure Cosmos DB Emulator\etag.txt" | Write-Host
|
|
} else {
|
|
Write-Host "Emulator is already up to date"
|
|
}
|
|
|
|
Write-Host "Starting Comsos DB Emulator"
|
|
Start-Process "$env:ProgramFiles\Azure Cosmos DB Emulator\SourceDir\Azure Cosmos DB Emulator\CosmosDB.Emulator.exe" "/NoExplorer /NoUI" -Verb RunAs
|
|
displayName: "Refresh and Run Public Cosmos DB Emulator"
|
|
- task: NodeTool@0
|
|
inputs:
|
|
versionSpec: "8.x"
|
|
displayName: "Install Node.js"
|
|
|
|
- script: npm install -g npm@6.11.1
|
|
displayName: (fix)bump to npm@6.11.1
|
|
|
|
- script: npm install
|
|
displayName: "npm install"
|
|
|
|
- script: npm run build
|
|
displayName: "npm run build"
|
|
|
|
- bash: npm run test -- --forbid-only --reporter mocha-junit-reporter
|
|
displayName: "npm test"
|
|
env:
|
|
MOCHA_TIMEOUT: 100000
|
|
- task: PublishTestResults@2
|
|
condition: succeededOrFailed()
|
|
inputs:
|
|
testRunner: JUnit
|
|
testResultsFiles: '**/test-results.xml'
|
|
- bash: npm run test-consumer
|
|
displayName: "TypeScript consumer tests"
|
|
|
|
- bash: npm run compile:samples
|
|
displayName: "Typecheck Samples"
|
|
|
|
- bash: |
|
|
npm run UserManagement --prefix ./samples
|
|
npm run ItemManagement --prefix ./samples
|
|
npm run DatabaseManagement --prefix ./samples
|
|
npm run ContainerManagement --prefix ./samples
|
|
npm run ServerSideScripts --prefix ./samples
|
|
npm run ChangeFeed --prefix ./samples
|
|
npm run BulkUpdateWithSproc --prefix ./samples
|
|
displayName: "Run Samples"
|
|
# - job: NightlyEmulator
|
|
# pool:
|
|
# vmImage: vs2017-win2016
|
|
# steps:
|
|
# - task: azure-cosmosdb.emulator-internal-preview.run-cosmosdbemulatorcontainer.CosmosDbEmulator@2
|
|
# displayName: "Run Azure Cosmos DB Emulator container"
|
|
# inputs:
|
|
# username: "$(cosmosdb.azurecr.io.Username)"
|
|
# password: "$(cosmosdb.azurecr.io.Password)"
|
|
# defaultPartitionCount: 25
|
|
# - task: NodeTool@0
|
|
# inputs:
|
|
# versionSpec: "8.x"
|
|
# displayName: "Install Node.js"
|
|
|
|
# - script: npm install
|
|
# displayName: "npm install"
|
|
|
|
# - script: npm run build
|
|
# displayName: "npm run build"
|
|
|
|
# - bash: ACCOUNT_HOST=$COSMOSDBEMULATOR_ENDPOINT NODE_TLS_REJECT_UNAUTHORIZED="0" npm run test
|
|
# failOnStderr: true
|
|
# continueOnError: true
|
|
# displayName: "npm test"
|
|
# env:
|
|
# MOCHA_TIMEOUT: 100000
|