-
Notifications
You must be signed in to change notification settings - Fork 0
275 lines (263 loc) · 10.5 KB
/
ci-cd.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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
# Trigger the workflow on push to any branch or on pull request into master
name: vmware-cloud-director-ui-components
on:
push:
pull_request:
branches: [master, a11y]
types: [opened, reopened, synchronize]
jobs:
lint-projects:
runs-on: ubuntu-latest
name: Linting
steps:
- uses: actions/checkout@v2
- run: |
npm ci
npm run lint i18n
npm run lint components
npm run lint examples
npm run lint route-analyzer
build-i18n:
runs-on: ubuntu-latest
name: Build /i18n
needs: [lint-projects]
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: ./dist/i18n
key: ${{github.sha}}-i18n
- run: |
npm ci
npm run build:i18n
build-components-lib:
runs-on: ubuntu-latest
name: Build /components
needs: [build-i18n]
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: ./dist/i18n
key: ${{github.sha}}-i18n
- uses: actions/cache@v1
with:
path: ./dist/components
key: ${{ github.sha }}-components
- run: |
npm ci
npm run build:components
build-app:
runs-on: ubuntu-latest
name: Build /examples-app
needs: [build-components-lib]
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: ./dist/components
key: ${{ github.sha }}-components
- uses: actions/cache@v1
with:
path: ./dist/i18n
key: ${{github.sha}}-i18n
- uses: actions/cache@v1
with:
path: ./dist/examples
key: ${{github.sha}}-examples
- run: |
npm ci
npm run build-components-doc
npm run build-examples-doc
npm run generate-translations
npm run generate-example-translations
npm run build:examples-prod
build-route-analyzer:
runs-on: ubuntu-latest
name: Build /route-analyzer
needs: [lint-projects]
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: ./dist/route-analyzer
key: ${{github.sha}}-route-analyzer
- run: |
npm ci
npm run build:route-analyzer
unit-testing:
runs-on: ubuntu-latest
name: Unit tests
needs: [build-i18n]
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: ./dist/i18n
key: ${{github.sha}}-i18n
- uses: actions/cache@v1
with:
path: ./dist/route-analyzer
key: ${{github.sha}}-route-analyzer
- uses: actions/cache@v1
with:
path: ./coverage
key: coverage
- name: Run unit-tests
run: |
npm ci
npm run test:ci:components
npm run test:ci:i18n
npm run test:route-analyzer
- name: Upload coverage to Codecov
if: success()
uses: codecov/codecov-action@v1
gh-pages-deploy:
runs-on: ubuntu-latest
name: Deploying to Github pages
needs: [build-app, unit-testing]
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: ./dist/examples
key: ${{github.sha}}-examples
- run: |
npm ci
npx ng deploy --no-build
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
publish-components:
needs: [build-components-lib, unit-testing]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# Fetch depth is given as input because by default, it does a shallow clone (one without any history) for performance reasons.
# But the check-components-package step below uses git diff-tree command to get list of files changed and
# it requires a base commit sha in addition to the commit sha that triggered this job.
with:
fetch-depth: 2
- uses: actions/setup-node@v1
with:
node-version: '13'
registry-url: https://registry.npmjs.org/
- uses: actions/cache@v1
with:
path: ./dist/components
key: ${{ github.sha }}-components
- name: Install node_modules
run: npm ci
- id: check-components-tag
uses: ./.github/actions/check-lib-tag
with:
lib-name: 'components'
- id: check-components-package
uses: ./.github/actions/check-lib-package
with:
lib-name: 'components'
- name: Publish components@next
if: steps.check-components-tag.outputs.isLibTag != 'true' && steps.check-components-package.outputs.isLibPackageChanged == 'true' && github.event_name == 'push' && github.ref == 'refs/heads/master'
run: |
cd ./dist/components
npm publish --tag next --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
- name: Publish components@next-a11y
if: steps.check-components-tag.outputs.isLibTag != 'true' && steps.check-components-package.outputs.isLibPackageChanged == 'true' && github.event_name == 'push' && github.ref == 'refs/heads/a11y'
run: |
cd ./dist/components
npm publish --tag next-a11y --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
- name: Publish components@latest
if: steps.check-components-tag.outputs.isLibTag == 'true'
run: |
cd ./dist/components
npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
publish-i18n:
needs: [build-i18n, unit-testing]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# Fetch depth is given as input because by default, it does a shallow clone (one without any history) for performance reasons.
# But the check-components-package step below uses git diff-tree command to get list of files changed and
# it requires a base commit sha in addition to the commit sha that triggered this job.
with:
fetch-depth: 2
- uses: actions/setup-node@v1
with:
node-version: '13'
registry-url: https://registry.npmjs.org/
- uses: actions/cache@v1
with:
path: ./dist/i18n
key: ${{github.sha}}-i18n
- name: Install node_modules
run: npm ci
- id: check-i18n-tag
uses: ./.github/actions/check-lib-tag
with:
lib-name: 'i18n'
- id: check-i18n-package
uses: ./.github/actions/check-lib-package
with:
lib-name: 'i18n'
- name: Publish i18n@next
if: steps.check-i18n-tag.outputs.isLibTag != 'true' && steps.check-i18n-package.outputs.isLibPackageChanged == 'true' && github.event_name == 'push' && github.ref == 'refs/heads/master'
run: |
cd ./dist/i18n
npm publish --tag next --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
- name: Publish i18n@latest
if: steps.check-i18n-tag.outputs.isLibTag == 'true'
run: |
cd ./dist/i18n
npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
publish-route-analyzer:
needs: [build-route-analyzer, unit-testing]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# Fetch depth is given as input because by default, it does a shallow clone (one without any history) for performance reasons.
# But the check-XXX step below uses git diff-tree command to get list of files changed and
# it requires a base commit sha in addition to the commit sha that triggered this job.
with:
fetch-depth: 2
- uses: actions/setup-node@v1
with:
node-version: '13'
registry-url: https://registry.npmjs.org/
- uses: actions/cache@v1
with:
path: ./dist/route-analyzer
key: ${{github.sha}}-route-analyzer
- name: Install node_modules
run: npm ci
- id: check-route-analyzer-tag
uses: ./.github/actions/check-lib-tag
with:
lib-name: 'route-analyzer'
- id: check-route-analyzer-package
uses: ./.github/actions/check-lib-package
with:
lib-name: 'route-analyzer'
- name: Publish route-analyzer@next
if: steps.check-route-analyzer-tag.outputs.isLibTag != 'true' && steps.check-route-analyzer-package.outputs.isLibPackageChanged == 'true' && github.event_name == 'push' && github.ref == 'refs/heads/master'
run: |
cd ./dist/route-analyzer
npm publish --tag next --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
- name: Publish route-analyzer@latest
if: steps.check-route-analyzer-tag.outputs.isLibTag == 'true'
run: |
cd ./dist/route-analyzer
npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}