-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
72 lines (63 loc) · 2.17 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
name: Azure Static Web Apps CI/CD
pr:
branches:
include:
- main
trigger:
branches:
include:
- main
stages:
- stage: Build
jobs:
- job: Build
displayName: Build app
steps:
- task: NodeTool@0
inputs:
versionSpec: '16.x'
displayName: 'Install Node.js'
- task: Cache@2
displayName: Cache node_modules
inputs:
key: 'node_modules | "$(Agent.OS)" | $(Build.SourcesDirectory)/package.json'
path: '$(Build.SourcesDirectory)/node_modules'
cacheHitVar: MODULES_CACHE_RESTORED
- script: |
npm install
displayName: 'Install node_modules'
condition: ne(variables.MODULES_CACHE_RESTORED, 'true')
- script: |
npm run audit-dependencies
displayName: 'Audit dependencies'
- script: |
npm run build
displayName: 'Build app'
- script: |
CI=true npm run test:ci
displayName: 'Run unit tests'
- task: PublishTestResults@2
displayName: 'Publish test report'
condition: succeededOrFailed()
inputs:
testRunner: JUnit
testResultsFiles: '**/junit.xml'
- stage: Deploy
jobs:
- job: deploy
displayName: Build and Deploy Job
condition: or(eq(variables['Build.Reason'], 'Manual'),or(eq(variables['Build.Reason'], 'PullRequest'),eq(variables['Build.Reason'], 'IndividualCI')))
pool:
vmImage: ubuntu-latest
variables:
- group: ui-variables
steps:
- checkout: self
submodules: true
- task: AzureStaticWebApp@0
inputs:
azure_static_web_apps_api_token: $(AZURE_STATIC_WEB_APPS_API_TOKEN)
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
app_location: '/' # App source code path
api_location: '' # Api source code path - optional
output_location: '' # Built app content directory - optional