-
Notifications
You must be signed in to change notification settings - Fork 20
274 lines (245 loc) · 9.09 KB
/
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
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
name: Tests e2e
on: pull_request
jobs:
back:
runs-on: ubuntu-latest
name: Tests e2e
steps:
# Hosts
- name: Add hosts to /etc/hosts
run: |
sudo echo "127.0.0.1 api.trackdechets.local" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 trackdechets.local" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 es.trackdechets.local" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 notifier.trackdechets.local" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 redis postgres elasticsearch mongodb" | sudo tee -a /etc/hosts
# Trackdéchets
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm ci
- name: Start containers with docker
run: docker compose up -d
- name: Init DB & ES index
run: |
npx nx run back:codegen
npx nx run @td/prisma:generate
npx nx run @td/codegen-ui:build
TERM=xterm bash ./scripts/deploy-db.sh
- name: Start TD applications
run: |
npx nx run api:serve >> /tmp/td-api.log &
sleep 1s
npx nx run queues-indexation:serve >> /tmp/td-queues-indexation.log &
sleep 1s
npx nx run queues-webhooks:serve >> /tmp/td-queues-webhooks.log &
sleep 1s
npx nx run queues-runner:serve >> /tmp/td-queues-runner.log &
sleep 1s
npx nx run notifier:serve >> /tmp/td-notifier.log &
sleep 1s
npx nx run front:serve >> /tmp/td-front.log &
sleep 1s
# Wait
- name: Wait until the API starts
run: |
until [ "$(curl -s -w '%{http_code}' -o /dev/null "api.trackdechets.local")" -eq 400 ]
do
printf 'Waiting for the API to start...\n'
sleep 1
done
# Debug
# - name: Testing API resolution
# run: |
# ping -c 2 api.trackdechets.local
# curl api.trackdechets.local
# - name: Testing UI resolution
# run: |
# ping -c 2 trackdechets.local
# curl trackdechets.local/login
# curl trackdechets.local/src/index.tsx
# - name: Testing ES resolution
# run: |
# ping -c 2 es.trackdechets.local
# curl es.trackdechets.local
# - name: Testing Notifier resolution
# run: |
# ping -c 2 notifier.trackdechets.local
# curl notifier.trackdechets.local
# Show logs
# - name: Show logs
# run: |
# cat /tmp/td-api.log
# cat /tmp/td-queues-indexation.log
# cat /tmp/td-queues-webhooks.log
# cat /tmp/td-queues-runner.log
# cat /tmp/td-notifier.log
# cat /tmp/td-front.log
# Playwright
- name: Install Playwright Browsers
run: npx playwright install chromium --with-deps
# Debug ssh version
# - name: Setup upterm session
# uses: lhotari/action-upterm@v1
# with:
# ## limits ssh access and adds the ssh public key for the user which triggered the workflow
# limit-access-to-actor: true
# ## If no one connects after 5 minutes, shut down server.
# # wait-timeout-minutes: 5
- name: Run Playwright tests
run: npx nx run e2e:ci
env:
# API
API_HOST: api.trackdechets.local
API_PORT: 4000
API_URL_SCHEME: http
USE_XFF_HEADER: true
SESSION_COOKIE_SECURE: false
QUEUE_MONITOR_TOKEN: token
DATABASE_URL: "postgresql://trackdechets:password@postgres:5432/e2e?schema=default$default"
API_TOKEN_SECRET: any_secret
INSEE_SECRET: unset
SESSION_SECRET: any_secret
SESSION_NAME: connect.sid
SESSION_COOKIE_HOST: trackdechets.local
# Notifier
NOTIFIER_PORT: 4001
NOTIFIER_HOST: notifier.trackdechets.local
# UI
UI_HOST: trackdechets.local
UI_URL_SCHEME: http
DEVELOPERS_HOST: developers.trackdechets.local
DEVELOPERS_URL_SCHEME: http
# Emailing
QUEUE_NAME_SENDMAIL: td-e2e-tests-queue
EMAIL_BACKEND: console
SENDER_EMAIL_ADDRESS: [email protected]
SENDER_NAME: Trackdéchets
SIB_APIKEY: unset
SIB_BASE_URL: "http://mailservice"
MAIN_TEMPLATE_ID: 1
PRODUCER_SECOND_ONBOARDING_TEMPLATE_ID: 22
PROFESSIONAL_SECOND_ONBOARDING_TEMPLATE_ID: 33
SECURITY_CODE_RENEWAL_TEMPLATE_ID: 33
FIRST_ONBOARDING_TEMPLATE_ID: 246
PROFESIONAL_SECOND_ONBOARDING_TEMPLATE_ID: 250
VERIFIED_FOREIGN_TRANSPORTER_COMPANY_TEMPLATE_ID: 247
NOTIFY_DREAL_WHEN_FORM_DECLINED: false
TZ: Europe/Paris
# Trello
TRELLO_API_KEY: unset
TRELLO_TOKEN: unset
TRELLO_ALERTS_LIST_ID: unset
# S3
S3_ENDPOINT: unset
S3_REGION: unset
S3_ACCESS_KEY_ID: unset
S3_SECRET_ACCESS_KEY: unset
S3_BUCKET: unset
S3_BSD_TEMPLATES_ACCESS_KEY_ID: unset
S3_BSD_TEMPLATES_SECRET_ACCESS_KEY: unset
S3_BSD_TEMPLATES_BUCKET=td-bsds-template: unset
# Nginx
NGINX_PROXY_HOST: 172.17.0.1
NGINX_NETWORK_MODE: bridge
# Elastic Search
ELASTIC_SEARCH_URL: http://elasticsearch:9200
ELASTICSEARCH_BSDS_ALIAS_NAME: bsds-e2e
ELASTIC_SEARCH_HOST: es.trackdechets.local
TD_COMPANY_ELASTICSEARCH_IGNORE_SSL: false
TD_COMPANY_ELASTICSEARCH_URL: ${{ secrets.TD_COMPANY_ELASTICSEARCH_URL }}
TD_COMPANY_ELASTICSEARCH_INDEX: stocketablissement-production
TD_COMPANY_ELASTICSEARCH_CACERT: ${{ secrets.TD_COMPANY_ELASTICSEARCH_CACERT }}
# Docker
DOCKER_RESTART_POLICY: unless-stopped
# Gotenberg
GOTENBERG_TOKEN: unset
GOTENBERG_URL: unset
# Scalingo
SCALINGO_TOKEN: unset
BULK_INDEX_SCALINGO_ACTIVE_AUTOSCALING: unset
BULK_INDEX_SCALINGO_CONTAINER_NAME: unset
BULK_INDEX_SCALINGO_CONTAINER_SIZE_UP: unset
BULK_INDEX_SCALINGO_CONTAINER_SIZE_DOWN: unset
SCALINGO_API_URL: unset
SCALINGO_APP_NAME: unset
SCALINGO_CERT: unset
# Redis
REDIS_URL: redis://redis:6379
BULK_INDEX_BATCH_SIZE: 100
# Mongo
MONGO_URL: mongodb://trackdechets:password@mongodb:27017
# Storybook
STORYBOOK_HOST: sb.trackdechets.local
# Vite
VITE_API_ENDPOINT: http://api.trackdechets.local
VITE_NOTIFIER_ENDPOINT: http://notifier.trackdechets.local
VITE_URL_SCHEME: http
VITE_HOSTNAME: trackdechets.local
# Misc
CRON_ONBOARDING_SCHEDULE: false
VERIFY_COMPANY: false
ALLOW_TEST_COMPANY: true
VITE_ALLOW_TEST_COMPANY: true
STARTUP_FILE: unset
TRUST_PROXY_HOPS: 1
CONTAINER: unset
QUEUE_NAME_COMPANY: unset
OTEL_SDK_DISABLED: true
MAX_REQUESTS_PER_WINDOW: unset
NODE_ENV: test
VIRTUAL_HOST: $API_HOST
LETSENCRYPT_HOST: $API_HOST
POST_BACKEND: console
REGISTRY_WHITE_LIST_IP: "11.11.11.11"
OIDC_PRIVATE_KEY: |
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDCFg4UrY5xtulv
/NXKmL1J4qI1SopAfT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Q/5jX
uxDu37KAhqeC65sHLrmIMUt4Zdr+DRyZK3aIDNEAesPMjw/X6lCXYp1ZISD2yyym
MFGH8X8CIkstI9Faf9vf6PJKSFrC1/HA7wq17VCwrUzLvrljTMW8meM/CwKBgCpo
2leGHLFQFKeM/iF1WuYbR1pi7gcmhY6VyTowARFDdOOu8GXYI5/bz0afvCGvAMho
DJCREv7lC/zww6zCTPYG+HOj+PjXlJFba3ixjIxYwPvyEJiDK1Ge18sB7Fl8dHNq
C5ayaqCqN1voWYUdGzxU2IA1E/5kVo5O8FesJeOhAoGBAImJbZFf+D5kA32Xxhac
59lLWBCsocvvbd1cvDMNlRywAAyhsCb1SuX4nEAK9mrSBdfmoF2Nm3eilfsOds0f
K5mX069IKG82CMqh3Mzptd7e7lyb9lsoGO0BAtjho3cWtha/UZ70vfaMzGuZ6JmQ
ak6k+8+UFd93M4z0Qo74OhXB
-----END PRIVATE KEY----
# Public key only for testing purposes
OIDC_PUBLIC_KEY: |
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwhYOFK2Ocbbpb/zVypi9
SeKiNUqKQH0zTKN1+6fpCTu6ZalGI82s7XK3tan4dJt90ptUPKD2zvxqTzFNfx4H
HHsrYCf2+FMLn1VTJfQazA2BvJqAwcpW1bqRUEty8tS/Yv4hRvWfQPcc2Gc3+/fQ
OOW57zVy+rNoJc744kb30NjQxdGp03J2S3GLQu7oKtSDDPooQHD38PEMNnITf0pj
+KgDPjymkMGoJlO3aKppsjfbt/AH6GGdRghYRLOUwQU+h+ofWHR3lbYiKtXPn5dN
24kiHy61e3VAQ9/YAZlwXC/99GGtw/NpghFAuM4P1JDn0DppJldy3PGFC0GfBCZA
SwIDAQAB
-----END PUBLIC KEY-----
WEBHOOK_TOKEN_ENCRYPTION_KEY: abcdefgh12345678abcdefgh12345678
# Gerico
GERICO_API_URL: http://gerico.test/api
GERICO_API_KEY: xyz
GERICO_WEBHOOK_SLUG: secret-slug
GERICO_WEBHOOK_TOKEN: abcdef