Skip to content

Use RNEF for CI ios builds #1761

Use RNEF for CI ios builds

Use RNEF for CI ios builds #1761

Workflow file for this run

name: Android e2e tests
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
push:
branches:
- develop
jobs:
android-e2e-build:
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: blacksmith-8vcpu-ubuntu-2404
timeout-minutes: 30
concurrency:
group: e2e-android-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
outputs:
artifact-id: ${{ steps.rnef-remote-build-android.outputs.artifact-id }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install secret tools
run: sudo apt install libsecret-tools
- name: Setup env key
uses: ./.github/actions/ssh/
with:
name: env
key: ${{ secrets.DEPLOY_PKEY_DOTENV_REPO }}
- name: Setup scripts key
uses: ./.github/actions/ssh/
with:
name: scripts
key: ${{ secrets.DEPLOY_PKEY_SCRIPTS_REPO }}
- name: Setup sandbox key
uses: ./.github/actions/ssh/
with:
name: sandbox
key: ${{ secrets.DEPLOY_PKEY_SANDBOX_REPO }}
- name: Setup env
env:
SSH_AUTH_SOCK: /tmp/ssh_agent_env.sock
run: |
git clone [email protected]:rainbow-me/rainbow-env.git
mv rainbow-env/dotenv .env
mv rainbow-env/android/app/google-services.json android/app/google-services.json
rm -rf rainbow-env
sed -i "s/IS_TESTING=false/IS_TESTING=true/" .env
- name: Setup scripts
env:
CI_SCRIPTS: ${{ secrets.CI_SCRIPTS }}
SSH_AUTH_SOCK: /tmp/ssh_agent_scripts.sock
run: |
eval $CI_SCRIPTS
- name: Get Yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- name: Cache Yarn dependencies
uses: actions/cache@v4
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
.yarn/cache
.yarn/install-state.gz
key: ${{ runner.os }}-${{ runner.arch }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
env:
SSH_AUTH_SOCK: /tmp/ssh_agent_sandbox.sock
run: |
yarn install && yarn setup
- name: Check for frozen lockfile
run: ./scripts/check-lockfile.sh
- name: Audit CI
run: yarn audit-ci --config audit-ci.jsonc
- name: RNEF Remote Build - Android
id: rnef-remote-build-android
uses: callstackincubator/android@v2
env:
# This is a debug keystore for now.
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
KEYSTORE_FILE: ${{ secrets.KEYSTORE_FILE }}
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEYSTORE_KEY_ALIAS: ${{ secrets.KEYSTORE_KEY_ALIAS }}
KEYSTORE_KEY_PASSWORD: ${{ secrets.KEYSTORE_KEY_PASSWORD }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
with:
variant: release
sign: true
keystore-base64: ${{ env.KEYSTORE_BASE64 }}
keystore-store-file: ${{ env.KEYSTORE_FILE }}
keystore-store-password: ${{ env.KEYSTORE_PASSWORD }}
keystore-key-alias: ${{ env.KEYSTORE_KEY_ALIAS }}
keystore-key-password: ${{ env.KEYSTORE_KEY_PASSWORD }}
re-sign: true
github-token: ${{ secrets.GITHUB_TOKEN }}
validate-gradle-wrapper: false
rnef-build-extra-params: '--extra-params="--no-daemon --build-cache --no-scan"'
comment-bot: false
android-e2e-tests:
strategy:
fail-fast: false
matrix:
shard-index: [1, 2, 3, 4]
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: app-e2e-runner
needs: android-e2e-build
timeout-minutes: 30
concurrency:
group: e2e-android-${{ github.workflow }}-${{ github.ref }}-shard-${{ matrix.shard-index }}
cancel-in-progress: false
env:
SHARD_TOTAL: 4
SHARD_INDEX: ${{ matrix.shard-index }}
ANDROID_EMULATOR_API_LEVEL: 31
ANDROID_EMULATOR_PROFILE: pixel_6
ANDROID_EMULATOR_CORES: 4
ANDROID_EMULATOR_RAM_SIZE: 8192
ARTIFACTS_FOLDER: e2e-artifacts
ARCH: x86_64
ANDROID_EMULATOR_WAIT_TIME_BEFORE_KILL: 60
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup env key
uses: ./.github/actions/ssh/
with:
name: env
key: ${{ secrets.DEPLOY_PKEY_DOTENV_REPO }}
- name: Setup env
env:
SSH_AUTH_SOCK: /tmp/ssh_agent_env.sock
run: |
git clone [email protected]:rainbow-me/rainbow-env.git
mv rainbow-env/dotenv .env
rm -rf rainbow-env
- name: Install Maestro
run: export MAESTRO_VERSION=1.41.0; curl -fsSL "https://get.maestro.mobile.dev" | bash
- name: Install Anvil
uses: foundry-rs/foundry-toolchain@v1
with:
version: stable
- name: Download and Unpack APK artifact
run: |
curl -L -H "Authorization: token ${{ github.token }}" -o artifact.zip "https://api.github.com/repos/${{ github.repository }}/actions/artifacts/${{ needs.android-e2e-build.outputs.artifact-id }}/zip"
unzip artifact.zip -d downloaded-artifacts
ls -l downloaded-artifacts
APK_PATH=$(find downloaded-artifacts -name "*.apk" -print -quit)
echo "ARTIFACT_PATH_FOR_E2E=$APK_PATH" >> $GITHUB_ENV
shell: bash
- name: Setup Android Emulator
id: android-emulator
uses: ./.github/actions/android-emulator/
with:
api-level: ${{ env.ANDROID_EMULATOR_API_LEVEL }}
profile: ${{ env.ANDROID_EMULATOR_PROFILE }}
cores: ${{ env.ANDROID_EMULATOR_CORES }}
ram-size: ${{ env.ANDROID_EMULATOR_RAM_SIZE }}
arch: ${{ env.ARCH }}
- name: Run tests
uses: reactivecircus/android-emulator-runner@v2
id: e2e_test
with:
api-level: ${{ env.ANDROID_EMULATOR_API_LEVEL }}
target: google_apis_playstore
arch: ${{ env.ARCH }}
force-avd-creation: false
emulator-options: -no-snapshot -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
profile: ${{ env.ANDROID_EMULATOR_PROFILE }}
cores: ${{ env.ANDROID_EMULATOR_CORES }}
ram-size: ${{ env.ANDROID_EMULATOR_RAM_SIZE }}
script: ./scripts/e2e-android-ci.sh
- name: Upload artifacts
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: artifacts-${{ matrix.shard-index }}
path: ${{ env.ARTIFACTS_FOLDER }}