[TTINC1-36] Backend connected to the frontend for the first increment [REFACTOR] #48
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: Backend CI | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| paths: | |
| - 'codehive-backend/**' | |
| - '.github/workflows/**' | |
| pull_request: | |
| branches: [ main, develop ] | |
| paths: | |
| - 'codehive-backend/**' | |
| - '.github/workflows/**' | |
| permissions: | |
| checks: write | |
| pull-requests: write | |
| jobs: | |
| test: | |
| name: Test and Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| with: | |
| cache-read-only: ${{ github.ref != 'refs/heads/main' }} | |
| - name: Run tests | |
| working-directory: codehive-backend | |
| run: ./gradlew test --info | |
| env: | |
| SPRING_PROFILES_ACTIVE: test | |
| - name: Generate coverage report | |
| if: always() | |
| working-directory: codehive-backend | |
| run: ./gradlew jacocoTestReport | |
| - name: Build application | |
| working-directory: codehive-backend | |
| run: ./gradlew build -x test | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results | |
| path: | | |
| codehive-backend/build/reports/tests/test/ | |
| codehive-backend/build/test-results/test/ | |
| retention-days: 30 | |
| - name: Upload coverage report | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report | |
| path: codehive-backend/build/reports/jacoco/test/ | |
| retention-days: 30 | |
| - name: Upload build artifact | |
| if: github.event_name == 'push' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: codehive-backend | |
| path: codehive-backend/build/libs/*.jar | |
| retention-days: 7 | |
| - name: Publish test results | |
| if: always() | |
| uses: EnricoMi/publish-unit-test-result-action@v2 | |
| with: | |
| files: codehive-backend/build/test-results/test/*.xml | |
| check_name: Test Results | |
| - name: Add coverage comment to PR | |
| if: github.event_name == 'pull_request' | |
| uses: madrapps/jacoco-report@v1.6.1 | |
| with: | |
| paths: codehive-backend/build/reports/jacoco/test/jacocoTestReport.xml | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| min-coverage-overall: 70 | |
| min-coverage-changed-files: 80 | |
| title: Code Coverage Report | |
| update-comment: true |