forked from eclipse-xpanse/xpanse
-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (42 loc) · 1.34 KB
/
coverage.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
50
#
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Huawei Inc.
#
name: xpanse-test-coverage
on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
if: github.repository == 'eclipse-xpanse/xpanse'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set Up JDK 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: adopt
- name: Set up OpenTofu
uses: opentofu/setup-opentofu@v1
with:
tofu_version: 1.6.0
- name: Test
run: mvn --batch-mode --update-snapshots --no-transfer-progress -Djacoco.skip=false test
- name: Extract Coverage Percentage
run: |
coverage=$(grep -oP '<td class="ctr2">\K(\d+)%' target/coverage-reports/index.html | head -n 1)
coverage=${coverage%\%}
echo "COVERAGE_PERCENTAGE=$coverage" >> $GITHUB_ENV
- name: Create Coverage Badge
uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST_TOKEN }}
gistID: 3d9c022b98734fbf615c21136abe4add
filename: xpanse-coverage.json
label: coverage
message: ${{ env.COVERAGE_PERCENTAGE }}%
valColorRange: ${{ env.COVERAGE_PERCENTAGE }}
maxColorRange: 100
minColorRange: 0