Frontend test #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker Compose Local Deploy | |
on: | |
push: | |
branches: | |
- main # Cambia 'main' por la rama que quieras monitorizar | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
# 1. Chequear el código | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Navigate to frontend directory | |
working-directory: Frontend | |
# 2. Configurar Node.js 6.0.0 y ejecutar las pruebas de Angular (frontend) | |
- name: Set up Node.js 6.0.0 | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '6.0.0' | |
- name: Install Angular dependencies | |
run: npm install | |
- name: Run Angular unit tests | |
run: npm test -- --watch=false --browsers=ChromeHeadless | |
- name: Run Angular E2E tests | |
run: npm run e2e # Asegúrate de tener un script "e2e" configurado en tu package.json | |
# 3. Configurar Java 21 y ejecutar las pruebas de Spring Boot (backend) | |
- name: Set up Java 21 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '21' | |
- name: Run Spring Boot tests | |
run: mvn test | |
# 4. Configurar Docker | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Deploy with Docker Compose | |
run: | | |
cd Docker | |
docker-compose pull | |
docker-compose up -d --build |