-
Notifications
You must be signed in to change notification settings - Fork 60
/
azure-pipelines.yml
116 lines (104 loc) · 4.43 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# 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