-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (43 loc) · 1.22 KB
/
maven.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: Java CI with Maven
on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
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: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Tests
id: get_coverage
run: |
COVERAGE=$(sed -nE 's/^.*<td>Total<([^>]+>){4}([^<]*).*$/\2/p' target/site/jacoco/index.html | sed -nE 's/[^0-9]*([0-9]+).*/\1/p')
if [ $COVERAGE -lt 70 ]; then
COLOR=red
elif [ $COVERAGE -lt 90 ]; then
COLOR=orange
else
COLOR=green
fi
echo "::set-output name=COVERAGE::$COVERAGE"
echo "::set-output name=COLOR::$COLOR"
- name: Create the Badge
uses: schneegans/dynamic-badges-action@v1.7.0
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 73adb891918b248bf5cd39afb416ee7c
filename: test.json
label: Coverage
message: ${{ steps.get_coverage.outputs.COVERAGE }}%
color: ${{ steps.get_coverage.outputs.COLOR }}