Skip to content

GitHub workflow: Run harmless gradlew command due to warnings #24

GitHub workflow: Run harmless gradlew command due to warnings

GitHub workflow: Run harmless gradlew command due to warnings #24

# coverage-badge.yml
name: Create coverage badge
on:
push:
branches: [ main ] # !! CONFIRM THIS !!
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Java 17 needed for resolving the Android Gradle Plugin
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Cache Kotlin Native compiler
uses: actions/cache@v4
with:
path: ~/.konan
key: kotlin-native-compiler-${{ runner.OS }}
# At some point, the Android plugin started getting chatty with its output
# and spams stuff like "Install Android SDK ..."
# So we run the "printLineCoverage" command twice, one to clear away this
# first run noise.
- name: Run Gradle once to clear Android startup messages
run: |
${{github.workspace}}/gradlew -q printLineCoverage
- name: Generate coverage output
run: |
echo "COVERAGE=$(${{github.workspace}}/gradlew -q printLineCoverage)" >> $GITHUB_ENV
- name: Update dynamic badge gist
uses: schneegans/[email protected]
with:
auth: ${{secrets.COVERAGE_GIST_SECRET}}
gistID: 01b6bfe88483946d9f5438f5616d9b9f
filename: truthish-coverage-badge.json
label: coverage
message: ${{env.COVERAGE}}%
valColorRange: ${{env.COVERAGE}}
minColorRange: 0
maxColorRange: 100