Skip to content

Commit

Permalink
Add Jacoco and coverage github workflow to push it to Coveralls (#10)
Browse files Browse the repository at this point in the history
* Add coverage github workflow
* Add jacoco plugin
  • Loading branch information
karoliineh authored Apr 4, 2024
1 parent b0adc75 commit 3fe053a
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 1 deletion.
36 changes: 36 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: coverage

on:
pull_request:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
cache: maven

- name: Set up Node.js 18
uses: actions/setup-node@v3
with:
node-version: '18.x'

- name: Build with Maven
run: mvn install

- name: Create Jacoco report
run: mvn test jacoco:report

- name: Coveralls
uses: coverallsapp/[email protected]
with:
base-path: src/main/java
file: target/site/jacoco/jacoco.xml
30 changes: 29 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
<configuration>
<argLine>-Xshare:off</argLine>
<consoleOutputReporter>
<disable>true</disable>
</consoleOutputReporter>
Expand All @@ -199,6 +198,35 @@
</dependency>
</dependencies>
</plugin>

<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.12</version>
<configuration>
<excludes>
<exclude>**/abstractdebugging/*</exclude>
<exclude>**/HTTPserver/*</exclude>
<exclude>**/api/jsonrpc/*</exclude>
<exclude>**/magpiebridge/*</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>default-report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

0 comments on commit 3fe053a

Please sign in to comment.