Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ jobs:
- name: Checkout LFS objects
run: git lfs checkout


- name: Cache local Maven repository
uses: actions/cache@v4
with:
Expand Down Expand Up @@ -52,15 +51,31 @@ jobs:
echo "cx-mac binary does not exist"; exit 1;
fi

- name: Run tests with Maven
run: mvn -B test --file pom.xml
- name: Install xmllint
run: sudo apt-get install -y libxml2-utils

- name: Run tests with JaCoCo
run: mvn test jacoco:report
env:
CX_CLIENT_ID: ${{ secrets.CX_CLIENT_ID}}
CX_CLIENT_SECRET: ${{ secrets.CX_CLIENT_SECRET}}
CX_BASE_URI: ${{ secrets.CX_BASE_URI }}
CX_TENANT: ${{ secrets.CX_TENANT }}
CX_APIKEY: ${{ secrets.CX_APIKEY }}

- name: Print total coverage percentage
run: |
COVERED_LINES=$(xmllint --xpath "string(//report/counter[@type='LINE']/@covered)" target/site/jacoco/jacoco.xml)
MISSED_LINES=$(xmllint --xpath "string(//report/counter[@type='LINE']/@missed)" target/site/jacoco/jacoco.xml)
TOTAL_LINES=$((COVERED_LINES + MISSED_LINES))
COVERAGE_PERCENTAGE=$(echo "scale=2; $COVERED_LINES / $TOTAL_LINES * 100" | bc)
echo "Total coverage percentage: $COVERAGE_PERCENTAGE%"

- name: Upload JaCoCo coverage report
uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 #v4
with:
name: jacoco-coverage-report
path: target/site/jacoco

- name: Build with Maven
run: mvn -B verify -DskipTests -Dgpg.skip --file pom.xml
Expand Down
25 changes: 25 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,31 @@

<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.8</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<includes>
<include>**/src/main/java/**</include>
<!-- Add other patterns as needed -->
</includes>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
Expand Down
Loading