-
-
Notifications
You must be signed in to change notification settings - Fork 34
78 lines (77 loc) · 2.41 KB
/
kover.yaml
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# This file was generated using Kotlin DSL (.github/workflows/kover.main.kts).
# If you want to modify the workflow, please change the Kotlin file and regenerate this YAML file.
# Generated with https://github.com/typesafegithub/github-workflows-kt
name: 'Kover Coverage'
on:
push:
branches:
- 'main'
jobs:
check_yaml_consistency:
name: 'Check YAML consistency'
runs-on: 'ubuntu-latest'
steps:
- id: 'step-0'
name: 'Check out'
uses: 'actions/checkout@v4'
- id: 'step-1'
name: 'Execute script'
run: 'rm ''.github/workflows/kover.yaml'' && ''.github/workflows/kover.main.kts'''
- id: 'step-2'
name: 'Consistency check'
run: 'git diff --exit-code ''.github/workflows/kover.yaml'''
analyse:
runs-on: 'ubuntu-latest'
needs:
- 'check_yaml_consistency'
steps:
- id: 'step-0'
name: 'Set up JDK'
uses: 'actions/setup-java@v4'
with:
java-version: '17'
distribution: 'adopt'
- id: 'step-1'
uses: 'actions/checkout@v4'
- id: 'step-2'
uses: 'gradle/gradle-build-action@v3'
with:
arguments: 'koverHtmlReport'
- id: 'step-3'
run: 'cat app/build/reports/kover/html/index.html >> $GITHUB_STEP_SUMMARY'
- id: 'step-4'
uses: 'gradle/gradle-build-action@v3'
with:
arguments: 'koverXmlReport'
- id: 'step-5'
name: 'Generate coverage output'
run: |-
COVERAGE=$(${{ github.workspace }}/gradlew -q printLineCoverage)
echo "Raw Coverage: $COVERAGE"
COVERAGE=$(printf "%.0f" "$COVERAGE") # Round to integer
echo "Rounded Coverage: $COVERAGE"
echo "COVERAGE=$COVERAGE" >> $GITHUB_ENV
- id: 'step-6'
name: 'Generate Coverage Badge'
run: |-
mkdir -p badge
COLOR=$(
if [ "$COVERAGE" -ge 90 ]; then
echo "brightgreen"
elif [ "$COVERAGE" -ge 70 ]; then
echo "yellow"
else
echo "red"
fi
)
URL="https://img.shields.io/badge/Coverage-$COVERAGE%25-$COLOR"
curl -sS "$URL" -o badge/coverage-badge.svg
- id: 'step-7'
name: 'Deploy Badge to GitHub Pages'
uses: 'peaceiris/actions-gh-pages@v4'
with:
github_token: '${{ secrets.GITHUB_TOKEN }}'
publish_branch: 'gh-pages'
publish_dir: 'badge'
allow_empty_commit: 'false'
force_orphan: 'true'