diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 1dab5348..08a89a4c 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -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 diff --git a/build.gradle.kts b/build.gradle.kts index d35f6463..b759e632 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -46,6 +46,48 @@ 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_MAVEN_PUBLISH_USERNAME" to "", + "ZCASH_MAVEN_PUBLISH_PASSWORD" to "", + "ZCASH_ASCII_GPG_KEY" to "", + + "IS_SNAPSHOT" to "true", + + "ZCASH_IS_TREAT_WARNINGS_AS_ERRORS" to "true", + + "IS_USE_TEST_ORCHESTRATOR" to "false", + + "ZCASH_FIREBASE_TEST_LAB_API_KEY_PATH" to "", + "ZCASH_FIREBASE_TEST_LAB_PROJECT" to "", + + "ZCASH_EMULATOR_WTF_API_KEY" to "", + + "IS_MINIFY_SDK_ENABLED" to "false", + "IS_MINIFY_APP_ENABLED" to "true", + + "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", + ) + + 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")