-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci: Add React Native integration testing with Detox #5007
Changes from all commits
cfb47ad
83cc856
f80d81a
9aa15a2
59e36e9
fc8348b
19f83b5
f54f4af
3fdecc8
32842a1
c96b781
f2cab97
b713ffd
ed91285
527e3d8
1771e0a
77e2891
6a0ad5f
3203d05
567c30e
e09b6c3
a82409c
49e50d3
f3d5393
45e0be7
73d1d19
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
# | ||
# Check https://circleci.com/docs/2.0/language-javascript/ for more details | ||
# | ||
version: 2 | ||
version: 2.1 | ||
machine: | ||
environment: | ||
PATH: '${PATH}:${HOME}/${CIRCLE_PROJECT_REPONAME}/node_modules/.bin' | ||
|
@@ -14,6 +14,26 @@ defaults: &defaults | |
## this enables colors in the output | ||
TERM: xterm | ||
|
||
defaults_rn: &defaults_rn | ||
macos: | ||
xcode: '11.3.1' | ||
working_directory: ~/amplify-js-samples-staging | ||
|
||
commands: | ||
restore_pods: | ||
steps: | ||
- restore_cache: | ||
keys: | ||
- v1-storage-app-pods-{{ checksum "ios/Podfile.lock" }} | ||
- v1-storage-app-pods- | ||
|
||
save_pods: | ||
steps: | ||
- save_cache: | ||
key: v1-storage-app-pods-{{ checksum "ios/Podfile.lock" }} | ||
paths: | ||
- ios/Pods | ||
|
||
jobs: | ||
build: | ||
<<: *defaults | ||
|
@@ -23,8 +43,8 @@ jobs: | |
- checkout | ||
- run: yarn config set workspaces-experimental true | ||
- run: yarn | ||
- run: yarn run bootstrap | ||
- run: yarn run build | ||
- run: yarn bootstrap | ||
- run: yarn build | ||
|
||
- save_cache: | ||
key: amplify-ssh-deps-{{ .Branch }} | ||
|
@@ -250,6 +270,108 @@ jobs: | |
path: amplify-js-samples-staging/cypress/videos | ||
- store_artifacts: | ||
path: amplify-js-samples-staging/cypress/screenshots | ||
|
||
integ_rn_ios_storage: | ||
<<: *defaults_rn | ||
working_directory: ~/amplify-js-samples-staging/samples/react-native/storage/StorageApp | ||
steps: | ||
- attach_workspace: | ||
at: ~/ | ||
- run: | ||
name: Yarn Install | ||
command: yarn install --non-interactive --no-lockfile | ||
# Metro Bundler doesn't work with linked packages so we're copying them from amplify-js | ||
# TODO: utilize Verdaccio for this instead | ||
- run: | ||
name: 'Link aws-amplify' | ||
command: | | ||
cp -rf ~/amplify-js/packages/aws-amplify/dist ./node_modules/aws-amplify/dist | ||
cp -rf ~/amplify-js/packages/aws-amplify/lib ./node_modules/aws-amplify/lib | ||
cp -rf ~/amplify-js/packages/aws-amplify/lib-esm ./node_modules/aws-amplify/lib-esm | ||
|
||
cp -rf ~/amplify-js/packages/amazon-cognito-identity-js/dist ./node_modules/amazon-cognito-identity-js/dist | ||
cp -rf ~/amplify-js/packages/amazon-cognito-identity-js/lib ./node_modules/amazon-cognito-identity-js/lib | ||
|
||
cp -rf ~/amplify-js/packages/analytics/dist ./node_modules/@aws-amplify/analytics/dist | ||
cp -rf ~/amplify-js/packages/analytics/lib ./node_modules/@aws-amplify/analytics/lib | ||
cp -rf ~/amplify-js/packages/analytics/lib-esm ./node_modules/@aws-amplify/analytics/lib-esm | ||
|
||
cp -rf ~/amplify-js/packages/api/dist ./node_modules/@aws-amplify/api/dist | ||
cp -rf ~/amplify-js/packages/api/lib ./node_modules/@aws-amplify/api/lib | ||
cp -rf ~/amplify-js/packages/api/lib-esm ./node_modules/@aws-amplify/api/lib-esm | ||
|
||
cp -rf ~/amplify-js/packages/auth/dist ./node_modules/@aws-amplify/auth/dist | ||
cp -rf ~/amplify-js/packages/auth/lib ./node_modules/@aws-amplify/auth/lib | ||
cp -rf ~/amplify-js/packages/auth/lib-esm ./node_modules/@aws-amplify/auth/lib-esm | ||
|
||
cp -rf ~/amplify-js/packages/cache/dist ./node_modules/@aws-amplify/cache/dist | ||
cp -rf ~/amplify-js/packages/cache/lib ./node_modules/@aws-amplify/cache/lib | ||
cp -rf ~/amplify-js/packages/cache/lib-esm ./node_modules/@aws-amplify/cache/lib-esm | ||
|
||
cp -rf ~/amplify-js/packages/core/dist ./node_modules/@aws-amplify/core/dist | ||
cp -rf ~/amplify-js/packages/core/lib ./node_modules/@aws-amplify/core/lib | ||
cp -rf ~/amplify-js/packages/core/lib-esm ./node_modules/@aws-amplify/core/lib-esm | ||
|
||
cp -rf ~/amplify-js/packages/interactions/dist ./node_modules/@aws-amplify/interactions/dist | ||
cp -rf ~/amplify-js/packages/interactions/lib ./node_modules/@aws-amplify/interactions/lib | ||
cp -rf ~/amplify-js/packages/interactions/lib-esm ./node_modules/@aws-amplify/interactions/lib-esm | ||
|
||
cp -rf ~/amplify-js/packages/predictions/dist ./node_modules/@aws-amplify/predictions/dist | ||
cp -rf ~/amplify-js/packages/predictions/lib ./node_modules/@aws-amplify/predictions/lib | ||
cp -rf ~/amplify-js/packages/predictions/lib-esm ./node_modules/@aws-amplify/predictions/lib-esm | ||
|
||
cp -rf ~/amplify-js/packages/pubsub/dist ./node_modules/@aws-amplify/pubsub/dist | ||
cp -rf ~/amplify-js/packages/pubsub/lib ./node_modules/@aws-amplify/pubsub/lib | ||
cp -rf ~/amplify-js/packages/pubsub/lib-esm ./node_modules/@aws-amplify/pubsub/lib-esm | ||
|
||
cp -rf ~/amplify-js/packages/storage/dist ./node_modules/@aws-amplify/storage/dist | ||
cp -rf ~/amplify-js/packages/storage/lib ./node_modules/@aws-amplify/storage/lib | ||
cp -rf ~/amplify-js/packages/storage/lib-esm ./node_modules/@aws-amplify/storage/lib-esm | ||
|
||
cp -rf ~/amplify-js/packages/amplify-ui/dist ./node_modules/@aws-amplify/ui/dist | ||
cp -rf ~/amplify-js/packages/amplify-ui/lib ./node_modules/@aws-amplify/ui/lib | ||
|
||
cp -rf ~/amplify-js/packages/xr/dist ./node_modules/@aws-amplify/xr/dist | ||
cp -rf ~/amplify-js/packages/xr/lib ./node_modules/@aws-amplify/xr/lib | ||
cp -rf ~/amplify-js/packages/xr/lib-esm ./node_modules/@aws-amplify/xr/lib-esm | ||
|
||
- restore_pods | ||
- run: | ||
name: Install CocoaPods | ||
command: | | ||
cd ios | ||
pod install | ||
- save_pods | ||
- run: | ||
background: true | ||
command: xcrun simctl boot "iPhone 11" || true | ||
name: Start iOS simulator (background) | ||
- run: | ||
background: true | ||
command: yarn start | ||
name: Start Metro Packager (background) | ||
- run: | ||
name: Configure Detox | ||
environment: | ||
HOMEBREW_NO_AUTO_UPDATE: 1 | ||
command: | | ||
brew tap wix/brew | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, that's just what their getting started says: /~https://github.com/wix/Detox/blob/master/docs/Introduction.GettingStarted.md#3-install-applesimutils |
||
brew install applesimutils | ||
yarn global add detox-cli | ||
- run: | ||
name: Detox Build | ||
command: detox build -c ios.sim.debug | ||
- run: | ||
environment: | ||
JEST_JUNIT_OUTPUT_DIR: 'reports/junit' | ||
JEST_JUNIT_OUTPUT_NAME: 'detox-test-results.xml' | ||
name: Detox Test | ||
command: detox test -c ios.sim.debug -u | ||
- store_test_results: | ||
path: reports/junit | ||
- store_artifacts: | ||
path: reports/junit | ||
|
||
deploy: | ||
<<: *defaults | ||
working_directory: ~/amplify-js | ||
|
@@ -328,6 +450,15 @@ workflows: | |
- 1.0-stable | ||
requires: | ||
- integ_setup | ||
- integ_rn_ios_storage: | ||
filters: | ||
branches: | ||
only: | ||
- release | ||
- master | ||
- 1.0-stable | ||
requires: | ||
- integ_setup | ||
- deploy: | ||
filters: | ||
branches: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks painful, thank you for getting through this! My only question, NON BLOCKING, is Verdaccio will solve this? I know you have it as the callout but just want to double check if itll be something similar we would have to do with Verdaccio
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lol yea it was a little painful, but fun too. I think we technically only need the
/lib
dirs, since that's what RN consumes, but I copieddist
andlib-esm
as well just in case.Verdaccio will def solve this though. The reason we're doing that ^ is because we can't
yarn link
like we do for the other (web) integ tests. So instead of linking or copying, we'll justyarn add aws-amplify
from the Verdaccio registry running in CircleCIThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha makes sense to me on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah we only need
/lib
. This is a problem when doing local dev for amplify-js and React Native too.But I think we can do it a better way in the future, using Verdaccio ideally or even a script file that runs a build and changes the output directory to the corresponding path in the app's node_modules. And then here we just run that script in the config rather than writing all the steps to copy it over in the config (a bit verbose)?
But yeah its not a blocker for now, and great stuff getting this to work! 👍