diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..4237dfd --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,150 @@ +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-rn-webcrypto-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-rn-webcrypto-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 + + test-rn-platform-android: + executor: + name: android/android_machine + resource_class: large + tag: default + steps: + - checkout + + - restore_cache: + keys: + - gradle-rn-platform-{{ checksum "packages/react-native-platform/android/build.gradle" }} + - gradle-rn-platform- + + - run: + name: Run React Native Platform Android Tests + command: | + cd packages/react-native-platform/android + ./gradlew testDebugUnitTest --info + + - save_cache: + key: gradle-rn-platform-{{ checksum "packages/react-native-platform/android/build.gradle" }} + paths: + - ~/.gradle + - .gradle + + - store_test_results: + path: packages/react-native-platform/android/build/test-results + + - store_artifacts: + path: packages/react-native-platform/android/build/reports + destination: react-native-platform-android-test-reports + + test-rn-platform-ios: + executor: macos + steps: + - checkout + + - restore_cache: + keys: + - swift-spm-rn-platform-{{ checksum "packages/react-native-platform/ios/Package.swift" }} + - swift-spm-rn-platform- + + - run: + name: Run React Native Platform iOS Tests + command: | + cd packages/react-native-platform/ios + swift test --verbose + + - save_cache: + key: swift-spm-rn-platform-{{ checksum "packages/react-native-platform/ios/Package.swift" }} + paths: + - packages/react-native-platform/ios/.build + + - store_test_results: + path: packages/react-native-platform/ios/.build/test-results + + - store_artifacts: + path: packages/react-native-platform/ios/.build + destination: react-native-platform-ios-build-artifacts + +workflows: + version: 2 + build_and_test: + jobs: + - test-rn-webcrypto-android + - test-rn-webcrypto-ios + - test-rn-platform-android + - test-rn-platform-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..2c4f6b7 100644 --- a/e2e/apps/react-native-oidc/app.config.ts +++ b/e2e/apps/react-native-oidc/app.config.ts @@ -17,5 +17,40 @@ export default ({ config }: ConfigContext) => ({ ...config, extra: { env - } + }, + newArchEnabled: true, + "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)/_layout.tsx b/e2e/apps/react-native-oidc/app/(login)/_layout.tsx deleted file mode 100644 index aa7f199..0000000 --- a/e2e/apps/react-native-oidc/app/(login)/_layout.tsx +++ /dev/null @@ -1,45 +0,0 @@ -import { Tabs } from 'expo-router'; -import React from 'react'; -import { Platform } from 'react-native'; - -import { HapticTab } from '@/components/HapticTab'; -import { IconSymbol } from '@/components/ui/IconSymbol'; -import TabBarBackground from '@/components/ui/TabBarBackground'; -import { Colors } from '@/constants/Colors'; -import { useColorScheme } from '@/hooks/useColorScheme'; - -export default function TabLayout() { - const colorScheme = useColorScheme(); - - return ( - - , - }} - /> - , - }} - /> - - ); -} diff --git a/e2e/apps/react-native-oidc/app/(login)/index.tsx b/e2e/apps/react-native-oidc/app/(login)/index.tsx deleted file mode 100644 index 13dcace..0000000 --- a/e2e/apps/react-native-oidc/app/(login)/index.tsx +++ /dev/null @@ -1,56 +0,0 @@ -import { useEffect } from 'react'; -import { StyleSheet } from 'react-native'; -import { Image } from 'expo-image'; -import Constants from 'expo-constants'; -import { useAuth } from '@/hooks/useAuth'; - -import ParallaxScrollView from '@/components/ParallaxScrollView'; -import { ThemedText } from '@/components/ThemedText'; -import { ThemedView } from '@/components/ThemedView'; -import { HelloWave } from '@/components/HelloWave'; - - -export default function LoginScreen () { - const { signIn } = useAuth(); - - useEffect(() => { - (async () => { - await signIn('/(login)/token'); - })(); - }, [signIn]); - - return ( - - }> - - Loading... - - - - ); -} - -const styles = StyleSheet.create({ - container: { - flex: 1, - marginTop: Constants.statusBarHeight, - }, - titleContainer: { - flexDirection: 'row', - alignItems: 'center', - gap: 8, - }, - reactLogo: { - height: 178, - width: 290, - bottom: 0, - left: 0, - position: 'absolute', - }, -}); diff --git a/e2e/apps/react-native-oidc/app/(login)/token.tsx b/e2e/apps/react-native-oidc/app/(login)/token.tsx deleted file mode 100644 index 2992061..0000000 --- a/e2e/apps/react-native-oidc/app/(login)/token.tsx +++ /dev/null @@ -1,104 +0,0 @@ -import { useEffect, useState } from 'react'; -import { Button, StyleSheet } from 'react-native'; -import { Image } from 'expo-image'; -import { useRouter } from 'expo-router'; -import Constants from 'expo-constants'; -import { Credential, Token } from '@okta/auth-foundation'; -import { useAuth } from '@/hooks/useAuth'; - -import ParallaxScrollView from '@/components/ParallaxScrollView'; -import { ThemedText } from '@/components/ThemedText'; -import { ThemedView } from '@/components/ThemedView'; -import { HelloWave } from '@/components/HelloWave'; - - -export default function TokenScreen () { - const router = useRouter(); - const { signOut } = useAuth(); - const [token, setToken] = useState(null); - - useEffect(() => { - (async () => { - try { - const credential = await Credential.getDefault(); - if (credential) { - setToken(credential.token); - } - else { - router.navigate('/(login)'); - } - } - catch (err) { - console.log('error'); - console.log(err, (err as Error)?.stack); - throw err; - } - })(); - }, [router, token, setToken]); - - let body = ( - - Loading... - - - ); - - if (token) { - body = ( - <> - - Token - - - - Access Token - {token.accessToken} - Refresh Token - {token?.refreshToken} - - -