-
Notifications
You must be signed in to change notification settings - Fork 3
432 lines (412 loc) · 16.3 KB
/
code_quality.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
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
name: Code Quality
on:
pull_request:
types: [synchronize, opened, reopened]
jobs:
# code quality for the frontend
get-base-branch-fe-cov:
runs-on: ubuntu-latest
environment: Quality Environment
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.base_ref }}
- name: Create required env file
run: |
echo '${{ secrets.CODE_QUALITY_ENV_FILE }}' > .env
- name: Run the Jest tests and generate code cov report
run: docker compose run --rm --no-deps react yarn test
- name: Upload Jest code cov for the base branch
uses: actions/upload-artifact@v4
with:
name: base-branch-fe-jest-code-cov
path: ./src/react/coverage/lcov.info
run-fe-code-quality:
environment: Quality Environment
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create required env file
run: |
echo '${{ secrets.CODE_QUALITY_ENV_FILE }}' > .env
- name: Run the Jest tests and generate code cov report
run: docker compose run --rm --no-deps react yarn test
- name: Upload Jest code cov for the feature branch
uses: actions/upload-artifact@v4
with:
name: feature-branch-fe-jest-code-cov
path: ./src/react/coverage/lcov.info
check-fe-code-cov:
environment: Quality Environment
needs:
- get-base-branch-fe-cov
- run-fe-code-quality
runs-on: ubuntu-latest
steps:
- name: Download Jest code cov reports
uses: actions/download-artifact@v4
with:
pattern: "*-jest-code-cov"
- name: Verify Jest code cov
uses: barecheck/code-coverage-action@v1
with:
barecheck-github-app-token: ${{ secrets.BARECHECK_GITHUB_APP_TOKEN }}
lcov-file: "./feature-branch-fe-jest-code-cov/lcov.info"
base-lcov-file: "./base-branch-fe-jest-code-cov/lcov.info"
minimum-ratio: 1
send-summary-comment: true
show-annotations: "warning"
app-name: React App | Jest test suite
# code quality for the Django app
get-base-branch-django-cov:
environment: Quality Environment
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.base_ref }}
- name: Create required env file
run: |
echo '${{ secrets.CODE_QUALITY_ENV_FILE }}' > .env
- name: Build Django image
run: docker compose build
- name: Run the unittest tests and generate code cov report
run: |
docker compose \
run --rm --entrypoint /bin/sh django \
-c "coverage run --data-file=./coverage/django/.coverage manage.py test --no-input ./api/tests \
&& coverage lcov --data-file=./coverage/django/.coverage -o ./coverage/django/coverage.lcov \
--include='./api/*' --omit='./api/migrations/*,./api/tests/*'"
- name: Upload unittest code cov for the base branch
uses: actions/upload-artifact@v4
with:
name: base-branch-django-unittest-code-cov
path: ./src/django/coverage/django/coverage.lcov
run-django-code-quality:
environment: Quality Environment
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create required env file
run: |
echo '${{ secrets.CODE_QUALITY_ENV_FILE }}' > .env
- name: Build Django image
run: docker compose build
- name: Run the unittest tests and generate code cov report
run: |
docker compose \
run --rm --entrypoint /bin/sh django \
-c "coverage run --data-file=./coverage/django/.coverage manage.py test --no-input ./api/tests \
&& coverage lcov --data-file=./coverage/django/.coverage -o ./coverage/django/coverage.lcov \
--include='./api/*' --omit='./api/migrations/*,./api/tests/*'"
- name: Upload unittest code cov for the feature branch
uses: actions/upload-artifact@v4
with:
name: feature-branch-django-unittest-code-cov
path: ./src/django/coverage/django/coverage.lcov
check-django-code-cov:
environment: Quality Environment
needs:
- get-base-branch-django-cov
- run-django-code-quality
runs-on: ubuntu-latest
steps:
- name: Download unittest code cov reports
uses: actions/download-artifact@v4
with:
pattern: "*-unittest-code-cov"
- name: Verify unittest code cov
uses: barecheck/code-coverage-action@v1
with:
barecheck-github-app-token: ${{ secrets.BARECHECK_GITHUB_APP_TOKEN }}
lcov-file: "./feature-branch-django-unittest-code-cov/coverage.lcov"
base-lcov-file: "./base-branch-django-unittest-code-cov/coverage.lcov"
minimum-ratio: 1
send-summary-comment: true
show-annotations: "warning"
app-name: Django App | Unittest test suite
# code quality for the Countries
get-base-branch-countries-cov:
environment: Quality Environment
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.base_ref }}
- name: Create required env file
run: |
echo '${{ secrets.CODE_QUALITY_ENV_FILE }}' > .env
- name: Build Django image
run: docker compose build
- name: Run the unittest tests and generate code cov report
run: |
docker compose \
run --rm --entrypoint /bin/sh django \
-c "coverage run --data-file=./coverage/countries/.coverage manage.py test --no-input ./countries/tests \
&& coverage lcov --data-file=./coverage/countries/.coverage -o ./coverage/countries/coverage.lcov \
--include='./countries/*' --omit='./countries/tests/*'"
- name: Upload unittest code cov for the base branch
uses: actions/upload-artifact@v4
with:
name: base-branch-countries-unittest-code-cov
path: ./src/django/coverage/countries/coverage.lcov
run-countries-code-quality:
environment: Quality Environment
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create required env file
run: |
echo '${{ secrets.CODE_QUALITY_ENV_FILE }}' > .env
- name: Build Django image
run: docker compose build
- name: Run the unittest tests and generate code cov report
run: |
docker compose \
run --rm --entrypoint /bin/sh django \
-c "coverage run --data-file=./coverage/countries/.coverage manage.py test --no-input ./countries/tests \
&& coverage lcov --data-file=./coverage/countries/.coverage -o ./coverage/countries/coverage.lcov \
--include='./countries/*' --omit='./countries/tests/*'"
- name: Upload unittest code cov for the feature branch
uses: actions/upload-artifact@v4
with:
name: feature-branch-countries-unittest-code-cov
path: ./src/django/coverage/countries/coverage.lcov
check-countries-code-cov:
environment: Quality Environment
needs:
- get-base-branch-countries-cov
- run-countries-code-quality
runs-on: ubuntu-latest
steps:
- name: Download unittest code cov reports
uses: actions/download-artifact@v4
with:
pattern: "*-unittest-code-cov"
- name: Verify unittest code cov
uses: barecheck/code-coverage-action@v1
with:
barecheck-github-app-token: ${{ secrets.BARECHECK_GITHUB_APP_TOKEN }}
lcov-file: "./feature-branch-countries-unittest-code-cov/coverage.lcov"
base-lcov-file: "./base-branch-countries-unittest-code-cov/coverage.lcov"
minimum-ratio: 1
send-summary-comment: true
show-annotations: "warning"
app-name: Countries App | Unittest test suite
# code quality for the Contricleaner
get-base-branch-contricleaner-cov:
environment: Quality Environment
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.base_ref }}
- name: Create required env file
run: |
echo '${{ secrets.CODE_QUALITY_ENV_FILE }}' > .env
- name: Build Django image
run: docker compose build
- name: Run the unittest tests and generate code cov report
run: |
docker compose \
run --rm --entrypoint /bin/sh django \
-c "coverage run --data-file=./coverage/contricleaner/.coverage manage.py test --no-input ./contricleaner/tests \
&& coverage lcov --data-file=./coverage/contricleaner/.coverage -o ./coverage/contricleaner/coverage.lcov \
--include='./contricleaner/*' --omit='./contricleaner/tests/*'"
- name: Upload unittest code cov for the base branch
uses: actions/upload-artifact@v4
with:
name: base-branch-contricleaner-unittest-code-cov
path: ./src/django/coverage/contricleaner/coverage.lcov
run-contricleaner-code-quality:
environment: Quality Environment
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create required env file
run: |
echo '${{ secrets.CODE_QUALITY_ENV_FILE }}' > .env
- name: Build Django image
run: docker compose build
- name: Run the unittest tests and generate code cov report
run: |
docker compose \
run --rm --entrypoint /bin/sh django \
-c "coverage run --data-file=./coverage/contricleaner/.coverage manage.py test --no-input ./contricleaner/tests \
&& coverage lcov --data-file=./coverage/contricleaner/.coverage -o ./coverage/contricleaner/coverage.lcov \
--include='./contricleaner/*' --omit='./contricleaner/tests/*'"
- name: Upload unittest code cov for the feature branch
uses: actions/upload-artifact@v4
with:
name: feature-branch-contricleaner-unittest-code-cov
path: ./src/django/coverage/contricleaner/coverage.lcov
check-contricleaner-code-cov:
environment: Quality Environment
needs:
- get-base-branch-contricleaner-cov
- run-contricleaner-code-quality
runs-on: ubuntu-latest
steps:
- name: Download unittest code cov reports
uses: actions/download-artifact@v4
with:
pattern: "*-unittest-code-cov"
- name: Verify unittest code cov
uses: barecheck/code-coverage-action@v1
with:
barecheck-github-app-token: ${{ secrets.BARECHECK_GITHUB_APP_TOKEN }}
lcov-file: "./feature-branch-contricleaner-unittest-code-cov/coverage.lcov"
base-lcov-file: "./base-branch-contricleaner-unittest-code-cov/coverage.lcov"
minimum-ratio: 1
send-summary-comment: true
show-annotations: "warning"
app-name: Contricleaner App | Unittest test suite
# code quality for the Dedupe Hub
get-base-branch-dd-cov:
environment: Quality Environment
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.base_ref }}
- name: Create required env file
run: |
echo '${{ secrets.CODE_QUALITY_ENV_FILE }}' > .env
- name: Build Dedupe Hub image
run: docker compose build
- name: Run the unittest tests and generate code cov report
run: |
docker compose \
run --rm --entrypoint /bin/sh api-app \
-c "coverage run --source=app --data-file=./coverage/.coverage -m unittest \
&& coverage lcov --data-file=./coverage/.coverage -o ./coverage/coverage.lcov \
--include='./app/*' --omit='./tests/*, ./app/config.py'"
- name: Upload unittest code cov for the base branch
uses: actions/upload-artifact@v4
with:
name: base-branch-dd-unittest-code-cov
path: ./src/dedupe-hub/api/coverage/coverage.lcov
run-dd-code-quality:
environment: Quality Environment
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create required env file
run: |
echo '${{ secrets.CODE_QUALITY_ENV_FILE }}' > .env
- name: Build Dedupe Hub image
run: docker compose build
- name: Run the unittest tests and generate code cov report
run: |
docker compose \
run --rm --entrypoint /bin/sh api-app \
-c "coverage run --source=app --data-file=./coverage/.coverage -m unittest \
&& coverage lcov --data-file=./coverage/.coverage -o ./coverage/coverage.lcov \
--include='./app/*' --omit='./tests/*, ./app/config.py'"
- name: Upload unittest code cov for the feature branch
uses: actions/upload-artifact@v4
with:
name: feature-branch-dd-unittest-code-cov
path: ./src/dedupe-hub/api/coverage/coverage.lcov
check-dd-code-cov:
environment: Quality Environment
needs:
- get-base-branch-dd-cov
- run-dd-code-quality
runs-on: ubuntu-latest
steps:
- name: Download unittest code cov reports
uses: actions/download-artifact@v4
with:
pattern: "*-unittest-code-cov"
- name: Verify unittest code cov
uses: barecheck/code-coverage-action@v1
with:
barecheck-github-app-token: ${{ secrets.BARECHECK_GITHUB_APP_TOKEN }}
lcov-file: "./feature-branch-dd-unittest-code-cov/coverage.lcov"
base-lcov-file: "./base-branch-dd-unittest-code-cov/coverage.lcov"
minimum-ratio: 1
send-summary-comment: true
show-annotations: "warning"
app-name: Dedupe Hub App | Unittest test suite
# code quality integration test
run-integration-test-code-quality:
environment: Quality Environment
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create required env file
run: |
echo '${{ secrets.CODE_QUALITY_ENV_FILE }}' > .env
- name: Build & Run OS Hub
run: scripts/start_code_quality_dev
- name: Waiting for all OS Hub services live processes completed
run: sleep 60
- name: Build Integration Test image
run: docker compose -f docker-compose.tests.yml build
- name: Run Integration Test
run: |
docker compose -f docker-compose.tests.yml \
run --rm --entrypoint /bin/sh integration-test \
-c "python -m unittest"
- name: Run Playwright Test
run: |
docker compose -f docker-compose.tests.yml run --rm --build \
--entrypoint "npx playwright test -c playwright.config.ts" \
playwright-test
# code quality formatting
run-bash-script-linter:
environment: Quality Environment
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run the shellcheck linter check
run: shellcheck scripts/*
run-flake8-linter:
environment: Quality Environment
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create required env file
run: |
echo '${{ secrets.CODE_QUALITY_ENV_FILE }}' > .env
- name: Build Django image
run: docker compose build
- name: Run the Flake8 linter check
run: |
docker compose \
run --rm --no-deps --entrypoint flake8 django \
--exclude settings.py,manage.py,*.pyc,api/migrations/*
run-eslint-linter-and-prettier-formatter:
environment: Quality Environment
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create required env file
run: |
echo '${{ secrets.CODE_QUALITY_ENV_FILE }}' > .env
- name: Run the ESLint linter check
run: |
docker compose \
run --rm --entrypoint ./node_modules/.bin/eslint \
react src/ --ext .js --ext .jsx
- name: Run the Prettier formatting check
run: |
docker compose \
run --rm --no-deps react yarn prettier \
--config .prettierrc \
--check 'src/**/*.js' 'src/**/*.jsx'