Skip to content

Commit

Permalink
Override local.gradle values for CI builds
Browse files Browse the repository at this point in the history
COAND-851
  • Loading branch information
OscarSpruit committed Apr 23, 2024
1 parent 329290e commit a50fb1a
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/run_ui_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ jobs:

- name: Run connectedDebugAndroidTest
uses: reactivecircus/android-emulator-runner@v2
env:
ADYEN_ANDROID_MERCHANT_SERVER_URL: 'https://android-ui-tests.adyen.com/'
ADYEN_ANDROID_CLIENT_KEY: 'test_fakefakefakefakefakefakefakefake'
with:
api-level: ${{ matrix.api-level }}
target: google_apis
Expand Down
6 changes: 4 additions & 2 deletions example-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ apply from: "${rootDir}/config/gradle/codeQuality.gradle"

if (file("local.gradle").exists()) {
apply from: "local.gradle"
} else if (System.getenv("CI") == "true") {
apply from: "ci.gradle"
} else if (!isIDEBuild()) {
// if not building from an IDE, use example file as it is to ensure the build passes (for CI, renovate, etc)
apply from: "example.local.gradle"
// Renovate doesn't set the CI variable, so this way we can still make sure the build succeeds.
apply from: "ci.gradle"
} else {
throw new GradleException("File example-app/local.gradle not found. Check example-app/README.md for more instructions.")
}
Expand Down
24 changes: 24 additions & 0 deletions example-app/ci.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
android {
buildTypes {

def merchantAccount = System.getenv('ADYEN_ANDROID_MERCHANT_ACCOUNT')
def merchantServerUrl = System.getenv('ADYEN_ANDROID_MERCHANT_SERVER_URL')
def authorizationHeaderName = System.getenv('ADYEN_ANDROID_AUTHORIZATION_HEADER_NAME')
def authorizationHeaderValue = System.getenv('ADYEN_ANDROID_AUTHORIZATION_HEADER_VALUE')
def clientKey = System.getenv('ADYEN_ANDROID_CLIENT_KEY')

debug {
buildConfigField "String", "MERCHANT_ACCOUNT", "\"$merchantAccount\""
buildConfigField "String", "MERCHANT_SERVER_URL", "\"$merchantServerUrl\""
buildConfigField "String", "AUTHORIZATION_HEADER_NAME", "\"$authorizationHeaderName\""
buildConfigField "String", "AUTHORIZATION_HEADER_VALUE", "\"$authorizationHeaderValue\""
buildConfigField "String", "CLIENT_KEY", "\"$clientKey\""
buildConfigField "String", "MERCHANT_RECURRING_SERVER_URL", "\"$merchantServerUrl\""
}

release {
initWith debug
matchingFallbacks = ['debug']
}
}
}

0 comments on commit a50fb1a

Please sign in to comment.