Skip to content

⚗️ First attempt on extracting Kover coverage badge #35

⚗️ First attempt on extracting Kover coverage badge

⚗️ First attempt on extracting Kover coverage badge #35

Workflow file for this run

# 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'
pull_request: {}
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 "Extracted Coverage: $COVERAGE"
echo "COVERAGE=$COVERAGE" >> $GITHUB_ENV
- id: 'step-6'
name: 'Generate Coverage Badge'
run: "\n git checkout -b gh-pages\n echo \"COVERAGE=$COVERAGE\"\n curl \"https://img.shields.io/badge/Coverage-$COVERAGE%25-brightgreen\" -o coverage-badge.svg\n mkdir -p badge\n mv coverage-badge.svg badge/\n ls -l badge/\n # Configure Git\n git config --global user.name \"github-actions[bot]\"\n git config --global user.email \"41898282+github-actions[bot]@users.noreply.github.com\"\n\n # Add and commit changes\n git add badge/\n git commit -m \"Update coverage badge\"\n git push origin gh-pages\n "
- id: 'step-7'
name: 'Deploy Badge to GitHub Pages'
uses: 'peaceiris/actions-gh-pages@v3'
with:
github_token: '${{ secrets.GITHUB_TOKEN }}'
publish_dir: 'badge'