-
Notifications
You must be signed in to change notification settings - Fork 126
1989 lines (1683 loc) · 73.6 KB
/
continuous-integration.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
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
name: Continuous Integration
on:
push:
branches:
- '**'
tags-ignore:
- '**'
concurrency:
group: ${{ github.ref != 'refs/heads/main' && github.ref || github.sha }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
build:
name: Build
runs-on: ubuntu-16-cores-latest
outputs:
entry_names: ${{ steps.get-changed-apps.outputs.entry_names }}
continuous_deployment: ${{ steps.get-changed-apps.outputs.continuous_deployment }}
strategy:
fail-fast: false
matrix:
buildtype: [vagovdev, vagovstaging, vagovprod]
steps:
- name: Checkout
uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017
with:
fetch-depth: 0
- name: Configure AWS credentials
if: ${{ matrix.buildtype == 'vagovprod' }}
uses: ./.github/workflows/configure-aws-credentials
with:
aws_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: us-gov-west-1
- name: Install dependencies
uses: ./.github/workflows/install
timeout-minutes: 30
with:
key: ${{ hashFiles('yarn.lock') }}
yarn_cache_folder: .cache/yarn
path: |
.cache/yarn
node_modules
- name: Get changed applications
id: get-changed-apps
uses: ./.github/workflows/get-changed-apps
with:
delimiter: ','
output-type: 'entry_name, continuous_deployment'
- name: Get Mapbox Token
if: ${{ matrix.buildtype == 'vagovprod' }}
uses: ./.github/workflows/inject-secrets
with:
ssm_parameter: /dsva-vagov/vets-website/dev/mapbox_token
env_variable_name: MAPBOX_TOKEN
- name: Build
run: yarn build --verbose --buildtype=${{ matrix.buildtype }} ${ENTRY:+"--entry=$ENTRY"}
timeout-minutes: 30
env:
ENTRY: ${{ steps.get-changed-apps.outputs.entry_names }}
- name: Generate build details
run: |
cat > build/${{ matrix.buildtype }}/BUILD.txt << EOF
BUILDTYPE=${{ matrix.buildtype }}
NODE_ENV=production
BRANCH_NAME=$(echo "${GITHUB_REF#refs/heads/}")
CHANGE_TARGET=null
RUN_ID=${{ github.run_id }}
RUN_NUMBER=${{ github.run_number }}
REF=${{ github.sha }}
BUILDTIME=$(date +%s)
EOF
- name: Compress and archive build
run: tar -C build/${{ matrix.buildtype }} -cjf ${{ matrix.buildtype }}.tar.bz2 .
- name: Upload build artifact
uses: ./.github/workflows/upload-artifact
with:
name: ${{ matrix.buildtype }}.tar.bz2
path: ${{ matrix.buildtype }}.tar.bz2
retention-days: 1
fetch-allow-lists:
name: Fetch Test Stability Allow Lists
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017
- name: Configure AWS credentials
uses: ./.github/workflows/configure-aws-credentials
with:
aws_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: us-gov-west-1
- name: Get va-vsp-bot token
uses: ./.github/workflows/inject-secrets
with:
ssm_parameter: /devops/VA_VSP_BOT_GITHUB_TOKEN
env_variable_name: VA_VSP_BOT_GITHUB_TOKEN
- name: Init Dashboard Data Repo
uses: ./.github/workflows/init-data-repo
- name: Set Up BigQuery Creds
uses: ./.github/workflows/configure-bigquery
- name: Fetch E2E Test Stability Allow List
run: yarn get-allow-list
working-directory: qa-standards-dashboard-data
env:
TEST_TYPE: e2e
- name: Fetch Unit Test Stability Allow List
run: yarn get-allow-list
working-directory: qa-standards-dashboard-data
env:
TEST_TYPE: unit_test
- name: Archive E2E Test Stability Allow List
if: ${{ always() }}
uses: ./.github/workflows/upload-artifact
with:
name: e2e-allow-list
path: qa-standards-dashboard-data/e2e_allow_list.json
- name: Archive Unit Test Stability Allow List
if: ${{ always() }}
uses: ./.github/workflows/upload-artifact
with:
name: unit-test-allow-list
path: qa-standards-dashboard-data/unit_test_allow_list.json
tests-prep:
name: Tests Prep
needs: [fetch-allow-lists]
runs-on: ubuntu-22.04
outputs:
app_folders: ${{ steps.get-changed-apps.outputs.folders }}
apps-to-stress-test: ${{ steps.apps-to-stress-test.outputs.apps_to_test }}
unit-tests-to-stress-test: ${{ steps.unit-tests-to-stress-test.outputs.tests }}
changed-files: ${{ steps.get-changed-apps.outputs.changed_files }}
disallowed-tests: ${{ steps.disallowed-tests.outputs.tests }}
cypress-tests: ${{ steps.cypress-tests.outputs.selected }}
cypress-tests-to-stress-test: ${{ steps.cypress-tests-to-stress-test.outputs.tests }}
app_urls: ${{ steps.get-changed-apps.outputs.urls }}
num_containers: ${{ steps.containers.outputs.num }}
ci_node_index: ${{ steps.matrix.outputs.ci_node_index }}
changed_file_paths: ${{ steps.get-changed-apps.outputs.changed_files }}
steps:
- name: Checkout
uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017
with:
fetch-depth: 0
- name: Install dependencies
uses: ./.github/workflows/install
timeout-minutes: 30
with:
key: ${{ hashFiles('yarn.lock') }}
yarn_cache_folder: .cache/yarn
path: |
.cache/yarn
node_modules
- name: Get changed applications
id: get-changed-apps
uses: ./.github/workflows/get-changed-apps
with:
delimiter: ','
output-type: 'entry_name, url'
- name: Download Unit Test Stability Allow List
uses: ./.github/workflows/download-artifact
with:
name: unit-test-allow-list
path: .
- name: Download E2E Test Stability Allow List
uses: ./.github/workflows/download-artifact
with:
name: e2e-allow-list
path: .
- name: Set NUM_CONTAINERS, CI_NODE_INDEX, TESTS variables
run: node script/github-actions/select-cypress-tests.js
env:
RUN_FULL_SUITE: false
CHANGED_FILE_PATHS: ${{ steps.get-changed-apps.outputs.changed_files }}
APP_URLS: ${{ steps.get-changed-apps.outputs.urls }}
APP_ENTRIES: ${{ steps.get-changed-apps.outputs.entry_names }}
TEST_TYPE: e2e
- name: Run Unit Test Selection
run: node script/github-actions/select-unit-tests.js
env:
CHANGED_FILES: ${{ steps.get-changed-apps.outputs.changed_files }}
- name: Set output of DISALLOWED_TESTS
if: ${{ always() }}
id: disallowed-tests
run: echo "tests=$DISALLOWED_TESTS" >> $GITHUB_OUTPUT
- name: Set output of UNIT_TESTS_TO_STRESS_TEST
if: ${{ always() }}
id: unit-tests-to-stress-test
run: echo "tests=$UNIT_TESTS_TO_STRESS_TEST" >> $GITHUB_OUTPUT
- name: Upload artifact of Unit Tests to Stress Test
if: ${{ steps.unit-tests-to-stress-test.outputs.tests == 'true' }}
uses: ./.github/workflows/upload-artifact
with:
name: unit-tests-to-stress-test
path: unit_tests_to_stress_test.json
- name: Set output of APPS_TO_STRESS_TEST
if: ${{ always() }}
id: apps-to-stress-test
run: echo "apps_to_test=$APPS_TO_STRESS_TEST" >> $GITHUB_OUTPUT
- name: Set output of TESTS
id: cypress-tests
run: echo selected=$TESTS >> $GITHUB_OUTPUT
- name: Upload artifact of Cypress Tests to Test
if: ${{ steps.cypress-tests.outputs.selected == 'true' }}
uses: ./.github/workflows/upload-artifact
with:
name: e2e-tests-to-test
path: e2e_tests_to_test.json
- name: Set output of CYPRESS_TESTS_TO_STRESS_TEST
id: cypress-tests-to-stress-test
run: echo tests=$CYPRESS_TESTS_TO_STRESS_TEST >> $GITHUB_OUTPUT
- name: Upload artifact of Cypress Tests to Stress Test
if: ${{ steps.cypress-tests-to-stress-test.outputs.tests == 'true' }}
uses: ./.github/workflows/upload-artifact
with:
name: e2e-tests-to-stress-test
path: e2e_tests_to_stress_test.json
- name: Set output of NUM_CONTAINERS
id: containers
run: echo num=$NUM_CONTAINERS >> $GITHUB_OUTPUT
- name: Set output of CI_NODE_INDEX
id: matrix
run: echo ci_node_index=$CI_NODE_INDEX >> $GITHUB_OUTPUT
unit-tests:
name: Unit Tests
needs: [fetch-allow-lists, tests-prep]
timeout-minutes: 30
runs-on: ubuntu-16-cores-latest
outputs:
app_folders: ${{ steps.get-changed-apps.outputs.folders }}
changed-files: ${{ steps.get-changed-apps.outputs.changed_files }}
env:
DISALLOWED_TESTS: ${{ needs.tests-prep.outputs.disallowed-tests }}
strategy:
fail-fast: false
max-parallel: 72
matrix:
ci_node_index: [0,1,2,3,4,5,6,7,8,9]
steps:
- name: Checkout
uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017
with:
fetch-depth: 0
- name: Install dependencies
uses: ./.github/workflows/install
timeout-minutes: 30
with:
key: ${{ hashFiles('yarn.lock') }}
yarn_cache_folder: .cache/yarn
path: |
.cache/yarn
node_modules
- name: Configure AWS credentials
uses: ./.github/workflows/configure-aws-credentials
with:
aws_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: us-gov-west-1
- name: Get va-vsp-bot token
uses: ./.github/workflows/inject-secrets
with:
ssm_parameter: /devops/VA_VSP_BOT_GITHUB_TOKEN
env_variable_name: VA_VSP_BOT_GITHUB_TOKEN
- name: Init Dashboard Data Repo
uses: ./.github/workflows/init-data-repo
- name: Set Up BigQuery Creds
uses: ./.github/workflows/configure-bigquery
- name: Fetch Unit Test Stability Allow List
run: yarn get-allow-list
working-directory: qa-standards-dashboard-data
env:
TEST_TYPE: unit_test
- name: Check for newly added disallowed tests
run: node script/github-actions/double-check-allow-list.js
env:
TEST_TYPE: unit_test
TESTS: ${{ env.DISALLOWED_TESTS }}
TESTS_PROPERTY: 'DISALLOWED_TESTS'
- name: Create test results folder
run: mkdir -p test-results
- name: Get changed applications
id: get-changed-apps
uses: ./.github/workflows/get-changed-apps
with:
delimiter: ','
output-type: 'folder'
- name: Run unit tests
run: yarn test:unit:gha ${APP_FOLDERS:+"{script,$APP_FOLDERS}/**/*.unit.spec.js?(x)"} --coverage --log-level verbose
env:
MOCHA_FILE: test-results/unit-tests.xml
CHANGED_FILES: ${{ steps.get-changed-apps.outputs.changed_files }}
APP_FOLDERS: ${{ steps.get-changed-apps.outputs.folders }}
STEP: ${{ matrix.ci_node_index }}
IS_STRESS_TEST: false
NUM_CONTAINERS: 10
- name: Archive unit test results
if: ${{ always() && env.NO_APPS_TO_RUN == 'false' }}
uses: ./.github/workflows/upload-artifact
with:
name: unit-test-report-${{ matrix.ci_node_index }}
path: mocha/results
- name: Rename Coverage Summary file
if: ${{ env.NO_APPS_TO_RUN == 'false' }}
run: |
cd coverage
mv coverage-summary.json coverage-summary-${{ matrix.ci_node_index }}.json
- name: Upload Coverage Report Artifact
uses: ./.github/workflows/upload-artifact
if: ${{ always() && env.NO_APPS_TO_RUN == 'false' }}
with:
name: unit-test-coverage-${{ matrix.ci_node_index }}
# path: test-results/coverage_report-${{ matrix.ci_node_index }}.txt
path: coverage
unit-tests-stress-test:
name: Unit Test Stability Review
runs-on: ubuntu-22.04
timeout-minutes: 30
needs: [fetch-allow-lists, tests-prep]
if: ${{ always() && !cancelled() && needs.tests-prep.outputs.unit-tests-to-stress-test == 'true' && github.ref != 'refs/heads/main' && needs.fetch-allow-lists.result == 'success' && needs.tests-prep.result == 'success' }}
env:
APPS_TO_VERIFY: ${{ needs.tests-prep.outputs.apps-to-stress-test }}
DISALLOWED_TESTS: '[]'
strategy:
fail-fast: false
max-parallel: 10
matrix:
runs: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
steps:
- name: Checkout
uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017
with:
fetch-depth: 0
- name: Install dependencies
uses: ./.github/workflows/install
timeout-minutes: 30
with:
key: ${{ hashFiles('yarn.lock') }}
yarn_cache_folder: .cache/yarn
path: |
.cache/yarn
node_modules
- name: Create test results folder
run: mkdir -p test-results
- name: Download Unit Test Stability Allow List
uses: ./.github/workflows/download-artifact
with:
name: unit-test-allow-list
path: .
- name: Download Tests to verify
uses: ./.github/workflows/download-artifact
with:
name: unit-tests-to-stress-test
path: .
- name: Run unit tests
run: yarn test:unit:gha ${APP_FOLDERS:+"{script,$APP_FOLDERS}/**/*.unit.spec.js?(x)"} --log-level trace
env:
MOCHA_FILE: test-results/unit-tests.xml
APP_FOLDERS: ${{ steps.get-changed-apps.outputs.folders }}
IS_STRESS_TEST: true
STEP: ${{ matrix.runs }}
- name: Archive unit test results
if: ${{ always() }}
uses: ./.github/workflows/upload-artifact
with:
name: unit-test-stress-test-results-${{ matrix.runs }}
path: mocha/results
update-unit-test-allow-list:
name: Update Unit Test Stability Allow List
runs-on: ubuntu-22.04
needs: [unit-tests-stress-test, fetch-allow-lists]
if: ${{ always() && (needs.unit-tests-stress-test.result == 'success' || needs.unit-tests-stress-test.result == 'failure') }}
continue-on-error: true
env:
APPLICATION_LIST: ${{ needs.testing-reports-prep.outputs.app_list }}
steps:
- name: Checkout
uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017
- name: Configure AWS credentials
uses: ./.github/workflows/configure-aws-credentials
with:
aws_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: us-gov-west-1
- name: Get va-vsp-bot token
uses: ./.github/workflows/inject-secrets
with:
ssm_parameter: /devops/VA_VSP_BOT_GITHUB_TOKEN
env_variable_name: VA_VSP_BOT_GITHUB_TOKEN
- name: Init Dashboard Data Repo
uses: ./.github/workflows/init-data-repo
- name: Set Up BigQuery Creds
uses: ./.github/workflows/configure-bigquery
- name: Get AWS IAM role
uses: ./.github/workflows/inject-secrets
with:
ssm_parameter: /frontend-team/github-actions/parameters/AWS_FRONTEND_NONPROD_ROLE
env_variable_name: AWS_FRONTEND_NONPROD_ROLE
- name: Set UUID for Mochawesome reports
run: echo "UUID=$(uuidgen)" >> $GITHUB_ENV
- name: Configure AWS Credentials (2)
uses: ./.github/workflows/configure-aws-credentials
with:
aws_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: us-gov-west-1
role: ${{ env.AWS_FRONTEND_NONPROD_ROLE }}
role_duration: 900
session_name: vsp-frontendteam-githubaction
- name: Download Unit Test results
uses: ./.github/workflows/download-artifact
with:
pattern: unit-test-stress-test-results-*
path: qa-standards-dashboard-data/src/allow-list/data
merge-multiple: true
- name: Download Unit Test Stability Allow List
uses: ./.github/workflows/download-artifact
with:
name: unit-test-allow-list
path: qa-standards-dashboard-data
- name: Copy test results to mochawesome directory
run: cp -R qa-standards-dashboard-data/src/allow-list/data qa-standards-dashboard-data/src/testing-reports/data
- name: Update Unit Test Stability Allow List
run: yarn update-allow-list
working-directory: qa-standards-dashboard-data
env:
TEST_TYPE: unit_test
IS_CI: true
GITHUB_WORKFLOW_URL: ${{ github.server_url}}/${{ github.repository }}/actions/runs/${{ github.run_id }}
security-audit:
name: Security Audit
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017
with:
fetch-depth: 0
- name: Install dependencies
uses: ./.github/workflows/install
timeout-minutes: 30
with:
key: ${{ hashFiles('yarn.lock') }}
yarn_cache_folder: .cache/yarn
path: |
.cache/yarn
node_modules
- name: Get changed applications
id: get-changed-apps
uses: ./.github/workflows/get-changed-apps
with:
output-type: 'entry_name'
- name: Audit dependencies
if: steps.get-changed-apps.outputs.entry_names == ''
run: yarn security-check
linting:
name: Linting (All)
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017
with:
fetch-depth: 0
- name: Install dependencies
uses: ./.github/workflows/install
timeout-minutes: 30
with:
key: ${{ hashFiles('yarn.lock') }}
yarn_cache_folder: .cache/yarn
path: |
.cache/yarn
node_modules
- name: Get changed applications
id: get-changed-apps
uses: ./.github/workflows/get-changed-apps
with:
output-type: 'folder'
- name: Annotate ESLint results
run: |
if [[ -z "${{ steps.get-changed-apps.outputs.folders }}" ]]; then
yarn run eslint --ext .js --ext .jsx --format ./script/github-actions/eslint-annotation-format.js .
else
yarn run eslint --ext .js --ext .jsx --format ./script/github-actions/eslint-annotation-format.js \
${{ steps.get-changed-apps.outputs.folders }}
fi
env:
GITHUB_REF: ${{ github.ref }}
- name: Run Stylelint
if: ${{ always() }}
run: |
if [[ -z "${{ steps.get-changed-apps.outputs.folders }}" ]]; then
yarn run stylelint verbose --output-file stylelint-report.json --formatter json src/**/*.scss
else
files=$(find ${{ steps.get-changed-apps.outputs.folders }} -name "*.scss")
if [[ -n "$files" ]]; then yarn run stylelint verbose --output-file stylelint-report.json --formatter json $(echo $files); fi
fi
- name: Annotate Stylelint results
if: ${{ always() }}
run: node ./script/github-actions/stylelint-annotation-format.js
testing-reports-prep:
name: Testing Reports Prep
runs-on: ubuntu-22.04
continue-on-error: true
outputs:
app_list: ${{ env.APPLICATION_LIST }}
steps:
- name: Checkout
uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017
- name: Install dependencies
uses: ./.github/workflows/install
timeout-minutes: 30
with:
key: ${{ hashFiles('yarn.lock') }}
yarn_cache_folder: .cache/yarn
path: |
.cache/yarn
node_modules
- name: Generate new application list
run: yarn generate-app-list
# exports app list and assigns to environmental variable at this step
- name: Configure AWS credentials
uses: ./.github/workflows/configure-aws-credentials
with:
aws_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: us-gov-west-1
- name: Get va-vsp-bot token
uses: ./.github/workflows/inject-secrets
with:
ssm_parameter: /devops/VA_VSP_BOT_GITHUB_TOKEN
env_variable_name: VA_VSP_BOT_GITHUB_TOKEN
- name: Init Dashboard Data Repo
uses: ./.github/workflows/init-data-repo
- name: Set Up BigQuery Creds
uses: ./.github/workflows/configure-bigquery
- name: Upload app list to BigQuery
run: yarn generate-app-list
working-directory: qa-standards-dashboard-data
fetch-ecr-credentials:
name: Fetch ECR Credentials
runs-on: ubuntu-22.04
timeout-minutes: 10
needs: [build]
steps:
- name: Checkout
uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017
- name: Configure AWS Credentials
uses: ./.github/workflows/configure-aws-credentials
with:
aws_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: us-gov-west-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
with:
mask-password: false
outputs:
ecr_user: ${{ steps.login-ecr.outputs.docker_username_008577686731_dkr_ecr_us_gov_west_1_amazonaws_com }}
ecr_password: ${{ steps.login-ecr.outputs.docker_password_008577686731_dkr_ecr_us_gov_west_1_amazonaws_com }}
cypress-tests:
name: Cypress E2E Tests
runs-on: ubuntu-16-cores-latest
timeout-minutes: 60
needs: [build, tests-prep, fetch-ecr-credentials]
if: |
needs.build.result == 'success' &&
needs.tests-prep.result == 'success'
container:
image: 008577686731.dkr.ecr.us-gov-west-1.amazonaws.com/dsva/cypress-io/cypress/browsers:node16.16.0-chrome107-ff107-edge
credentials:
username: ${{ needs.fetch-ecr-credentials.outputs.ecr_user }}
password: ${{ needs.fetch-ecr-credentials.outputs.ecr_password }}
strategy:
fail-fast: false
max-parallel: 12
matrix:
ci_node_index: ${{ fromJson(needs.tests-prep.outputs.ci_node_index) }}
env:
CI_NODE_INDEX: ${{ needs.tests-prep.outputs.ci_node_index }}
TESTS: ${{ needs.tests-prep.outputs.cypress-tests }}
steps:
# The following statement is included in each step because of a bug in
# GitHub's branch protection:
#
# if: needs.tests-prep.outputs.cypress-tests != '[]'
#
# Previously, if no tests were selected, the branch protection check that
# requires the cypress-tests job to run was not satisfied. This update forces
# the job to always run, and skips each step if no tests are selected.
# Previously, the above conditional was included in the job's if statement.
- name: Checkout vets-website
if: needs.tests-prep.outputs.cypress-tests != '[]'
uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017
- name: Configure AWS credentials
if: needs.tests-prep.outputs.cypress-tests != '[]'
uses: ./.github/workflows/configure-aws-credentials
with:
aws_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: us-gov-west-1
- name: Get va-vsp-bot token
if: needs.tests-prep.outputs.cypress-tests != '[]'
uses: ./.github/workflows/inject-secrets
with:
ssm_parameter: /devops/VA_VSP_BOT_GITHUB_TOKEN
env_variable_name: VA_VSP_BOT_GITHUB_TOKEN
- name: Init Dashboard Data Repo
if: needs.tests-prep.outputs.cypress-tests != '[]'
uses: ./.github/workflows/init-data-repo
- name: Set Up BigQuery Creds
if: needs.tests-prep.outputs.cypress-tests != '[]'
uses: ./.github/workflows/configure-bigquery
- name: Fetch E2E Test Stability Allow List
if: needs.tests-prep.outputs.cypress-tests != '[]'
run: yarn get-allow-list
working-directory: qa-standards-dashboard-data
env:
TEST_TYPE: e2e
- name: Download production build artifact
if: needs.tests-prep.outputs.cypress-tests != '[]'
uses: ./.github/workflows/download-artifact
with:
name: vagovprod.tar.bz2
- name: Unpack build
if: needs.tests-prep.outputs.cypress-tests != '[]'
run: |
mkdir -p build/vagovprod
tar -C build/vagovprod -xjf vagovprod.tar.bz2
- name: Install dependencies
if: needs.tests-prep.outputs.cypress-tests != '[]'
uses: ./.github/workflows/install
timeout-minutes: 20
with:
key: ${{ hashFiles('yarn.lock') }}
yarn_cache_folder: .cache/yarn
path: |
.cache/yarn
/github/home/.cache/Cypress
node_modules
- name: Download Tests to verify
uses: ./.github/workflows/download-artifact
with:
name: e2e-tests-to-test
path: .
- name: Check for newly added disallowed tests
if: needs.tests-prep.outputs.cypress-tests != '[]'
run: node script/github-actions/double-check-allow-list.js
env:
TEST_TYPE: e2e
TEST_PROPERTY: 'TESTS'
- name: Start server
if: needs.tests-prep.outputs.cypress-tests != '[]'
run: node src/platform/testing/e2e/test-server.js --buildtype=vagovprod --port=3001 &
- name: Run Cypress tests
if: needs.tests-prep.outputs.cypress-tests != '[]'
run: node script/github-actions/run-cypress-tests.js
timeout-minutes: 120
env:
CYPRESS_CI: true
STEP: ${{ matrix.ci_node_index }}
APP_URLS: ${{ needs.tests-prep.outputs.app_urls }}
NUM_CONTAINERS: ${{ needs.tests-prep.outputs.num_containers }}
- name: Archive test videos
if: ${{ needs.tests-prep.outputs.cypress-tests != '[]' && failure() }}
uses: ./.github/workflows/upload-artifact
with:
name: cypress-video-artifacts-${{ matrix.ci_node_index }}
path: cypress/videos
- name: Archive test screenshots
if: ${{ needs.tests-prep.outputs.cypress-tests != '[]' && failure() }}
uses: ./.github/workflows/upload-artifact
with:
name: cypress-screenshot-artifacts-${{ matrix.ci_node_index }}
path: cypress/screenshots
- name: Archive Mochawesome test results
if: ${{ needs.tests-prep.outputs.cypress-tests != '[]' && always() }}
uses: ./.github/workflows/upload-artifact
with:
name: cypress-mochawesome-test-results-${{ matrix.ci_node_index }}
path: cypress/results
retention-days: 1
stress-test-cypress-tests:
name: E2E Test Stability Review
runs-on: ubuntu-22.04
timeout-minutes: 120
needs: [build, tests-prep]
if: |
needs.build.result == 'success' &&
needs.tests-prep.result == 'success' &&
needs.tests-prep.outputs.cypress-tests-to-stress-test == 'true' &&
github.ref != 'refs/heads/main'
container:
image: public.ecr.aws/cypress-io/cypress/browsers:node16.13.2-chrome100-ff98
strategy:
fail-fast: false
max-parallel: 10
matrix:
ci_node_index: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
env:
CI_NODE_INDEX: ${{ needs.tests-prep.outputs.ci_node_index }}
steps:
- name: Checkout vets-website
uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017
- name: Configure AWS credentials
uses: ./.github/workflows/configure-aws-credentials
with:
aws_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: us-gov-west-1
- name: Download production build artifact
uses: ./.github/workflows/download-artifact
with:
name: vagovprod.tar.bz2
- name: Unpack build
run: |
mkdir -p build/vagovprod
tar -C build/vagovprod -xjf vagovprod.tar.bz2
- name: Install dependencies
uses: ./.github/workflows/install
timeout-minutes: 20
with:
key: ${{ hashFiles('yarn.lock') }}
yarn_cache_folder: .cache/yarn
path: |
.cache/yarn
/github/home/.cache/Cypress
node_modules
- name: Start server
run: node src/platform/testing/e2e/test-server.js --buildtype=vagovprod --port=3001 &
- name: Download Tests to verify
uses: ./.github/workflows/download-artifact
with:
name: e2e-tests-to-stress-test
path: .
- name: Run Cypress tests
run: node script/github-actions/run-cypress-stress-tests.js
timeout-minutes: 180
env:
CYPRESS_CI: true
STEP: ${{ matrix.ci_node_index }}
APP_URLS: ${{ needs.tests-prep.outputs.app_urls }}
NUM_CONTAINERS: 1
IS_STRESS_TEST: true
- name: Archive test videos
if: ${{ failure() }}
uses: ./.github/workflows/upload-artifact
with:
name: cypress-stress-test-videos-${{ matrix.ci_node_index }}
path: cypress/videos
- name: Archive Mochawesome test results
if: ${{ always() }}
uses: ./.github/workflows/upload-artifact
with:
name: cypress-stress-test-results-${{ matrix.ci_node_index }}
path: cypress/results
retention-days: 1
update-e2e-allow-list:
name: Update E2E Test Stability Allow List
runs-on: ubuntu-22.04
needs:
[
testing-reports-prep,
tests-prep,
stress-test-cypress-tests,
fetch-allow-lists,
]
if: ${{ always() && github.ref != 'refs/heads/main' && needs.tests-prep.outputs.cypress-tests-to-stress-test != '[]' && (needs.stress-test-cypress-tests.result == 'success' || needs.stress-test-cypress-tests.result == 'failure') }}
continue-on-error: true
env:
APPLICATION_LIST: ${{ needs.testing-reports-prep.outputs.app_list }}
steps:
- name: Checkout
uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017
- name: Configure AWS credentials
uses: ./.github/workflows/configure-aws-credentials
with:
aws_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: us-gov-west-1
- name: Get va-vsp-bot token
uses: ./.github/workflows/inject-secrets
with:
ssm_parameter: /devops/VA_VSP_BOT_GITHUB_TOKEN
env_variable_name: VA_VSP_BOT_GITHUB_TOKEN
- name: Init Dashboard Data Repo
uses: ./.github/workflows/init-data-repo
- name: Set Up BigQuery Creds
uses: ./.github/workflows/configure-bigquery
- name: Get AWS IAM role
uses: ./.github/workflows/inject-secrets
with:
ssm_parameter: /frontend-team/github-actions/parameters/AWS_FRONTEND_NONPROD_ROLE
env_variable_name: AWS_FRONTEND_NONPROD_ROLE
- name: Set UUID for Mochawesome reports
run: echo "UUID=$(uuidgen)" >> $GITHUB_ENV
- name: Configure AWS Credentials (2)
uses: ./.github/workflows/configure-aws-credentials
with:
aws_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: us-gov-west-1
role: ${{ env.AWS_FRONTEND_NONPROD_ROLE }}
role_duration: 900
session_name: vsp-frontendteam-githubaction
- name: Download Cypress E2E Mochawesome test results
uses: ./.github/workflows/download-artifact
with:
pattern: cypress-stress-test-results-*
path: qa-standards-dashboard-data/src/allow-list/data
merge-multiple: true
- name: Copy test results to mochawesome directory
run: cp -r qa-standards-dashboard-data/src/allow-list/data qa-standards-dashboard-data/src/testing-reports/data
- name: Download Cypress E2E video artifacts
if: ${{ needs.stress-test-cypress-tests.result == 'failure' }}
uses: ./.github/workflows/download-artifact
with:
pattern: cypress-stress-test-videos-*
path: qa-standards-dashboard-data/videos/${{ env.UUID }}
merge-multiple: true
- name: Download E2E Test Stability Allow List
uses: ./.github/workflows/download-artifact
with:
name: e2e-allow-list
path: qa-standards-dashboard-data
- name: Update E2E Test Stability Allow List
run: yarn update-allow-list
working-directory: qa-standards-dashboard-data
env:
TEST_TYPE: e2e
IS_CI: true
GITHUB_WORKFLOW_URL: ${{ github.server_url}}/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: Create Cypress E2E report
run: yarn cypress-mochawesome-to-bigquery
working-directory: qa-standards-dashboard-data
env:
IS_MASTER_BUILD: false
TEST_EXECUTIONS_TABLE_NAME: cypress_test_suite_executions
TEST_RESULTS_TABLE_NAME: cypress_test_results
TEST_REPORTS_FOLDER_NAME: vets-website-cypress-stress-test-reports
TEST_RETRIES_TABLE_NAME: cypress_retry_records
NUM_CONTAINERS: 1
IS_STRESS_TEST: true
- name: Upload Cypress E2E test videos to s3
if: ${{ needs.stress-test-cypress-tests.result == 'failure' }}
run: aws s3 cp qa-standards-dashboard-data/videos/${{ env.UUID }} s3://testing-tools-testing-reports/vets-website-cypress-stress-test-reports/videos/${{ env.UUID }} --acl public-read --region us-gov-west-1 --recursive