Added new changes #3
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: Main CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Cache Maven packages | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.m2 | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven- | |
| - name: Set up Docker Compose | |
| run: docker compose version | |
| - name: Start services with Docker Compose | |
| run: docker compose up -d | |
| - name: Wait for PostgreSQL | |
| run: | | |
| until docker exec $(docker ps -qf "name=db") pg_isready -U postgres; do | |
| echo "Waiting for PostgreSQL..." | |
| sleep 2 | |
| done | |
| - name: Set up OpenJDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '21' | |
| - name: Build and run tests (user-service) | |
| run: mvn verify | |
| working-directory: ./user-service | |
| - name: Build and run tests (notification-service) | |
| run: mvn verify | |
| working-directory: ./notification-service | |
| - name: Upload JaCoCo report (user-service) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: jacoco-report-user-service | |
| path: user-service/target/site/jacoco | |
| - name: Upload JaCoCo report (notification-service) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: jacoco-report-notification-service | |
| path: notification-service/target/site/jacoco | |
| - name: Run Checkstyle (user-service) | |
| run: mvn checkstyle:check | |
| working-directory: ./user-service | |
| - name: Run Checkstyle (notification-service) | |
| run: mvn checkstyle:check | |
| working-directory: ./notification-service | |
| - name: Tear down Docker Compose | |
| if: always() | |
| run: docker compose down |