|
1 | 1 | name: AST Java Wrapper CI |
2 | 2 |
|
3 | | -on: [pull_request] |
| 3 | +on: [ pull_request ] |
4 | 4 |
|
5 | 5 | jobs: |
6 | 6 | integration-tests: |
@@ -35,51 +35,47 @@ jobs: |
35 | 35 | distribution: 'temurin' |
36 | 36 | java-version: '11' |
37 | 37 |
|
38 | | - - name: Set Executable Permissions for Binary Files |
39 | | - run: | |
40 | | - chmod +x src/main/resources/cx-linux |
41 | | - chmod +x src/main/resources/cx.exe |
42 | | - chmod +x src/main/resources/cx-mac |
43 | | -
|
44 | 38 | - name: Check existence of cx-linux binary |
45 | 39 | run: | |
46 | 40 | if [ ! -f "src/main/resources/cx-linux" ]; then |
47 | | - echo "cx-linux binary does not exist"; exit 1; |
| 41 | + echo "cx-linux binary does not exist"; exit 1; |
48 | 42 | fi |
49 | | -
|
50 | 43 | - name: Check existence of cx.exe binary |
51 | 44 | run: | |
52 | 45 | if [ ! -f "src/main/resources/cx.exe" ]; then |
53 | 46 | echo "cx.exe binary does not exist"; exit 1; |
54 | 47 | fi |
55 | | -
|
56 | 48 | - name: Check existence of cx-mac binary |
57 | 49 | run: | |
58 | 50 | if [ ! -f "src/main/resources/cx-mac" ]; then |
59 | 51 | echo "cx-mac binary does not exist"; exit 1; |
60 | 52 | fi |
61 | 53 |
|
62 | | - - name: Run tests with Maven and Generate Coverage Report |
63 | | - run: | |
64 | | - mvn clean verify -Dgpg.skip |
65 | | - mvn jacoco:report -Dgpg.skip |
| 54 | + - name: Install xmllint |
| 55 | + run: sudo apt-get install -y libxml2-utils |
| 56 | + |
| 57 | + - name: Run tests with JaCoCo |
| 58 | + run: mvn test jacoco:report |
66 | 59 | env: |
67 | | - CX_CLIENT_ID: ${{ secrets.CX_CLIENT_ID }} |
68 | | - CX_CLIENT_SECRET: ${{ secrets.CX_CLIENT_SECRET }} |
| 60 | + CX_CLIENT_ID: ${{ secrets.CX_CLIENT_ID}} |
| 61 | + CX_CLIENT_SECRET: ${{ secrets.CX_CLIENT_SECRET}} |
69 | 62 | CX_BASE_URI: ${{ secrets.CX_BASE_URI }} |
70 | 63 | CX_TENANT: ${{ secrets.CX_TENANT }} |
71 | 64 | CX_APIKEY: ${{ secrets.CX_APIKEY }} |
72 | 65 |
|
73 | | - - name: Display Coverage Summary |
| 66 | + - name: Print total coverage percentage |
74 | 67 | run: | |
75 | | - echo "Code Coverage Summary:" |
76 | | - grep -A 10 "Total" target/site/jacoco/jacoco.csv || echo "Coverage report not found." |
| 68 | + COVERED_LINES=$(xmllint --xpath "string(//report/counter[@type='LINE']/@covered)" target/site/jacoco/jacoco.xml) |
| 69 | + MISSED_LINES=$(xmllint --xpath "string(//report/counter[@type='LINE']/@missed)" target/site/jacoco/jacoco.xml) |
| 70 | + TOTAL_LINES=$((COVERED_LINES + MISSED_LINES)) |
| 71 | + COVERAGE_PERCENTAGE=$(echo "scale=2; $COVERED_LINES / $TOTAL_LINES * 100" | bc) |
| 72 | + echo "Total coverage percentage: $COVERAGE_PERCENTAGE%" |
77 | 73 |
|
78 | | - - name: Upload JaCoCo Coverage Report |
79 | | - uses: actions/upload-artifact@v4 |
| 74 | + - name: Upload JaCoCo coverage report |
| 75 | + uses: actions/upload-artifact@v3 |
80 | 76 | with: |
81 | | - name: jacoco-report |
82 | | - path: target/site/jacoco/* |
| 77 | + name: jacoco-coverage-report |
| 78 | + path: target/site/jacoco |
83 | 79 |
|
84 | 80 | - name: Build with Maven |
85 | 81 | run: mvn -B verify -DskipTests -Dgpg.skip --file pom.xml |
|
0 commit comments