Skip to content

Commit

Permalink
GitHub workflow: Run harmless gradlew command due to warnings
Browse files Browse the repository at this point in the history
We have a workflow job which runs:

./gradlew -q printLineCoverage

which should ONLY print out a number (e.g. 99.7)

but unfortunately the Android plugin spams a bunch of noise on
first run that we don't care about (that's why we pass in the
`-q` option). This is causing the
"COVERAGE=(./gradlew -q printLineCoverage)>>GITHUB_ENV" action
to fail.

The output looks like:

```
Warning: Errors during XML parse:
Warning: Additionally, the fallback loader failed to parse the XML.
Checking the license for package Android SDK Platform-Tools in /usr/local/lib/android/sdk/licenses
License for package Android SDK Platform-Tools accepted.
Preparing "Install Android SDK Platform-Tools v.35.0.2".
"Install Android SDK Platform-Tools v.35.0.2" ready.
Installing Android SDK Platform-Tools in /usr/local/lib/android/sdk/platform-tools
"Install Android SDK Platform-Tools v.35.0.2" complete.
"Install Android SDK Platform-Tools v.35.0.2" finished.
99.7
```

By running the same command twice, we clear this initial noise
out of the way so that second printLineCoverage can run cleanly.
  • Loading branch information
bitspittle committed Nov 26, 2024
1 parent 686a079 commit 6c95f36
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/coverage-badge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ jobs:
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
Expand Down

0 comments on commit 6c95f36

Please sign in to comment.