Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add jacoco and GitHub workflow #19

Merged
merged 2 commits into from
Dec 10, 2024
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
23 changes: 0 additions & 23 deletions .circleci/.circleci.settings.xml

This file was deleted.

112 changes: 0 additions & 112 deletions .circleci/config.yml

This file was deleted.

35 changes: 35 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Eventeum CI

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

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

- name: Build with Maven
run: mvn clean package

- name: Run tests
run: mvn verify

- name: Check Coverage
run: |
COVERAGE=$(cat coverage/target/site/jacoco-aggregate/index.html | grep -o 'Total.*[0-9]\{1,3\}%' | grep -o '[0-9]\{1,3\}%' | head -1 | sed 's/%//')
if [ "$COVERAGE" -lt 25 ]; then
echo "Coverage below 25%: $COVERAGE%"
exit 1
fi
20 changes: 20 additions & 0 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,26 @@
</java>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.12</version>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
56 changes: 56 additions & 0 deletions coverage/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.eventeum</groupId>
<artifactId>eventeum</artifactId>
<version>${revision}</version>
</parent>

<artifactId>coverage</artifactId>

<properties>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>io.eventeum</groupId>
<artifactId>eventeum-core</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>io.eventeum</groupId>
<artifactId>eventeum-privacy-plugin</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>io.eventeum</groupId>
<artifactId>eventeum-server</artifactId>
<version>${revision}</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.12</version>
<executions>
<execution>
<id>jacoco-site-aggregate</id>
<phase>verify</phase>
<goals>
<goal>report-aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<module>core</module>
<module>server</module>
<module>privacy-plugin</module>
<module>coverage</module>
</modules>

<properties>
Expand Down
2 changes: 1 addition & 1 deletion privacy-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@
</plugins>
</build>

</project>
</project>
Loading