From 6c95f36f95d53c15a7d4d38e05eb40c7ed7b6bc7 Mon Sep 17 00:00:00 2001 From: David Herman Date: Mon, 25 Nov 2024 17:34:10 -0800 Subject: [PATCH] GitHub workflow: Run harmless gradlew command due to warnings 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. --- .github/workflows/coverage-badge.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/coverage-badge.yml b/.github/workflows/coverage-badge.yml index a563728..87db294 100644 --- a/.github/workflows/coverage-badge.yml +++ b/.github/workflows/coverage-badge.yml @@ -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