-
Notifications
You must be signed in to change notification settings - Fork 13
127 lines (105 loc) · 3.32 KB
/
ci-frontend-e2e.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
name: Frontend E2E Tests
on:
workflow_call:
pull_request:
paths:
- frontend/**
- .github/workflows/ci-frontend-e2e.yml
defaults:
run:
working-directory: ./frontend
env:
NODE_VERSION: 18
LOCKFILE_PATH: ./frontend/package-lock.json
PACKAGE_MANAGER: npm
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
e2e-tests:
name: Run E2E Tests
runs-on: ubuntu-latest
strategy:
matrix:
shard: [1, 2, 3]
total_shards: [3]
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: ${{ env.PACKAGE_MANAGER }}
cache-dependency-path: ${{ env.LOCKFILE_PATH }}
- run: |
npm ci
npx playwright install --with-deps
- name: Start API Server for e2e tests
run: |
cd ../api
make init db-seed-local populate-search-opportunities start &
cd ../frontend
# Ensure the API wait script is executable
chmod +x ../api/bin/wait-for-api.sh
../api/bin/wait-for-api.sh
shell: bash
- name: Build a prod version of the site
run: |
cat .env.development >> .env.local
npm run build
- name: Run e2e tests (Shard ${{ matrix.shard }}/${{ matrix.total_shards }})
env:
CI: true
TOTAL_SHARDS: ${{ matrix.total_shards }}
CURRENT_SHARD: ${{ matrix.shard }}
run: npm run test:e2e
- name: Verify Blob Report Directory
run: |
echo "Contents of blob-report directory:"
ls -R blob-report || echo "blob-report directory not found"
- name: Upload Blob Report
if: always()
uses: actions/upload-artifact@v4
with:
name: blob-report-shard-${{ matrix.shard }}
path: /home/runner/work/simpler-grants-gov/simpler-grants-gov/frontend/blob-report
retention-days: 1
create-report:
name: Create Merged Test Report
if: ${{ !cancelled() }}
needs: [e2e-tests]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: ${{ env.PACKAGE_MANAGER }}
cache-dependency-path: ${{ env.LOCKFILE_PATH }}
- run: |
npm ci
npx playwright install --with-deps
- name: Download All Blob Reports
uses: actions/download-artifact@v4
with:
path: frontend/all-blob-reports
pattern: blob-report-shard-*
merge-multiple: true
- name: Verify Downloaded Artifacts
run: |
echo "Contents of all-blob-reports after download:"
ls -R all-blob-reports*
- name: Merge Blob Reports into HTML
run: npx playwright merge-reports --reporter html ./all-blob-reports
- name: Verify Downloaded Artifacts
run: |
echo "Contents of all-blob-reports after download:"
ls -R playwright*
- name: Upload Merged HTML Report
uses: actions/upload-artifact@v4
with:
name: merged-html-report
path: frontend/playwright-report
retention-days: 30