forked from ng-alain/delon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
142 lines (133 loc) · 4.33 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: ng-alain-delon
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
stages:
- stage: env
jobs:
- job: Nodes
steps:
- task: NodeTool@0
inputs:
versionSpec: '12.14.1'
displayName: 'Install Node.js'
- stage: artifacts
dependsOn: env
jobs:
- job: build
steps:
- task: Npm@1
inputs:
command: 'install'
- task: Bash@3
env:
ACCESS_TOKEN: $(ACCESS_TOKEN)
inputs:
targetType: 'filePath'
filePath: 'scripts/ci/build-artifacts.sh'
- stage: test
dependsOn:
- env
jobs:
- job: packages
steps:
- task: Npm@1
inputs:
command: 'install'
- script: |
npm run test
cat ./coverage/lcov.info | ./node_modules/.bin/codecov
env:
CODECOV_TOKEN: $(CODECOV_TOKEN)
- task: PublishCodeCoverageResults@1
displayName: 'publish code coverage results'
condition: succeededOrFailed()
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: $(System.DefaultWorkingDirectory)/coverage/cobertura-coverage.xml
reportDirectory: $(System.DefaultWorkingDirectory)/coverage
failIfCoverageEmpty: true
- task: PublishTestResults@2
displayName: 'publish test results'
condition: succeededOrFailed()
inputs:
searchFolder: $(System.DefaultWorkingDirectory)/junit
failTaskOnFailedTests: true
testRunTitle: DELON
testResultsFormat: JUnit
testResultsFiles: '**/TESTS*.xml'
- job: cli
steps:
- task: Npm@1
inputs:
command: 'install'
- script: npm run test:cli
- stage: lint
dependsOn:
- env
jobs:
- job: packages
steps:
- task: Npm@1
inputs:
command: 'install'
- script: npm run lint
- stage: site
dependsOn:
- env
- artifacts
jobs:
- job: Build
steps:
- checkout: self
displayName: 'Checkout'
clean: true
fetchDepth: 1
- task: Npm@1
inputs:
command: 'install'
- script: |
node ./scripts/azure/github-comment.js "[Preview Preparing...](https://dev.azure.com/ng-alain/delon/_build/results?buildId=$(Build.BuildId))"
displayName: 'Comment on github'
env:
ACCESS_REPO: $(ACCESS_REPO)
ACCESS_TOKEN: $(ACCESS_TOKEN)
- script: npm run site:build
displayName: 'Build sites'
- script: ls -al src/dist/
displayName: 'List build'
- script: |
export DEPLOY_DOMAIN=https://preview-${SYSTEM_PULLREQUEST_PULLREQUESTNUMBER}-ng-alain-delon.surge.sh
echo "Deploy to $DEPLOY_DOMAIN"
cp ./src/dist/index.html ./src/dist/404.html
npx surge --project ./src/dist --domain $DEPLOY_DOMAIN
displayName: 'Deploy Site'
env:
ACCESS_REPO: $(ACCESS_REPO)
ACCESS_TOKEN: $(ACCESS_TOKEN)
SURGE_LOGIN: $(SURGE_LOGIN)
SURGE_TOKEN: $(SURGE_TOKEN)
- script: |
export DEPLOY_DOMAIN=https://preview-${SYSTEM_PULLREQUEST_PULLREQUESTNUMBER}-ng-alain-delon.surge.sh
node ./scripts/azure/github-comment.js "[Preview is ready!]($DEPLOY_DOMAIN)"
displayName: 'Update comment on github'
env:
ACCESS_REPO: $(ACCESS_REPO)
ACCESS_TOKEN: $(ACCESS_TOKEN)
- job: Build_Failed
dependsOn: Build
condition: failed()
steps:
- checkout: self
displayName: 'Checkout'
clean: true
fetchDepth: 1
- script: npm install
displayName: 'Install modules'
- script: |
node ./scripts/azure/github-comment.js "[Preview Failed](https://dev.azure.com/ng-alain/delon/_build/results?buildId=$(Build.BuildId))"
displayName: 'Comment on github'
env:
ACCESS_REPO: $(ACCESS_REPO)
ACCESS_TOKEN: $(ACCESS_TOKEN)