Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
141 changes: 141 additions & 0 deletions .github/workflows/e2e-detox-android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
name: Detox E2E - Android

on:
pull_request:
branches:
- main
- migration/react-native
- migration/rn-upgrade-webcrypto-poc
push:
branches:
- main
- migration/react-native
- migration/rn-upgrade-webcrypto-poc

jobs:
detox-android:
runs-on: ubuntu-22.04
timeout-minutes: 60

env:
GRADLE_OPTS: >-
-Dorg.gradle.jvmargs=-Xmx6g --XX:MaxMetaspaceSize=1g -Dfile.encoding=UTF-8
JAVA_TOOL_OPTIONS: "-Xmx2g"

steps:
- uses: actions/checkout@v4

- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "yarn"

- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"
cache: "gradle"

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Prebuild (Android) clean, no-install
working-directory: e2e/apps/react-native-oidc
run: |
EXPO_NO_GIT_STATUS=1 yarn expo prebuild --clean --platform android --no-install

- name: Ensure deterministic gradle.properties
working-directory: e2e/apps/react-native-oidc
run: |
mkdir -p android
touch android/gradle.properties

# Remove any previous EXPO_LINES block
awk '
BEGIN {skip=0}
/^# EXPO_LINES_START$/ {skip=1; next}
/^# EXPO_LINES_END$/ {skip=0; next}
skip == 0 {print}
' android/gradle.properties > android/gradle.properties.cleaned || true

mv android/gradle.properties.cleaned android/gradle.properties

# Append stable config
cat >> android/gradle.properties << 'EOF'
# EXPO_LINES_START
org.gradle.jvmargs=-Xmx6g -XX:MaxMetaspaceSize=1g -Dfile.encoding=UTF-8
org.gradle.daemon=true
org.gradle.parallel=false
org.gradle.workers.max=2
android.useFullClasspathForDexingTransform=false
# EXPO_LINES_END
EOF

echo "------------ Final android/gradle.properties -----------------"
cat android/gradle.properties
echo "--------------------------------------------------------------"

- name: Enable KVM
run: |
sudo apt-get update
sudo apt-get install -y qemu-kvm
sudo usermod -aG kvm $USER
sudo chmod 666 /dev/kvm

- name: Run Android Emulator + Detox tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 33
target: google_apis
arch: x86_64
profile: pixel_5
emulator-options: >-
-no-window -no-audio -no-boot-anim -gpu swiftshader_indirect
-camera-back none -camera-front none
-no-snapshot -no-snapshot-save -wipe-data
disable-animations: true
script: |
set -e

cd e2e/apps/react-native-oidc

adb start-server

echo "------ Waiting for emulator boot-------"

i=0
while ["$i" -lt 150]; do
boot="$(adb -s emulator-5554 shell getprop sys.boot_completed 2>/dev/null | tr -d '\r' || true)"
if [ "$boot" = "1" ]; then
echo "Emulator booted"
break
fi
i=$((i + 1))
sleep 2
done

if [ "$i" -ge 150 ]; then
echo "Emulator failed to boot in time"
adb devices || true
exit 1
fi

adb -s emulator-5554 shell settings put global window_animation_scale 0 || true
adb -s emulator-5554 shell settings put global transition_animation_scale 0 || true
adb -s emulator-5554 shell settings put global animator_duration_scale 0 || true

yarn workspace @repo/react-native-oidc e2e:build:android
yarn workspace @repo/react-native-oidc e2e:test:android

- name: Upload Detox Artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: detox-android-artifacts
path: |
e2e/apps/react-native-oidc/e2e/artifacts/**
e2e/apps/react-native-oidc/android/app/build/reports/**
e2e/apps/react-native-oidc/android/app/build/outputs/**
e2e/apps/react-native-oidc/.expo/**
108 changes: 108 additions & 0 deletions .github/workflows/e2e-detox-ios.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: Detox E2E - iOS

on:
pull_request:
branches:
- main
- migration/react-native
- migration/rn-upgrade-webcrypto-poc
push:
branches:
- main
- migration/react-native
- migration/rn-upgrade-webcrypto-poc

jobs:
detox-ios:
runs-on: macos-latest
timeout-minutes: 60

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "yarn"

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Install iOS tools
run: |
brew update
brew tap wix/brew
brew install applesimutils
brew install watchman || true

- name: Print Xcode version
run: |
xcodebuild -version
xcode-select -p

- name: Select Xcode version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "16.4"

- name: Prebuild (Expo) + Install Pods
run: |
set -euo pipefail
cd e2e/apps/react-native-oidc

# Prebuild (generate ios / and the .xcworkspace)
EXPO_NO_GIT_STATUS=1 yarn expo prebuild --clean --no-install

echo "------ ios folder -------"
ls -la ios || true

echo "------ projects ---------"
ls -la ios/*.xcodeproj || true

# Intall CocoaPods

cd ios
if [[ -f Gemfile ]]; then
gem install bundler
bundle install
bundle exec pod install --repo-update
else
sudo gem install cocoapods -N
pod install --repo-update
fi

echo "------ list ios root ---------"
ls -la .

cd ..

echo "------ workspaces -------"
ls -la ios/*.xcworkspace || true

# Ensure the workspace was created
WORKSPACE="$(ls -1 ios/*.xcworkspace | head -n 1 || true)"
if [ -z "$WORKSPACE" ]; then
echo "ERROR: No .xcworkspace found in ios/ after expo prebuild"
exit 1
fi
echo "Detected workspace: ${WORKSPACE}"

echo "------ toolchain umbrella -------"
ls -la ios/Pods/Headers/Public/React-Core|| true
echo "--------------------------------"

- name: Boot simulator
run: |
set -euo pipefail

# Prefered device if available; fallback to any available iPhone simulator
xcrun simctl boot "iPhone 16e" || true
xcrun simctl list devices available

- name: Build + Test Detox
run: |
set -euo pipefail
yarn workspace @repo/react-native-oidc e2e:build:ios
yarn workspace @repo/react-native-oidc e2e:test:ios
47 changes: 39 additions & 8 deletions e2e/apps/react-native-oidc/app.config.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,52 @@
import { ConfigContext } from 'expo/config';
import envModule from '@repo/env';

import { ConfigContext } from "expo/config";
import envModule from "@repo/env";

envModule.setEnvironmentVarsFromTestEnv(__dirname);
const env: any = {};
// List of environment variables made available to the app
['ISSUER', 'NATIVE_CLIENT_ID', 'USE_DPOP'].forEach((key) => {
[
"ISSUER",
"NATIVE_CLIENT_ID",
"REDIRECT_URI",
"LOGOUT_REDIRECT_URI",
"USE_DPOP",
].forEach((key) => {
if (!process.env[key]) {
console.warn(`Environment variable ${key} should be set for development. See README.md`);
console.warn(
`Environment variable ${key} should be set for development. See README.md`,
);
}
env[key] = process.env[key];
});

console.log("Expo extra.env at config time = ", env);

export default ({ config }: ConfigContext) => ({
...config,
extra: {
env
}
});
env,
},
scheme: "com.oktapreview.tciuc-test",
plugins: [
"expo-font",
"expo-router",
"expo-web-browser",
[
"expo-build-properties",
{
android: {
packagingOptions: {
pickFirst: ["**/libfbjni.so", "**/libc++_shared.so"],
},
},
},
],
],
android: {
package: "com.anonymous.reporeactnativeoidc",
},
ios: {
...(config.ios ?? {}),
bundleIdentifier: "com.anonymous.reporeactnativeoidc",
},
});
Loading