Update workflow to trigger on readme_pdf.md #84
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 - Library API | |
| on: | |
| push: | |
| branches: [ "main", "develop" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| jobs: | |
| ci: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Necessário para SonarCloud analisar deltas corretamente | |
| - name: Set up JDK 25 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '25' | |
| cache: gradle | |
| - name: Grant execute permission for Gradle | |
| run: chmod +x gradlew | |
| - name: Cache SonarCloud packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.sonar/cache | |
| key: ${{ runner.os }}-sonar | |
| restore-keys: ${{ runner.os }}-sonar | |
| - name: Build + Test + Coverage | |
| run: ./gradlew clean build | |
| - name: SonarCloud Scan | |
| env: | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| run: ./gradlew sonar --info | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2 - pinned SHA | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: build/reports/jacoco/test/jacocoTestReport.xml | |
| docker: | |
| runs-on: ubuntu-latest | |
| needs: ci | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| # ─── Build Docker ─── | |
| - name: Validate Docker Build | |
| run: | | |
| docker build \ | |
| -t library-api:${{ github.sha }} \ | |
| -t library-api:latest \ | |
| . |