From 6f04d469cc7d4ffd97659fdc7909d3013d122612 Mon Sep 17 00:00:00 2001 From: brunoMarchiEncora <117365587+brunoMarchiEncora@users.noreply.github.com> Date: Thu, 16 Mar 2023 12:21:18 -0300 Subject: [PATCH] Change backend and legacy to matrix format on github action (#404) --- .github/workflows/pr-open.yml | 60 ++++++++--------------------------- 1 file changed, 14 insertions(+), 46 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index bdbe1fb461..5c988a2bcf 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -99,13 +99,13 @@ jobs: strategy: matrix: package: [database, frontend, common] - include: + include: - package: database triggers: ('database/') - package: common triggers: ('common/') - package: frontend - triggers: ('frontend/') + triggers: ('frontend/') steps: - uses: actions/checkout@v3 @@ -117,54 +117,22 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} triggers: ${{ matrix.triggers }} - build-backend: - name: Backend Image Build - env: - COMPONENT: backend - ZONE: ${{ github.event.number }} - NAME: ghcr.io/${{ github.repository }}/backend:${{ github.event.number }} - runs-on: ubuntu-latest + build-java: permissions: contents: read packages: write - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - uses: graalvm/setup-graalvm@v1 - with: - version: '22.3.0' - java-version: '17' - components: 'native-image' - github-token: ${{ secrets.GITHUB_TOKEN }} - - - name: Build App - run: | - cd backend - chmod +x ./mvnw - ./mvnw -Pnative clean spring-boot:build-image \ - -Dspring-boot.build-image.imageName="${{ env.NAME }}" \ - -Doci.revision=${{ github.event.number }} -q + strategy: + matrix: + package: [backend, legacy] - - name: Log in to the Container registry - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + name: ${{ matrix.package }} Image Build + runs-on: ubuntu-latest - - name: Pushing - run: docker push ${{ env.NAME }} - build-legacy: - name: Legacy Image Build env: - COMPONENT: legacy + COMPONENT: ${{ matrix.package }} ZONE: ${{ github.event.number }} - NAME: ghcr.io/${{ github.repository }}/legacy:${{ github.event.number }} - runs-on: ubuntu-latest - permissions: - contents: read - packages: write + NAME: ghcr.io/${{ github.repository }}/${{ matrix.package }}:${{ github.event.number }} + steps: - name: Checkout repository uses: actions/checkout@v3 @@ -178,7 +146,7 @@ jobs: - name: Build App run: | - cd legacy + cd ${{ matrix.package }} chmod +x ./mvnw ./mvnw -Pnative clean spring-boot:build-image \ -Dspring-boot.build-image.imageName="${{ env.NAME }}" \ @@ -198,7 +166,7 @@ jobs: name: Deploy Init needs: - builds - - build-backend + - build-java environment: dev runs-on: ubuntu-22.04 steps: @@ -215,7 +183,7 @@ jobs: deploy-database: name: Deploy Database - needs: + needs: - deploy-init environment: dev runs-on: ubuntu-22.04