From ac9080470a9e758960f1315ee8345a86014e5743 Mon Sep 17 00:00:00 2001 From: Dimitri Kopriwa Date: Mon, 31 Oct 2022 12:38:22 +0200 Subject: [PATCH] (PC-18251) fix(e2e): add android GitHub action poc --- .github/workflows/e2e-android-native.yml | 80 +++++++++++++++++++++--- 1 file changed, 73 insertions(+), 7 deletions(-) diff --git a/.github/workflows/e2e-android-native.yml b/.github/workflows/e2e-android-native.yml index 1c7cbfd1cfd..53d6e9a0ffa 100644 --- a/.github/workflows/e2e-android-native.yml +++ b/.github/workflows/e2e-android-native.yml @@ -3,14 +3,80 @@ name: Tests e2e Android Native on: workflow_dispatch: inputs: - tbd: - description: "tbd" - required: false - type: string + environment: + type: environment + description: Select the environment jobs: - tbd: + e2e-android-native: runs-on: ubuntu-latest steps: - - name: Hello World - run: echo "Hello World" + - uses: actions/checkout@v3 + + - uses: actions/setup-node@v3 + with: + node-version-file: '.nvmrc' + + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: 11 +# cache: 'maven' + + - name: Setup Android SDK + uses: android-actions/setup-android@v2 + + - uses: ruby/setup-ruby@v1 +# with: +# bundler-cache: true + + - name: Install dependencies + run: yarn + + - name: Setup sentry credentials + env: + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + run: | + echo "[defaults]" >> ~/.sentryclirc + echo "url=https://sentry.passculture.team/" >> ~/.sentryclirc + echo "org=sentry" >> ~/.sentryclirc + echo "project=application-native" >> ~/.sentryclirc + echo "" >> ~/.sentryclirc + echo "[auth]" >> ~/.sentryclirc + echo "token=$SENTRY_AUTH_TOKEN" >> ~/.sentryclirc + + - name: Setup android keystore for ${{ inputs.environment }} environment + env: + ANDROID_KEYSTORE: ${{ secrets.ANDROID_KEYSTORE }} + ANDROID_KEYSTORE_STORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_STORE_PASSWORD }} + ANDROID_KEYSTORE_KEY_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_KEY_PASSWORD }} + run: | + mkdir -p android/keystores + echo ${ANDROID_KEYSTORE} | base64 -di > android/keystores/${{ inputs.environment }}.keystore + echo "keyAlias=passculture" >> android/keystores/${{ inputs.environment }}.keystore.properties + echo "storeFile=${{ inputs.environment }}.keystore" >> android/keystores/${{ inputs.environment }}.keystore.properties + echo "storePassword=${ANDROID_KEYSTORE_STORE_PASSWORD}" >> android/keystores/${{ inputs.environment }}.keystore.properties + echo "keyPassword=${ANDROID_KEYSTORE_KEY_PASSWORD}" >> android/keystores/${{ inputs.environment }}.keystore.properties + + - name: Setup android Google services config + env: + ANDROID_GOOGLE_SERVICES_JSON: ${{ secrets.ANDROID_GOOGLE_SERVICES_JSON }} + run: echo ${ANDROID_GOOGLE_SERVICES_JSON} > android/app/google-services.json + + - name: Build Android app for ${{ inputs.environment }} environment + run: | + source fastlane/.env.${{ inputs.environment }} + ./android/gradlew ${ANDROID_GRADLE_TASK} -p android + + + - name: Install and run Appium 2 in the background + run: | + npm install -g appium@next + appium driver install uiautomator2 + appium & + + - name: Run e2e Android tests + run: | + source fastlane/.env.${{ inputs.environment }} + ANDROID_APK_PATH=${ANDROID_FILE_PATH} yarn test:e2e:android:native