test: add new e2e test scenarios #73
Workflow file for this run
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 Tests' | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
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 | |
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: | | |
cd KeychainExample/e2e/utils | |
./enrollFingerprintAndroid.sh | |
cd ../.. | |
yarn test:android:run | |
env: | |
API_LEVEL: ${{ matrix.api-level }} | |
- name: Upload test artifacts | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: android-test-artifacts | |
path: KeychainExample/artifacts | |
build-ios: | |
name: Build and Test iOS | |
runs-on: macos-13 | |
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 |