-
Notifications
You must be signed in to change notification settings - Fork 4
315 lines (270 loc) · 10.5 KB
/
container-ecr-viewer.yaml
File metadata and controls
315 lines (270 loc) · 10.5 KB
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
name: Test ecr-viewer Container
on:
pull_request:
branches:
- "**"
paths:
- containers/ecr-viewer/**
- containers/fhir-converter/**
- .github/workflows/container-ecr-viewer.yaml
merge_group:
types:
- checks_requested
push:
branches:
- main
paths-ignore:
- pyproject.toml
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CONTAINER: ecr-viewer
NODE_VERSION: 24 # Adjust the Node.js version as needed
jobs:
javascript-linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: ${{env.NODE_VERSION}}
- name: Lint javascript for ${{env.CONTAINER}}
working-directory: ./containers/${{env.CONTAINER}}
run: |
npm ci
npm run lint
npm run lint:tsc
test-node-containers:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: ${{env.NODE_VERSION}}
- name: Install dependencies
working-directory: ./containers/${{env.CONTAINER}}
run: npm install
- name: Run tests
working-directory: ./containers/${{env.CONTAINER}}
run: npm test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
flags: ${{ env.CONTAINER }}
build-container:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build ${{ env.CONTAINER }} Container
uses: docker/build-push-action@v7
with:
context: ./containers/${{ env.CONTAINER }}
file: ./containers/${{ env.CONTAINER }}/Dockerfile
push: false
cache-from: type=gha
cache-to: type=gha,mode=max
e2e-tests:
strategy:
fail-fast: false
matrix:
include:
- config: AWS_SQLSERVER_DUAL
azure_ad: true
schema: extended
endpoint: process-ecr
- config: GCP_PG_DUAL
azure_ad: false
schema: core
endpoint: process-zip
- config: AWS_INTEGRATED
azure_ad: false
endpoint: process-zip
- config: AZURE_PG_NON_INTEGRATED
azure_ad: true
schema: core
endpoint: process-ecr
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Bail out if Dependabot and Azure AD
if: ${{ matrix.azure_ad && github.actor == 'dependabot[bot]'}}
uses: actions/github-script@v8
with:
script: |
core.setFailed(
`Dependabot can't run e2e tests against Azure AD due to lack of access to secrets 🔐. Run manually if needed for PR review.`
)
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: ${{env.NODE_VERSION}}
- name: Set up env vars
working-directory: ./containers/${{env.CONTAINER}}
run: |
npm run setup-local-env
../../setup-env.sh ../orchestration/.env ../orchestration/.env.sample
- name: Set CONFIG_NAME to ${{ matrix.config }}
working-directory: ./containers/${{env.CONTAINER}}
run: |
sed -i 's/AWS_SQLSERVER_DUAL/${{ matrix.config }}/' .env.local
- name: Set METADATA_DATABASE_SCHEMA to ${{ matrix.schema }}
working-directory: ./containers/${{env.CONTAINER}}
run: |
echo "METADATA_DATABASE_SCHEMA=${{ matrix.schema }}" >> .env.local
- name: Set up Azure AD
if: ${{ matrix.azure_ad }}
working-directory: ./containers/${{env.CONTAINER}}
run: |
sed -i 's/AUTH_PROVIDER=.*$/AUTH_PROVIDER=ad/' .env.local
sed -i 's/AUTH_CLIENT_ID=.*$/AUTH_CLIENT_ID=${{ secrets.AZURE_AD_CLIENT_ID }}/' .env.local
sed -i 's/AUTH_CLIENT_SECRET=.*$/AUTH_CLIENT_SECRET=${{ secrets.AZURE_AD_CLIENT_SECRET }}/' .env.local
sed -i 's/AUTH_ISSUER=.*$/AUTH_ISSUER=${{ secrets.AZURE_AD_ISSUER }}/' .env.local
sed -i 's/AUTH_ADMIN_USER=.*$/AUTH_ADMIN_USER=${{ secrets.AZURE_ADMIN_USER }}/' .env.local
sed -i 's/AUTH_ADMIN_PASSWORD=.*$/AUTH_ADMIN_PASSWORD=${{ secrets.AZURE_ADMIN_PASSWORD }}/' .env.local
sed -i 's/AUTH_STANDARD_USER=.*$/AUTH_STANDARD_USER=${{ secrets.AZURE_STANDARD_USER }}/' .env.local
sed -i 's/AUTH_STANDARD_PASSWORD=.*$/AUTH_STANDARD_PASSWORD=${{ secrets.AZURE_STANDARD_PASSWORD }}/' .env.local
- name: Set UPLOAD_URL to ${{ matrix.endpoint }}
working-directory: ./containers/${{env.CONTAINER}}
run: |
echo "UPLOAD_URL=http://host.docker.internal:3000/ecr-viewer/api/${{ matrix.endpoint }}" >> .env.local
- name: Install dependencies
working-directory: ./containers/${{env.CONTAINER}}
run: npm ci
- name: Install Playwright Browsers
working-directory: ./containers/${{env.CONTAINER}}
run: npm run test:e2e:install
- name: Run local docker and wait for it to be ready
working-directory: ./containers/${{env.CONTAINER}}
run: npm run local-docker:silent && ./tests/e2e/waitForUrl.sh localhost:3000/ecr-viewer/api/health-check ${{ !matrix.azure_ad && 'localhost:8071/health/ready' || '' }}
env:
APP_VERSION: vTest
- name: Run Playwright tests - Migrations
working-directory: ./containers/${{env.CONTAINER}}
run: npm run test:e2e:migrations
- name: Get docker logs
if: ${{ !cancelled() }}
working-directory: ./containers/${{env.CONTAINER}}/tests/e2e
shell: bash
run: |
echo "Saving $CONTAINER logs"
docker compose --profile "*" logs --timestamps &>> e2e-run.log
- name: Docker down
working-directory: ./containers/${{env.CONTAINER}}
run: docker compose --profile "*" down
- name: Upload playwright report - Migrations
uses: actions/upload-artifact@v7
if: ${{ !cancelled() }}
with:
name: playwright-report-migrations-${{ matrix.config }}
path: containers/${{env.CONTAINER}}/playwright-report/
retention-days: 5
- name: Run seed data conversion
working-directory: ./containers/${{env.CONTAINER}}
run: npm run convert-seed-data
env:
SEED_DATA_DIRECTORIES: star-wars
- name: Run local docker and wait for it to be ready
working-directory: ./containers/${{env.CONTAINER}}
run: npm run local-docker:silent && ./tests/e2e/waitForUrl.sh localhost:3000/ecr-viewer/api/health-check ${{ !matrix.azure_ad && 'localhost:8071/health/ready' || '' }}
- name: Seed standard user and COVID program
working-directory: ./containers/${{env.CONTAINER}}
run: npm run test:e2e:seed-user-prog
- name: Run Playwright tests
working-directory: ./containers/${{env.CONTAINER}}
run: npm run test:e2e
- name: Get docker logs
if: ${{ !cancelled() }}
working-directory: ./containers/${{env.CONTAINER}}/tests/e2e
shell: bash
run: |
echo "Saving $CONTAINER logs"
docker compose --profile "*" logs --timestamps &>> e2e-run.log
- name: Docker down
working-directory: ./containers/${{env.CONTAINER}}
run: docker compose --profile "*" down
- name: Upload playwright report
uses: actions/upload-artifact@v7
if: ${{ !cancelled() }}
with:
name: playwright-report-${{ matrix.config }}
path: containers/${{env.CONTAINER}}/playwright-report/
retention-days: 5
- name: Upload Lighthouse report
uses: actions/upload-artifact@v7
if: ${{ !cancelled() }}
with:
name: lighthouse-report-${{ matrix.config }}
path: containers/${{env.CONTAINER}}/lighthouse/
retention-days: 5
- name: Get docker logs
if: ${{ !cancelled() }}
working-directory: ./containers/${{env.CONTAINER}}/tests/e2e
shell: bash
run: |
echo "Saving $CONTAINER logs"
docker compose --profile "*" logs --timestamps &>> e2e-run.log
- name: Archive docker logs
if: ${{ always() }}
uses: actions/upload-artifact@v7
with:
name: logs-${{ matrix.config }}
path: ./containers/${{env.CONTAINER}}/tests/e2e/e2e-run.log
retention-days: 5
- name: Docker down
working-directory: ./containers/${{env.CONTAINER}}
run: docker compose --profile "*" down
integration-tests:
strategy:
fail-fast: false
matrix:
db_type: ["pg", "sqlserver"]
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: ${{env.NODE_VERSION}}
- name: Install dependencies
working-directory: ./containers/${{env.CONTAINER}}
run: npm ci
- name: Set up env vars
working-directory: ./containers/${{env.CONTAINER}}
run: |
npm run setup-local-env
../../setup-env.sh ../orchestration/.env ../orchestration/.env.sample
- name: upcase db type
shell: bash
run: echo "DB_TYPE=$(echo "${{matrix.db_type}}" | tr '[:lower:]' '[:upper:]' )" >> "${GITHUB_ENV}"
- name: Set config for db type
working-directory: ./containers/${{env.CONTAINER}}
run: |
sed -i 's/AWS_.*_DUAL/AWS_${DB_TYPE}_NON_INTEGRATED/' .env.local
- name: Run local docker and wait for it to be ready
working-directory: ./containers/${{env.CONTAINER}}
run: npm run local-docker:silent && ./tests/e2e/waitForUrl.sh localhost:3000/ecr-viewer/api/health-check
- name: Run integration tests - ${{ matrix.db_type }}
working-directory: ./containers/${{env.CONTAINER}}
run: npm run test:integration:${{ matrix.db_type }}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
flags: ${{ env.CONTAINER }}
- name: Docker down
working-directory: ./containers/${{env.CONTAINER}}
run: docker compose --profile "*" down