Skip to content

test: extend api matrix for android e2e tests #132

test: extend api matrix for android e2e tests

test: extend api matrix for android e2e tests #132

Workflow file for this run

name: 'E2E Tests'
on:
push:
branches:
- master
paths-ignore:
- 'README.md'
- 'website/**'
pull_request:
branches:
- master
paths-ignore:
- 'README.md'
- 'website/**'
jobs:
build-android:
name: Build Android
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- name: Enable corepack
run: corepack enable
- name: Install dependencies
run: yarn install --immutable
- name: Setup java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Cache Gradle
uses: actions/cache@v4
with:
path: |
~/.gradle/wrapper
~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('KeychainExample/android/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Downloading Gradle Dependencies
run: |
cd KeychainExample/android
chmod +x gradlew
./gradlew --max-workers 2 dependencies
- name: Build Android Release
env:
JAVA_OPTS: '-XX:MaxHeapSize=6g'
working-directory: ./KeychainExample
run: |
yarn build:android
yarn test:android:build
- name: Upload Test APKs
uses: actions/upload-artifact@v4
with:
name: test-apk
path: KeychainExample/android/app/build/outputs/apk
retention-days: 1
test-android:
runs-on: ubuntu-latest
needs: build-android
strategy:
fail-fast: false
matrix:
api-level:
- 31
- 32
- 33
- 34
- 35
steps:
- 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
ls /dev/kvm
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- name: Enable corepack
run: corepack enable
- name: Install dependencies
run: yarn install --immutable
- name: Setup java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- uses: actions/download-artifact@v4
with:
name: test-apk
path: KeychainExample/android/app/build/outputs/apk
- name: Display structure of downloaded files
run: ls -R KeychainExample/android/app/build/outputs/apk
- name: Run Tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
arch: x86_64
profile: pixel_6
disable-animations: true
avd-name: TestingAVD
script: |
echo "Starting the screen recording..."
adb shell "screenrecord --bugreport /data/local/tmp/screenrecord.mp4 & echo \$! > /data/local/tmp/screenrecord_pid.txt" &
adb shell settings put system pointer_location 1
adb shell locksettings set-pin 1111
adb shell am start -a android.settings.BIOMETRIC_ENROLL
adb shell input text 1111
adb shell input keyevent 66
sleep 3
adb shell input tap 900 2200
sleep 3
adb shell input tap 900 2200
sleep 3
adb -e emu finger touch 1
sleep 3
adb -e emu finger touch 1
sleep 3
adb -e emu finger touch 1
sleep 3
adb shell input keyevent KEYCODE_HOME
adb shell "kill -2 \$(cat /data/local/tmp/screenrecord_pid.txt)"
sleep 1
adb pull /data/local/tmp/screenrecord.mp4 .
cd KeychainExample
yarn test:android:run
- name: Upload test artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: android-test-artifacts-${{ matrix.api-level }}
path: |
KeychainExample/artifacts
screenrecord.mp4
build-ios:
name: Build and Test iOS
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- name: Enable corepack
run: corepack enable
- name: Install dependencies
run: yarn install --immutable
- name: setup-cocoapods
uses: maxim-lobanov/setup-cocoapods@v1
with:
podfile-path: KeychainExample/ios/Podfile.lock
- name: Cache cocoapods
id: cocoapods-cache
uses: actions/cache@v4
with:
path: |
**/ios/Pods
**/vendor/bundle
key: ${{ runner.os }}-cocoapods-${{ hashFiles('KeychainExample/ios/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-cocoapods-
- name: Install Bundle
if: steps.cocoapods-cache.outputs.cache-hit != 'true'
run: |
cd KeychainExample
bundle install
- name: Install Detox dependencies
run: |
cd KeychainExample
brew tap wix/brew
brew install applesimutils
yarn detox clean-framework-cache
yarn detox build-framework-cache
- name: Xcode Version
run: |
xcodebuild -version
xcrun simctl list
- name: Build iOS Release
working-directory: ./KeychainExample
run: |
yarn build:ios
cd ios && pod install && cd -
yarn test:ios:build
env:
RCT_NEW_ARCH_ENABLED: 0
USE_HERMES: 1
- name: Test iOS Release
run: |
cd KeychainExample
yarn test:ios:run
- name: Upload test artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: ios-test-artifacts
path: KeychainExample/artifacts