e2e Android #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: e2e Android | |
on: | |
workflow_dispatch: | |
inputs: | |
IS_DEVELOPMENT: | |
type: choice | |
description: IS_DEVELOPMENT | |
options: | |
- false | |
- true | |
IS_SSS_ENABLED: | |
type: choice | |
description: IS_SSS_ENABLED | |
options: | |
- true | |
- false | |
IS_NFT_ENABLED: | |
type: choice | |
description: IS_NFT_ENABLED | |
options: | |
- true | |
- false | |
STORIES_ENABLED: | |
type: choice | |
description: STORIES_ENABLED | |
options: | |
- true | |
- false | |
workflow_call: | |
inputs: | |
IS_DEVELOPMENT: | |
required: false | |
type: string | |
IS_SSS_ENABLED: | |
required: false | |
type: string | |
IS_NFT_ENABLED: | |
required: false | |
type: string | |
STORIES_ENABLED: | |
required: false | |
type: string | |
jobs: | |
build: | |
name: e2e Android | |
runs-on: ubuntu-cpu16-ram64 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: AVD cache | |
uses: actions/cache@v4 | |
id: avd-cache | |
with: | |
path: | | |
~/.android/avd/* | |
~/.android/adb* | |
key: avd-29 | |
- name: Install packages | |
run: yarn install | |
- name: Install Zulu17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
- name: Setup Android SDK | |
uses: android-actions/setup-android@v3 | |
- name: Git init | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "Github actions" | |
- name: Decode secrets | |
run: | | |
echo ${{secrets.HAQQ_KEYSTORE}} | base64 -d > android/app/haqq-upload-key.keystore | |
echo ${{secrets.GOOGLE_SERVICE_ACCOUNT}} | base64 -d > android/app/google-account.json | |
echo ${{secrets.GOOGLE_SERVICE_ANDROID}} | base64 -d > android/app/google-services.json | |
echo "PROVIDER_NETWORK=${{secrets.PROVIDER_NETWORK}}" >> .env | |
echo "PROVIDER_WS_NETWORK=${{secrets.PROVIDER_WS_NETWORK}}" >> .env | |
echo "PROVIDER_CHAIN_ID=${{secrets.PROVIDER_CHAIN_ID}}" >> .env | |
echo "SENTRY_DSN=${{secrets.SENTRY_DSN}}" >> .env | |
echo "NETWORK_EXPLORER=${{secrets.NETWORK_EXPLORER}}" >> .env | |
echo "ENVIRONMENT=test" >> .env | |
echo "WALLET_CONNECT_PROJECT_ID=${{secrets.WALLET_CONNECT_PROJECT_ID}}" >> .env | |
echo "WALLET_CONNECT_RELAY_URL=${{secrets.WALLET_CONNECT_RELAY_URL}}" >> .env | |
echo "WEB3AUTH_CLIENT_ID=${{secrets.WEB3AUTH_CLIENT_ID}}" >> .env | |
echo "HCAPTCHA_SITE_KEY=${{secrets.HCAPTCHA_SITE_KEY}}" >> .env | |
echo "GOOGLE_SIGNIN_WEB_CLIENT_ID=${{secrets.GOOGLE_SIGNIN_WEB_CLIENT_ID}}" >> .env | |
echo "HAQQ_BACKEND=${{secrets.HAQQ_BACKEND}}" >> .env | |
echo "HAQQ_BACKEND_DEV=${{secrets.HAQQ_BACKEND_DEV}}" >> .env | |
echo "ADJUST_TOKEN=${{secrets.ADJUST_TOKEN}}" >> .env | |
echo "ADJUST_ENVIRONMENT=${{secrets.ADJUST_ENVIRONMENT}}" >> .env | |
echo "GOOGLE_PLAY_PACKAGE=${{secrets.GOOGLE_PLAY_PACKAGE}}" >> .env | |
echo "APPSTORE_APP_ID=${{secrets.APPSTORE_APP_ID}}" >> .env | |
echo "TURNSTILE_URL=${{secrets.TURNSTILE_URL}}" >> .env | |
echo "TURNSTILE_SITEKEY=${{secrets.TURNSTILE_SITEKEY}}" >> .env | |
echo "RECAPTCHA_V2_URL=${{secrets.RECAPTCHA_V2_URL}}" >> .env | |
echo "RECAPTCHA_V2_SITEKEY=${{secrets.RECAPTCHA_V2_SITEKEY}}" >> .env | |
echo "HCAPTCHA_URL=${{secrets.HCAPTCHA_URL}}" >> .env | |
echo "IS_DEVELOPMENT=${{github.event.inputs.IS_DEVELOPMENT || inputs.IS_DEVELOPMENT || 'false'}}" >> .env | |
echo "IS_SSS_ENABLED=${{github.event.inputs.IS_SSS_ENABLED || inputs.IS_SSS_ENABLED || 'true'}}" >> .env | |
echo "IS_NFT_ENABLED=${{github.event.inputs.IS_NFT_ENABLED || inputs.IS_NFT_ENABLED || 'true'}}" >> .env | |
echo "STORIES_ENABLED=${{github.event.inputs.STORIES_ENABLED || inputs.STORIES_ENABLED || 'true'}}" >> .env | |
echo "DETOX_MILK_PRIVATE_KEY=${{secrets.DETOX_MILK_PRIVATE_KEY}}" >> .env | |
echo "DETOX_PROVIDER=${{secrets.DETOX_PROVIDER}}" >> .env | |
echo "DETOX_CHAIN_ID=${{secrets.DETOX_CHAIN_ID}}" >> .env | |
echo "MMKV_KEY=${{secrets.MMKV_KEY}}" >> .env | |
echo "FOR_DETOX=true" >> .env | |
echo "POSTHOG_API_KEY=${{secrets.POSTHOG_API_KEY}}" >> .env | |
echo "POSTHOG_HOST=${{secrets.POSTHOG_HOST}}" >> .env | |
- name: Build android app | |
run: | | |
eval "$(ssh-agent -s)" | |
ssh-add - <<< "${MATCH_DEPLOY_KEY}" | |
yarn detox:android:build | |
env: | |
DEVELOPER_APP_IDENTIFIER: ${{ secrets.IOS_IDENTIFIER }} | |
GIT_AUTHORIZATION: ${{ secrets.GIT_AUTHORIZATION }} | |
APP_STORE_CONNECT_TEAM_ID: ${{ secrets.APP_STORE_CONNECT_TEAM_ID }} | |
DEVELOPER_PORTAL_TEAM_ID: ${{ secrets.DEVELOPER_PORTAL_TEAM_ID }} | |
MATCH_DEPLOY_KEY: ${{ secrets.MATCH_DEPLOY_KEY }} | |
TEMP_KEYCHAIN_USER: ${{ secrets.TEMP_KEYCHAIN_USER }} | |
TEMP_KEYCHAIN_PASSWORD: ${{ secrets.TEMP_KEYCHAIN_PASSWORD }} | |
APPLE_KEY_ID: ${{ secrets.APPLE_KEY_ID }} | |
APPLE_ISSUER_ID: ${{ secrets.APPLE_ISSUER_ID }} | |
APPLE_KEY_CONTENT: ${{ secrets.APPLE_KEY_CONTENT }} | |
FASTLANE_PASSWORD: ${{ secrets.APPLE_FASTLANE_PASSWORD }} | |
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} | |
DEVELOPER_APP_ID: ${{ secrets.DEVELOPER_APP_ID }} | |
PROVISIONING_PROFILE_SPECIFIER: ${{ secrets.PROVISIONING_PROFILE_SPECIFIER }} | |
HAQQ_UPLOAD_STORE_FILE: ${{ secrets.HAQQ_UPLOAD_STORE_FILE }} | |
HAQQ_UPLOAD_STORE_PASSWORD: ${{ secrets.HAQQ_UPLOAD_STORE_PASSWORD }} | |
HAQQ_UPLOAD_KEY_ALIAS: ${{ secrets.HAQQ_UPLOAD_KEY_ALIAS }} | |
HAQQ_UPLOAD_KEY_PASSWORD: ${{ secrets.HAQQ_UPLOAD_KEY_PASSWORD }} | |
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} | |
FIREBASE_TESTERS: ${{ secrets.FIREBASE_TESTERS }} | |
- name: Add avdmanager and sdkmanager to system PATH | |
run: | | |
echo "$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/emulator:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools" >> $GITHUB_PATH | |
- name: Enable KVM group perms | |
run: | | |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
sudo udevadm control --reload-rules | |
sudo udevadm trigger --name-match=kvm | |
- name: Download Android Emulator Image | |
run: | | |
yes Y | sdkmanager --licenses | |
sdkmanager --install ${ANDROID_SDK_PACKAGES} | |
- name: Create AVD and generate snapshot for caching | |
if: steps.avd-cache.outputs.cache-hit != 'true' | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: 29 | |
ndk: 21.4.7075529 | |
target: google_apis | |
emulator-build: 7425822 | |
arch: x86 | |
cores: 2 | |
avd-name: HAQQ_e2e | |
force-avd-creation: true | |
disable-animations: true | |
disable-spellchecker: false | |
disable-linux-hw-accel: auto | |
enable-hw-keyboard: false | |
profile: Nexus 6 | |
channel: stable | |
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -dpi-device 560 | |
script: echo "Generated AVD snapshot for caching." | |
- name: Run e2e tests | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: 29 | |
ndk: 21.4.7075529 | |
target: google_apis | |
emulator-build: 7425822 | |
script: adb kill-server && adb start-server && nc -z localhost 5037 && adb shell settings put global development_settings_enabled 1 && adb shell content insert --uri content://settings/system --bind name:s:show_touches --bind value:i:1 && yarn detox:android:test | |
arch: x86 | |
cores: 2 | |
avd-name: HAQQ_e2e | |
force-avd-creation: true | |
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -dpi-device 560 | |
disable-animations: true | |
disable-spellchecker: false | |
disable-linux-hw-accel: auto | |
enable-hw-keyboard: false | |
profile: Nexus 6 | |
channel: stable | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
if: ${{ failure() }} | |
with: | |
name: Detox Artifacts | |
path: artifacts | |
retention-days: 3 |