Skip to content

Update BofApplicationTests.java #36

Update BofApplicationTests.java

Update BofApplicationTests.java #36

Workflow file for this run

name: Java CI with Maven
on:
workflow_dispatch:
push:
jobs:
build:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0.22
options: >-
--env MYSQL_ROOT_PASSWORD=password
--env MYSQL_DATABASE=mydb
--env MYSQL_USER=bof
--env MYSQL_PASSWORD=tomate
--publish 3306:3306
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Build and Run Spring Boot Backend
env:
DATABASE_URL: jdbc:mysql://localhost:3306/mydb
run: |
cd ./backend
mvn clean package -DskipTests
nohup java -jar target/*.jar &
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 20.17.0
# Build y ejecución del Frontend (sin tests)
- name: Build and Run Angular Frontend
run: |
cd ./frontend
npm ci
npm install -g @angular/cli
npm run build -- --configuration production --base-href="/new/"
nohup ng serve --proxy-config proxy.conf.json &
- name: Run Spring Boot test 1
run: |
cd ./backend
mvn test -Dtest=BofApplicationTests.java#anonymousTest
- name: Run Spring Boot test 2
run: |
cd ./backend
mvn test -Dtest=BofApplicationTests.java#adminTest
- name: Run Spring Boot test 3
run: |
cd ./backend
mvn test -Dtest=BofApplicationTests.java#userTest
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
run: |
docker build -t ${{ secrets.DOCKER_USERNAME }}/java_app:2.0 -f docker/Dockerfile .
docker push ${{ secrets.DOCKER_USERNAME }}/java_app:2.0