From f2db15b356b17accc6c1fde79081307188188d58 Mon Sep 17 00:00:00 2001 From: Felipe Calvache Date: Sat, 11 Oct 2025 13:17:28 -0500 Subject: [PATCH] Probando CI CD --- .github/workflows/ci.yml | 37 +++-------- .github/workflows/deploy.yml | 33 ++++------ .github/workflows/main_masterchef.yml | 63 ------------------- .../recetas/controller/RecetaController.java | 4 ++ 4 files changed, 24 insertions(+), 113 deletions(-) delete mode 100644 .github/workflows/main_masterchef.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fdd2d1d..5a840ba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,43 +1,24 @@ -name: CI - Maven Tests +name: CI - Test Build on: push: - branches: - - develop + branches: [develop] pull_request: - branches: - - develop - -permissions: - contents: read + branches: [develop] jobs: - build-and-test: + build: runs-on: ubuntu-latest + steps: - - name: Checkout repository + - name: Checkout code uses: actions/checkout@v4 - name: Set up JDK 21 uses: actions/setup-java@v4 with: - distribution: temurin + distribution: 'temurin' java-version: '21' - - name: Cache Maven packages - uses: actions/cache@v4 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- - - - name: Build & run tests - run: mvn -B -DskipTests=false clean test - - - name: Upload test results (JUnit) - if: always() - uses: actions/upload-artifact@v4 - with: - name: test-results - path: target/surefire-reports + - name: Build with Maven + run: mvn clean package -DskipTests=false diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 1a6ed21..956f8a1 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,41 +1,30 @@ -name: CD - Deploy to Azure App Service +name: Deploy to Azure Web App on: push: branches: - main -permissions: - contents: read - packages: write - jobs: - build: + build-and-deploy: runs-on: ubuntu-latest + steps: - name: Checkout code uses: actions/checkout@v4 - - name: Set up JDK 21 + - name: Set up Java uses: actions/setup-java@v4 with: - distribution: temurin + distribution: 'temurin' java-version: '21' - - name: Cache Maven packages - uses: actions/cache@v4 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- - - name: Build with Maven - run: mvn -B -DskipTests=true clean package + run: mvn clean package -DskipTests=true - - name: Deploy to Azure WebApp - uses: azure/webapps-deploy@v2 + - name: 'Deploy to Azure WebApp' + uses: azure/webapps-deploy@v3 with: - app-name: '' # reemplaza o deja en blanco si usas publish-profile - publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} - package: '${{ github.workspace }}/target/*.jar' + app-name: masterchef + publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISH_PROFILE }} + package: target/*.jar diff --git a/.github/workflows/main_masterchef.yml b/.github/workflows/main_masterchef.yml deleted file mode 100644 index e3d8ae0..0000000 --- a/.github/workflows/main_masterchef.yml +++ /dev/null @@ -1,63 +0,0 @@ -# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy -# More GitHub Actions for Azure: https://github.com/Azure/actions - -name: Build and deploy JAR app to Azure Web App - masterchef - -on: - push: - branches: - - main - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-latest - permissions: - contents: read #This is required for actions/checkout - - steps: - - uses: actions/checkout@v4 - - - name: Set up Java version - uses: actions/setup-java@v4 - with: - java-version: '21' - distribution: 'microsoft' - - - name: Build with Maven - run: mvn clean install - - - name: Upload artifact for deployment job - uses: actions/upload-artifact@v4 - with: - name: java-app - path: '${{ github.workspace }}/target/*.jar' - - deploy: - runs-on: ubuntu-latest - needs: build - permissions: - id-token: write #This is required for requesting the JWT - contents: read #This is required for actions/checkout - - steps: - - name: Download artifact from build job - uses: actions/download-artifact@v4 - with: - name: java-app - - - name: Login to Azure - uses: azure/login@v2 - with: - client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_46F02318532F456482A7C5CDB075CAC7 }} - tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_C9F9E64289C741D7825F4D6BE2B0DEFC }} - subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_71BAA938847B4D73B7019B26889F883A }} - - - name: Deploy to Azure Web App - id: deploy-to-webapp - uses: azure/webapps-deploy@v3 - with: - app-name: 'masterchef' - slot-name: 'Production' - package: '*.jar' - \ No newline at end of file diff --git a/src/main/java/com/masterchef/recetas/controller/RecetaController.java b/src/main/java/com/masterchef/recetas/controller/RecetaController.java index 3553cb2..de75570 100644 --- a/src/main/java/com/masterchef/recetas/controller/RecetaController.java +++ b/src/main/java/com/masterchef/recetas/controller/RecetaController.java @@ -1,3 +1,7 @@ +/** + * Probandooooo + */ + package com.masterchef.recetas.controller; import com.masterchef.recetas.model.Receta;