Feature/tests #18
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/CD Pipeline | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| jobs: | |
| build-and-test: | |
| name: Build and Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| cache: 'maven' | |
| - name: Build with Maven | |
| run: ./mvnw clean compile | |
| - name: Generate SBE sources | |
| run: ./mvnw generate-sources | |
| - name: Run tests with JaCoCo | |
| run: ./mvnw clean test jacoco:report -Pcoverage | |
| - name: Check coverage thresholds | |
| run: | | |
| COVERAGE=$(grep -oP '(?<=Total.*?">).*?(?=%</td>)' target/site/jacoco/index.html | head -1) | |
| echo "Coverage: $COVERAGE%" | |
| if (( $(echo "$COVERAGE < 15" | bc -l) )); then | |
| echo "❌ Coverage ($COVERAGE%) is below minimum threshold (15%)" | |
| exit 1 | |
| else | |
| echo "✅ Coverage ($COVERAGE%) meets minimum threshold (15%)" | |
| fi |