Skip to content

Merge pull request #1582 from WangLiNaruto/feature/ocl_eula #6

Merge pull request #1582 from WangLiNaruto/feature/ocl_eula

Merge pull request #1582 from WangLiNaruto/feature/ocl_eula #6

Workflow file for this run

#
# 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