forked from eventeum/eventeum
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add github workflow to build and check the code coverage
- Loading branch information
1 parent
30465bd
commit 1e66150
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: 'openjdk' | ||
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 |