From 4ba34f6c802ea9daa51aa2992bbdac8def30f517 Mon Sep 17 00:00:00 2001 From: Anthony LC Date: Tue, 10 Sep 2024 15:33:21 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=85(CI)=20add=20ngnix=20for=20the=20front?= =?UTF-8?q?end?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Because of the Next.js bug with the 404 on the dynamic routes, we are not able to assert some behaviors from the e2e tests and the CI. So we are adding a ngnix to the CI e2e tests to be able to route correctly our frontend. --- .github/workflows/impress-frontend.yml | 8 ++++++++ docker-compose.yml | 8 ++++++++ src/frontend/apps/e2e/playwright.config.ts | 6 ++---- src/frontend/apps/impress/conf/default.conf | 1 + 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/.github/workflows/impress-frontend.yml b/.github/workflows/impress-frontend.yml index 32dd72b46..eb463aba7 100644 --- a/.github/workflows/impress-frontend.yml +++ b/.github/workflows/impress-frontend.yml @@ -149,6 +149,10 @@ jobs: run: | make run + - name: Start Nginx for the frontend + run: | + docker compose up --force-recreate -d nginx-front + - name: Apply DRF migrations run: | make migrate @@ -223,6 +227,10 @@ jobs: run: | make run + - name: Start Nginx for the frontend + run: | + docker compose up --force-recreate -d nginx-front + - name: Apply DRF migrations run: | make migrate diff --git a/docker-compose.yml b/docker-compose.yml index 7a1ee916d..f01b48d1e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -121,6 +121,14 @@ services: depends_on: - keycloak + nginx-front: + image: nginx:1.25 + ports: + - "3000:3000" + volumes: + - ./src/frontend/apps/impress/conf/default.conf:/etc/nginx/conf.d/default.conf + - ./src/frontend/apps/impress/out:/usr/share/nginx/html + dockerize: image: jwilder/dockerize diff --git a/src/frontend/apps/e2e/playwright.config.ts b/src/frontend/apps/e2e/playwright.config.ts index 08caf07fa..401433c19 100644 --- a/src/frontend/apps/e2e/playwright.config.ts +++ b/src/frontend/apps/e2e/playwright.config.ts @@ -32,12 +32,10 @@ export default defineConfig({ }, webServer: { - command: `cd ../.. && yarn app:${ - process.env.CI ? 'start -p ' : 'dev --port ' - } ${PORT}`, + command: !process.env.CI ? `cd ../.. && yarn app:dev --port ${PORT}` : '', url: baseURL, timeout: 120 * 1000, - reuseExistingServer: !process.env.CI, + reuseExistingServer: true, }, /* Configure projects for major browsers */ diff --git a/src/frontend/apps/impress/conf/default.conf b/src/frontend/apps/impress/conf/default.conf index cb639442b..684bf17bc 100644 --- a/src/frontend/apps/impress/conf/default.conf +++ b/src/frontend/apps/impress/conf/default.conf @@ -1,5 +1,6 @@ server { listen 8080; + listen 3000; server_name localhost; root /usr/share/nginx/html;