Skip to content

Commit

Permalink
bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
jesussmariscal committed Dec 27, 2024
1 parent b1bb308 commit 2b1cb60
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
25 changes: 17 additions & 8 deletions .github/workflows/testBackend.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
name: CI/CD Backend

on:
push: # Se ejecuta en cada push a cualquier rama
workflow_dispatch: # Permite ejecutar el workflow manualmente
push:
workflow_dispatch:

jobs:
build-and-test:
runs-on: ubuntu-latest

services:
mysql:
image: mysql:8.0.31
image: mysql:8.0.31
env:
MYSQL_ROOT_PASSWORD: 12345678
MYSQL_DATABASE: tfgdb
MYSQL_ROOT_PASSWORD: 12345678
MYSQL_DATABASE: tfgdb
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=15s --health-timeout=10s --health-retries=5

steps:
- name: Checkout code
Expand All @@ -28,9 +28,18 @@ jobs:
java-version: '17'
distribution: 'temurin'

- name: Download wait-for-it
run: |
wget https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh -O ./wait-for-it.sh
chmod +x ./wait-for-it.sh
- name: Build and Test with Maven
run: |
cd ./Backend
# Espera a que MySQL esté listo
echo "--- Waiting for MySQL to be ready ---"
/home/runner/work/2024-ReURJC/2024-ReURJC/Backend/wait-for-it.sh mysql:3306 -t 60
# Ejecutar Maven
mvn clean install -DskipTests
mvn test -Dspring.profiles.active=test
Expand Down
2 changes: 1 addition & 1 deletion Backend/src/main/resources/application-test.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Database Configuration (Ajusta el nombre del servicio si usas Docker Compose)
spring.datasource.url=jdbc:mysql://reurjc_mysql_1:3306/tfgdb
spring.datasource.url=jdbc:mysql://mysql:3306/tfgdb
spring.datasource.username=root
spring.datasource.password=12345678
jwt.secret=change_me
Expand Down
2 changes: 1 addition & 1 deletion Backend/target/classes/application-test.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Database Configuration (Ajusta el nombre del servicio si usas Docker Compose)
spring.datasource.url=jdbc:mysql://reurjc_mysql_1:3306/tfgdb
spring.datasource.url=jdbc:mysql://mysql:3306/tfgdb
spring.datasource.username=root
spring.datasource.password=12345678
jwt.secret=change_me
Expand Down

0 comments on commit 2b1cb60

Please sign in to comment.