diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..6c98d46 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,88 @@ +version: 2.1 + +orbs: + general-platform-helpers: okta/general-platform-helpers@1.9.4 + platform-helpers: okta/platform-helpers@2.0.0 + macos: circleci/macos@2 + android: circleci/android@3.1.0 + +executors: + # android: + # docker: + # - image: cimg/android:2024.12 + # environment: + # GRADLE_OPTS: -Xmx2g + # resource_class: large + + macos: + macos: + xcode: "16.3" + resource_class: m4pro.medium + +jobs: + test-android: + executor: + name: android/android_machine + resource_class: large + tag: default + steps: + - checkout + + - restore_cache: + keys: + - gradle-{{ checksum "packages/react-native-webcrypto-bridge/android/build.gradle" }} + - gradle- + + - run: + name: Run Android Unit and Integration Tests + command: | + cd packages/react-native-webcrypto-bridge/android + ./gradlew testDebugUnitTest --info + + - save_cache: + key: gradle-{{ checksum "packages/react-native-webcrypto-bridge/android/build.gradle" }} + paths: + - ~/.gradle + - .gradle + + - store_test_results: + path: packages/react-native-webcrypto-bridge/android/build/test-results + + - store_artifacts: + path: packages/react-native-webcrypto-bridge/android/build/reports + destination: android-test-reports + + test-ios: + executor: macos + steps: + - checkout + + - restore_cache: + keys: + - swift-spm-{{ checksum "packages/react-native-webcrypto-bridge/ios/Package.swift" }} + - swift-spm- + + - run: + name: Run iOS Unit and Integration Tests + command: | + cd packages/react-native-webcrypto-bridge/ios + swift test --verbose + + - save_cache: + key: swift-spm-{{ checksum "packages/react-native-webcrypto-bridge/ios/Package.swift" }} + paths: + - packages/react-native-webcrypto-bridge/ios/.build + + - store_test_results: + path: packages/react-native-webcrypto-bridge/ios/.build/test-results + + - store_artifacts: + path: packages/react-native-webcrypto-bridge/ios/.build + destination: ios-build-artifacts + +workflows: + version: 2 + build_and_test: + jobs: + - test-android + - test-ios diff --git a/e2e/apps/react-native-oidc/.gitignore b/e2e/apps/react-native-oidc/.gitignore index 8cbb0d2..9516583 100644 --- a/e2e/apps/react-native-oidc/.gitignore +++ b/e2e/apps/react-native-oidc/.gitignore @@ -39,3 +39,5 @@ yarn-error.* *.tsbuildinfo app-example + +.idea/ \ No newline at end of file diff --git a/e2e/apps/react-native-oidc/app.config.ts b/e2e/apps/react-native-oidc/app.config.ts index 7856dac..7509c40 100644 --- a/e2e/apps/react-native-oidc/app.config.ts +++ b/e2e/apps/react-native-oidc/app.config.ts @@ -17,5 +17,39 @@ export default ({ config }: ConfigContext) => ({ ...config, extra: { env - } + }, + "android": { + "package": "com.anonymous.reporeactnativeoidc" + }, + "ios": { + "bundleIdentifier": "com.anonymous.reporeactnativeoidc" + }, + scheme: "com.oktapreview.jperreault-test", + intentFilters: [ + { + action: "VIEW", + autoVerify: true, + data: [ + { + scheme: "com.oktapreview.jperreault-test" + } + ], + category: ["BROWSABLE", "DEFAULT"] + } + ], + "plugins": [ + "expo-font", + "expo-router", + [ + "expo-build-properties", + { + "ios": { + "newArchEnabled": true + }, + "android": { + "newArchEnabled": true + } + } + ] + ] }); \ No newline at end of file diff --git a/e2e/apps/react-native-oidc/app/(login)/index.tsx b/e2e/apps/react-native-oidc/app/(login)/index.tsx index 13dcace..e3fd92d 100644 --- a/e2e/apps/react-native-oidc/app/(login)/index.tsx +++ b/e2e/apps/react-native-oidc/app/(login)/index.tsx @@ -1,5 +1,5 @@ -import { useEffect } from 'react'; -import { StyleSheet } from 'react-native'; +import { useCallback, useEffect, useState } from 'react'; +import { StyleSheet, Button } from 'react-native'; import { Image } from 'expo-image'; import Constants from 'expo-constants'; import { useAuth } from '@/hooks/useAuth'; @@ -12,12 +12,42 @@ import { HelloWave } from '@/components/HelloWave'; export default function LoginScreen () { const { signIn } = useAuth(); + const [ authError, setAuthError ] = useState(null); + + const signInFunc = useCallback(async () => { + try { + await signIn('/(login)/token'); + } + catch (err) { + setAuthError(err as Error); + } + }, [signIn, setAuthError]); useEffect(() => { (async () => { - await signIn('/(login)/token'); + await signInFunc(); })(); - }, [signIn]); + }, [signInFunc]); + + let view = ( + <> + Loading... + + + ); + + if (authError) { + view = ( + <> + Error + {authError.message} +