-
Notifications
You must be signed in to change notification settings - Fork 0
103 lines (87 loc) · 3.11 KB
/
tests.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
name: Run Cypress Tests
on:
pull_request:
branches:
- feat/clevercloud
- main
jobs:
test:
runs-on: ubuntu-latest
services:
db:
image: postgres:16-alpine
env:
POSTGRES_USER: user
POSTGRES_PASSWORD: password
POSTGRES_DB: jdma
ports:
- 5432:5432
mailhog:
image: mailhog/mailhog
ports:
- 8025:8025
- 1025:1025
steps:
# 1. Checkout du code
- name: Checkout code
uses: actions/checkout@v3
# 2. Copier le fichier .env.example vers .env
- name: Copy .env.example to .env
run: |
cp webapp-backoffice/.env.example webapp-backoffice/.env
cp webapp-form/.env.example webapp-form/.env
# 3. Configuration de Node.js
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 20
cache: "yarn"
cache-dependency-path: |
webapp-backoffice/yarn.lock
webapp-form/yarn.lock
# 4. Installer les dépendances et générer le client Prisma pour `webapp-backoffice`
- name: Install dependencies and generate Prisma client for webapp-backoffice
run: |
cd webapp-backoffice
yarn install
npx prisma generate
npx prisma migrate reset --force
# 5. Installer les dépendances et générer le client Prisma pour `webapp-form`
- name: Install dependencies and generate Prisma client for webapp-form
run: |
cd webapp-form
yarn install
npx prisma generate
# 6. Construire `webapp-backoffice`
- name: Build webapp-backoffice
run: |
cd webapp-backoffice
yarn build
nohup yarn start &
# 7. Construire `webapp-form`
- name: Build webapp-form
run: |
cd webapp-form
yarn build
nohup yarn startB &
# 8. Attendre que les services soient prêts
- name: Wait for services to be ready
run: |
echo "Waiting for webapp-backoffice to be ready..."
until curl -s http://localhost:3000 > /dev/null; do echo "Waiting for webapp-backoffice..."; sleep 5; done
echo "Waiting for webapp-form to be ready..."
until curl -s http://localhost:3001 > /dev/null; do echo "Waiting for webapp-form..."; sleep 5; done
echo "Waiting for MailHog to be ready..."
until curl -s http://localhost:8025 > /dev/null; do echo "Waiting for MailHog..."; sleep 5; done
# 9. Exécuter les tests Cypress pour `webapp-backoffice`
- name: Run Cypress tests for webapp-backoffice
working-directory: ./webapp-backoffice
run: npx cypress run --spec "cypress/e2e/jdma/launcher.cy.js" --headed --browser chrome
# 10. Vérifier si MailHog reçoit les emails
- name: Check MailHog for received emails
run: curl http://localhost:8025/api/v2/messages
# 11. Arrêter les applications démarrées
- name: Stop applications
run: |
pkill -f "yarn start" || true
pkill -f "yarn startB" || true