[#719] Check Gradle properties on CI

Co-authored-by: Honza <rychnovsky.honza@gmail.com>
This commit is contained in:
Carter Jernigan 2023-01-19 07:34:14 -05:00 committed by GitHub
parent bf67948ef8
commit dcb6388abb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 65 additions and 0 deletions

View File

@ -74,6 +74,24 @@ jobs:
if: "${{ env.EMULATOR_WTF_API_KEY != '' }}"
run: echo "defined=true" >> $GITHUB_OUTPUT
check_properties:
needs: prime_cache
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
timeout-minutes: 1
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
- name: Setup
id: setup
timeout-minutes: 5
uses: ./.github/actions/setup
- name: Check properties
timeout-minutes: 4
run: |
./gradlew checkProperties
static_analysis_detekt:
needs: prime_cache
runs-on: ubuntu-latest

View File

@ -60,6 +60,53 @@ tasks {
}
}
}
register("checkProperties") {
doLast {
// Ensure that developers do not change default values of certain properties directly
// in the repo, but instead set them in their local ~/.gradle/gradle.properties file
// (or use command line arguments)
val expectedPropertyValues = mapOf(
"ZCASH_IS_TREAT_WARNINGS_AS_ERRORS" to "true",
"IS_KOTLIN_TEST_COVERAGE_ENABLED" to "true",
"IS_ANDROID_INSTRUMENTATION_TEST_COVERAGE_ENABLED" to "false",
"IS_USE_TEST_ORCHESTRATOR" to "false",
"IS_CRASH_ON_STRICT_MODE_VIOLATION" to "false",
"ZCASH_FIREBASE_TEST_LAB_API_KEY_PATH" to "",
"ZCASH_FIREBASE_TEST_LAB_PROJECT" to "",
"ZCASH_EMULATOR_WTF_API_KEY" to "",
"IS_MINIFY_ENABLED" to "true",
"ZCASH_RELEASE_APP_NAME" to "Zcash",
"ZCASH_RELEASE_PACKAGE_NAME" to "co.electriccoin.zcash",
"ZCASH_DEBUG_KEYSTORE_PATH" to "",
"ZCASH_RELEASE_KEYSTORE_PATH" to "",
"ZCASH_RELEASE_KEYSTORE_PASSWORD" to "",
"ZCASH_RELEASE_KEY_ALIAS" to "",
"ZCASH_RELEASE_KEY_ALIAS_PASSWORD" to "",
"IS_SIGN_RELEASE_BUILD_WITH_DEBUG_KEY" to "false",
"ZCASH_GOOGLE_PLAY_SERVICE_KEY_FILE_PATH" to "",
"ZCASH_GOOGLE_PLAY_DEPLOY_MODE" to "build",
"SDK_INCLUDED_BUILD_PATH" to "",
"BIP_39_INCLUDED_BUILD_PATH" to ""
)
val warnings = expectedPropertyValues.filter { (key, value) ->
project.properties[key].toString() != value
}.map { "Property ${it.key} does not have expected value \"${it.value}\"" }
if (warnings.isNotEmpty()) {
throw GradleException(warnings.joinToString(separator = "\n"))
}
}
}
}
val unstableKeywords = listOf("alpha", "beta", "rc", "m", "ea", "build")