From 5d91382760eef5bba6832eda103e56be4c1df86a Mon Sep 17 00:00:00 2001 From: AlbertoML1999 <146851709+AlbertoML1999@users.noreply.github.com> Date: Thu, 18 Dec 2025 20:16:21 +0100 Subject: [PATCH 1/3] Revamp CI workflow for complete testing Updated CI workflow to include full testing with unit, integration, and system tests for both backend and frontend. Added Node.js setup and dependency installation steps. --- .github/workflows/complete.yml | 84 ++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 .github/workflows/complete.yml diff --git a/.github/workflows/complete.yml b/.github/workflows/complete.yml new file mode 100644 index 0000000..df7ae42 --- /dev/null +++ b/.github/workflows/complete.yml @@ -0,0 +1,84 @@ +name: CI - Complete +on: + workflow_dispatch: + pull_request: + branches: + - main +jobs: + full-testing: + name: Complete Quality Control (Unit, Integration & System Tests) + runs-on: ubuntu-latest + services: + mysql: + image: mysql:8 + env: + MYSQL_ROOT_PASSWORD: password + MYSQL_DATABASE: goeventsnow_db + ports: + - 3306:3306 + options: --health-cmd="mysqladmin ping --silent" --health-interval=10s --health-timeout=5s --health-retries=5 + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + + - name: Set up Node.js 20 + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + cache-dependency-path: frontend/package-lock.json + + - name: Install Dependencies + run: | + cd frontend + npm install + + + - name: Compile Server & Run Backend Unit, Integration & System Test + run: | + cd backend + mvn clean verify -Dtest="es.goeventsnow.backend.unit.EventTest,es.goeventsnow.backend.api.EventApiTest,es.goeventsnow.backend.integration.EventBBDDTest" + + - name: Run Frontend Unit & Integration tests + run: | + cd frontend + npx ng test --coverage + + + # --- PASO 2: PREPARACIÓN PARA TESTS DE SISTEMA (E2E) --- + + - name: Instalar herramientas de espera + run: sudo apt-get install netcat-openbsd + + - name: Arrancar Backend en segundo plano + env: + SPRING_DATASOURCE_URL: jdbc:mysql://localhost:3306/goeventsnow_db?useSSL=false&serverTimezone=UTC + SPRING_DATASOURCE_PASSWORD: password + run: | + cd backend + mvn spring-boot:run & + echo "Esperando a que el backend esté listo en el puerto 8080..." + timeout 60s sh -c 'until nc -z localhost 8080; do sleep 5; done' + + - name: Arrancar Frontend en segundo plano + run: | + cd frontend + npx ng serve --host 0.0.0.0 --disable-host-check & + echo "Esperando a que el frontend esté listo en el puerto 4200..." + timeout 60s sh -c 'until nc -z localhost 4200; do sleep 5; done' + + # --- PASO 3: EJECUCIÓN TEST DE SISTEMA (SELENIUM) --- + + - name: Ejecutar Test de Sistema (Selenium) + # Este test de Java (backend) probará la UI del frontend (localhost:4200) + # que a su vez llama al backend (localhost:8080) + run: | + cd backend + mvn test -Dtest=es.goeventsnow.backend.e2e.SeleniumTest From 0494c38adfdb66e68f877959b8e98b17fe38c4bd Mon Sep 17 00:00:00 2001 From: AlbertoML1999 <146851709+AlbertoML1999@users.noreply.github.com> Date: Thu, 18 Dec 2025 20:23:00 +0100 Subject: [PATCH 2/3] Update frontend command to remove host check --- .github/workflows/complete.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/complete.yml b/.github/workflows/complete.yml index df7ae42..3924896 100644 --- a/.github/workflows/complete.yml +++ b/.github/workflows/complete.yml @@ -70,7 +70,7 @@ jobs: - name: Arrancar Frontend en segundo plano run: | cd frontend - npx ng serve --host 0.0.0.0 --disable-host-check & + npx ng serve & echo "Esperando a que el frontend esté listo en el puerto 4200..." timeout 60s sh -c 'until nc -z localhost 4200; do sleep 5; done' From d068040f745dc1e90feefde9781dda583b24c7d3 Mon Sep 17 00:00:00 2001 From: AlbertoML1999 <146851709+AlbertoML1999@users.noreply.github.com> Date: Thu, 18 Dec 2025 20:27:56 +0100 Subject: [PATCH 3/3] Update ng serve command to allow external access --- .github/workflows/complete.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/complete.yml b/.github/workflows/complete.yml index 3924896..4b78ead 100644 --- a/.github/workflows/complete.yml +++ b/.github/workflows/complete.yml @@ -70,7 +70,7 @@ jobs: - name: Arrancar Frontend en segundo plano run: | cd frontend - npx ng serve & + npx ng serve --host 0.0.0.0 & echo "Esperando a que el frontend esté listo en el puerto 4200..." timeout 60s sh -c 'until nc -z localhost 4200; do sleep 5; done'