Skip to content

Commit

Permalink
Merge branch 'add-ci-workflow' of https://github.com/codeurjc-student…
Browse files Browse the repository at this point in the history
…s/2024-bits-of-flavor into add-ci-workflow
  • Loading branch information
jperezsa2020 committed Jan 23, 2025
2 parents 0cab80d + ffd87fa commit 335c958
Showing 1 changed file with 41 additions and 5 deletions.
46 changes: 41 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Java CI with Maven
on:
workflow_dispatch:
push:

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -15,7 +15,43 @@ jobs:
with:
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Build with Maven
working-directory: backend
run: mvn -B package --file pom.xml

- name: Build and Run Spring Boot Backend
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
echo ok
npm install
echo ok2
npm run build --prod
echo ok3
nohup npx http-server ./dist/[frontend] -p 4200 &
- name: Run Spring Boot tests
run: |
cd ./backend
mvn test
- 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

0 comments on commit 335c958

Please sign in to comment.