forked from Azure/azure-functions-nodejs-worker
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathe2e-nightly-cli-azure-pipelines.yml
103 lines (101 loc) · 3.67 KB
/
e2e-nightly-cli-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
variables: {
WORKER_VERSION: '1.2.0',
NODE_LOWER_LTS: '8.x',
NODE_HIGHER_LTS: '10.x'
}
name: $(WORKER_VERSION)-$(Date:yyyyMMdd)$(Rev:.r)
jobs:
- job: UnitTests
strategy:
matrix:
WINDOWS_NODE10:
IMAGE_TYPE: 'vs2017-win2016'
NODE_VERSION: $(NODE_HIGHER_LTS)
pool:
vmImage: $(IMAGE_TYPE)
steps:
- task: NodeTool@0
inputs:
versionSpec: $(NODE_VERSION)
displayName: 'Install Node.js for test'
- script: npm install
displayName: 'npm install'
- script: npm run build
displayName: 'npm run build'
- script: npm test
displayName: 'npm test'
- job: E2ETests
strategy:
maxParallel: 1
matrix:
NODE10:
NODE_VERSION: $(NODE_HIGHER_LTS)
pool:
vmImage: 'vs2017-win2016'
steps:
- task: NodeTool@0
inputs:
versionSpec: $(NODE_VERSION)
displayName: 'Install Node.js for test'
- script: npm install
displayName: 'npm install'
- script: npm run build
displayName: 'npm run build'
- powershell: |
.\setup-e2e-tests.ps1
displayName: 'setup tests'
- powershell: |
.\run-e2e-tests.ps1
env:
AzureWebJobsStorage: $(AzureWebJobsStorage)
AzureWebJobsEventHubSender: $(AzureWebJobsEventHubSender)
AzureWebJobsCosmosDBConnectionString: $(AzureWebJobsCosmosDBConnectionString)
FUNCTIONS_WORKER_RUNTIME: 'node'
languageWorkers:node:workerDirectory: $(System.DefaultWorkingDirectory)
- task: CopyFiles@2
inputs:
SourceFolder: '$(System.DefaultWorkingDirectory)/test/testResults'
Contents: '*.trx'
TargetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'testResults'
publishLocation: 'Container'
- pwsh: |
Compress-Archive -Path $(System.DefaultWorkingDirectory)\test\end-to-end\testFunctionApp\* -DestinationPath $(System.DefaultWorkingDirectory)\test\e2etestsnode.zip
displayName: 'Create test app zip file'
- pwsh: |
Install-Module Az.Storage -Force -Verbose -Scope CurrentUser
if (-not (Get-command new-azstoragecontext -ea SilentlyContinue))
{
throw "new-azstoragecontext is not present"
}
$localFileE2ETests = '$(System.DefaultWorkingDirectory)\test\e2etestsnode.zip'
if (Test-Path $localFileE2ETests)
{
Write-Host "File exists"
}
$blobName = 'e2etestsnode.zip'
$Context = New-AzStorageContext -StorageAccountName $(StorageAccountName) -StorageAccountKey $(StorageAccountKey)
Set-AzStorageBlobContent -File $localFileE2ETests -Container $(ContainerName) -Blob $blobName -Context $Context -Force -Verbose
env:
AzureFunctionsE2ETestStorage: $(AzureFunctionsE2ETestStorage)
displayName: 'Copying test app zip artifacts to blob'
- powershell: .\package.ps1
displayName: 'Creating nodeworker package'
- pwsh: |
Compress-Archive -Path $(System.DefaultWorkingDirectory)\pkg\* -DestinationPath $(System.DefaultWorkingDirectory)\nodeworker.zip
displayName: 'Create nodeworker zip file'
- pwsh: |
$localFileNodeWorker = '$(System.DefaultWorkingDirectory)\nodeworker.zip'
if (Test-Path $localFileNodeWorker)
{
Write-Host "localFileNodeWorker file exists"
}
$blobNameNodeWorker = 'nodeworker.zip'
$Context = New-AzStorageContext -StorageAccountName $(StorageAccountName) -StorageAccountKey $(StorageAccountKey)
Set-AzStorageBlobContent -File $localFileNodeWorker -Container $(ContainerName) -Blob $blobNameNodeWorker -Context $Context -Force -Verbose
env:
AzureFunctionsE2ETestStorage: $(AzureFunctionsE2ETestStorage)
displayName: 'Copying node worker zip to blob'