-
Notifications
You must be signed in to change notification settings - Fork 14
156 lines (132 loc) · 4.35 KB
/
container-ecr-viewer.yaml
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
name: Test ecr-viewer Container
on:
pull_request:
branches:
- "**"
paths:
- containers/ecr-viewer/**
- containers/fhir-converter/**
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: 18 # Adjust the Node.js version as needed
jobs:
javascript-linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Lint javascript for ${{env.CONTAINER}}
working-directory: ./containers/${{env.CONTAINER}}
run: |
npm ci
npm run lint
test-node-containers:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{env.NODE_VERSION}}
- name: Install dependencies
working-directory: ./containers/${{env.CONTAINER}} # Navigate to your Node.js app directory
run: npm install
- name: Run tests
working-directory: ./containers/${{env.CONTAINER}} # Navigate to your Node.js app directory
run: npm test
e2e-test:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{env.NODE_VERSION}}
- name: Install dependencies
working-directory: ./containers/${{env.CONTAINER}} # Navigate to your Node.js app directory
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Set up env vars
run: npm run setup-local-env
working-directory: ./containers/${{env.CONTAINER}}
- name: Run seed data conversion
run: npm run convert-seed-data:build
working-directory: ./containers/${{env.CONTAINER}}
- name: Run Playwright tests
working-directory: ./containers/${{env.CONTAINER}}
run: npx @dotenvx/dotenvx run -f .env.local -- sh -c 'docker compose -f ./docker-compose.yml --profile ${SOURCE} --profile ${METADATA_DATABASE_TYPE} up -d' && npm run test:e2e
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: containers/${{env.CONTAINER}}/playwright-report/
retention-days: 30
lighthouse:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{env.NODE_VERSION}}
- name: Start app
run: docker compose --env-file .env.test --profile postgres --profile ecr-viewer up -d
working-directory: ./containers/${{env.CONTAINER}}
- name: Wait for Application to be ready
run: |
until curl --output /dev/null --silent --head --fail http://localhost:3000/ecr-viewer; do
printf '.'
sleep 5
done
# - name: Run Lighthouse
# uses: treosh/lighthouse-ci-action@v12
# with:
# configPath: "./lighthouserc.yaml"
# uploadArtifacts: true
build-container:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build ${{ env.CONTAINER }} Container
uses: docker/build-push-action@v3
with:
context: ./containers/${{ env.CONTAINER }}
file: ./containers/${{ env.CONTAINER }}/Dockerfile
push: false
cache-from: type=gha
cache-to: type=gha,mode=max
convert-data:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{env.NODE_VERSION}}
- name: Set up env vars
run: npm run setup-local-env
working-directory: ./containers/${{env.CONTAINER}}
- name: Run seed data conversion
run: npm run convert-seed-data:build
working-directory: ./containers/${{env.CONTAINER}}