pr-testing.yml
1 name: PR testing 2 3 on: 4 pull_request: 5 branches: [ master ] 6 7 jobs: 8 mavenTesting: 9 runs-on: ubuntu-latest 10 steps: 11 - uses: actions/checkout@v3 12 - name: Cache local Maven repository 13 uses: actions/cache@v3 14 with: 15 path: ~/.m2/repository 16 key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} 17 restore-keys: | 18 ${{ runner.os }}-maven- 19 - name: Set up the Java JDK 20 uses: actions/setup-java@v3 21 with: 22 java-version: '11' 23 distribution: 'adopt' 24 25 - name: Run all tests 26 run: | 27 mvn -B clean test -DskipTests=false --file pom.xml 28 if [ -f "target/site/jacoco/index.html" ]; then echo "Total coverage: $(cat target/site/jacoco/index.html | grep -o 'Total[^%]*%' | grep -o '[0-9]*%')"; fi 29 30 - name: Log coverage percentage 31 run: | 32 if [ ! -f "target/site/jacoco/index.html" ]; then echo "No coverage information available"; fi 33 if [ -f "target/site/jacoco/index.html" ]; then echo "Total coverage: $(cat target/site/jacoco/index.html | grep -o 'Total[^%]*%' | grep -o '[0-9]*%')"; fi