Merge pull request #10 from victormoni/develop #46
Workflow file for this run
This file contains hidden or 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: CI | |
| on: | |
| push: | |
| branches: [develop, homolog, master] | |
| pull_request: | |
| branches: [develop, homolog, master] | |
| jobs: | |
| backend: | |
| name: Build & Test Backend | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout do código | |
| uses: actions/checkout@v3 | |
| - name: Setup Java 21 | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: "temurin" | |
| java-version: "21" | |
| - name: Cache do Maven | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven- | |
| - name: Build e testes do Backend | |
| run: mvn --batch-mode --update-snapshots clean verify | |
| frontend: | |
| name: Build & Lint Frontend | |
| runs-on: ubuntu-latest | |
| needs: backend | |
| steps: | |
| - name: Checkout do código | |
| uses: actions/checkout@v3 | |
| - name: Setup Node.js 18 | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: "18" | |
| - name: Install dependencies | |
| run: npm ci | |
| working-directory: ./frontend | |
| - name: Lint Angular | |
| run: npm run lint | |
| working-directory: ./frontend | |
| - name: Build Angular | |
| run: npm run build -- --prod | |
| working-directory: ./frontend | |
| docker: | |
| name: Docker Build & Push | |
| runs-on: ubuntu-latest | |
| needs: [backend, frontend] | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Login no Docker Hub | |
| uses: docker/login-action@v2 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USER }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build e push image backend | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: ./backend | |
| file: ./backend/Dockerfile | |
| push: true | |
| tags: ${{ secrets.DOCKERHUB_USER }}/loja-virtual-backend:latest | |
| - name: Build e push image frontend | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: ./frontend | |
| file: ./frontend/Dockerfile | |
| push: true | |
| tags: ${{ secrets.DOCKERHUB_USER }}/loja-virtual-frontend:latest |