|
| 1 | +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time |
| 2 | +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven |
| 3 | + |
| 4 | +# This workflow uses actions that are not certified by GitHub. |
| 5 | +# They are provided by a third-party and are governed by |
| 6 | +# separate terms of service, privacy policy, and support |
| 7 | +# documentation. |
| 8 | + |
| 9 | +name: PR update Java CI with Maven |
| 10 | + |
| 11 | +on: |
| 12 | + pull_request: |
| 13 | + branches: |
| 14 | + - main |
| 15 | + |
| 16 | +jobs: |
| 17 | + build: |
| 18 | + |
| 19 | + runs-on: ubuntu-latest |
| 20 | + |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v3 |
| 23 | + - name: Set up JDK 11 |
| 24 | + uses: actions/setup-java@v3 |
| 25 | + with: |
| 26 | + java-version: '11' |
| 27 | + distribution: 'temurin' |
| 28 | + cache: maven |
| 29 | + |
| 30 | + - name: Check coding style |
| 31 | + run: mvn -B -ntp checkstyle:check |
| 32 | + |
| 33 | + - name: Dependency tree |
| 34 | + run: mvn -B -ntp dependency:tree |
| 35 | + |
| 36 | + - name: Dependency checking |
| 37 | + run: mvn -B -ntp dependency:analyze-only |
| 38 | + |
| 39 | + - name: Unit test and coverage |
| 40 | + run: mvn -B -ntp test jacoco:report |
| 41 | + |
| 42 | + - name: Build with Maven |
| 43 | + run: mvn -B -ntp -DskipTests=true -Dcheckstyle.skip package |
| 44 | + |
| 45 | + - name: Code Coverage Report |
| 46 | + id: jacoco |
| 47 | + uses: madrapps/jacoco-report@v1.3 |
| 48 | + with: |
| 49 | + paths: ${{ github.workspace }}/target/site/jacoco/jacoco.xml |
| 50 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 51 | + min-coverage-overall: 80 |
| 52 | + min-coverage-changed-files: 90 |
| 53 | + |
| 54 | + - name: Upload Coverage Report |
| 55 | + uses: actions/upload-artifact@v4 |
| 56 | + with: |
| 57 | + name: jacoco-report |
| 58 | + path: target/site/jacoco/ |
| 59 | + |
0 commit comments