-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
59 lines (48 loc) · 2.19 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
# Disables CI builds entirely, then commits don't trigger a build
trigger: none
# Activates pull request trigger, so any pull request to the master trigger a build
pr:
- master
# Specifies which pool (Hosted or Self-hosted) to use for this pipeline.
# In this case it is in the scope of the pipeline, but you can use it at the stage or job level
pool:
vmImage: 'ubuntu-latest'
# Specific variables to use, in our case it is just one and at the pipeline level
variables:
chromeDriverVersion: '80.0.3987.106'
# Specifies a linear sequence of operations that make up a job
# We need only one job, so we can use the simplified structure
steps:
# Tasks are the building blocks of a pipeline
# We can choose from a catalog of tasks available by default or download from the Azure DevOps marketplace
# In this case I chose to use 6 tasks (not mandatory) to install dependencies and build the App.
- task: Npm@1 # Run npm install
displayName: 'npm install'
inputs:
command: install
workingDir: '$(System.DefaultWorkingDirectory)'
- task: Npm@1 # Run npm run build
displayName: 'npm run build'
inputs:
command: custom
customCommand: run build
- script: | # Run unit tests
npx --no-install ng test --watch=false --reporters=progress,junit
displayName: 'ng test'
# This task download the chromedriver binary, required for e2e tests
# In this case I installed a specific version of chromedriver to avoid errors with the version of Chrome in the hosted agent microsoft, see the troubleshooting topic.
- script: |
node node_modules/.bin/webdriver-manager update --versions.chrome=$(chromeDriverVersion) --gecko false --standalone false
displayName: 'changing version of chromedriver to $(chromeDriverVersion)'
- script: | # Run e2e tests without update webdriver
npx --no-install ng e2e --webdriverUpdate=false
displayName: 'ng e2e tests'
- task: PublishTestResults@2 # Publish tests results
displayName: 'Publishing test results'
condition: succeededOrFailed()
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: '**/TESTS-*.xml'
- publish: 'www/' # Publish App artifact
artifact: 'www'
displayName: 'Publishing Artifact'