Skip to content

Commit

Permalink
Change backend and legacy to matrix format on github action (#404)
Browse files Browse the repository at this point in the history
  • Loading branch information
brunoMarchiEncora authored Mar 16, 2023
1 parent 37788e2 commit 6f04d46
Showing 1 changed file with 14 additions and 46 deletions.
60 changes: 14 additions & 46 deletions .github/workflows/pr-open.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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 }}" \
Expand All @@ -198,7 +166,7 @@ jobs:
name: Deploy Init
needs:
- builds
- build-backend
- build-java
environment: dev
runs-on: ubuntu-22.04
steps:
Expand All @@ -215,7 +183,7 @@ jobs:

deploy-database:
name: Deploy Database
needs:
needs:
- deploy-init
environment: dev
runs-on: ubuntu-22.04
Expand Down

0 comments on commit 6f04d46

Please sign in to comment.