From 85e730d4e0cca366665903b42fb45b33e55df532 Mon Sep 17 00:00:00 2001 From: andrepimenta Date: Wed, 27 May 2020 20:25:36 +0100 Subject: [PATCH 1/9] Fix circle ci and improve e2e --- .circleci/config.yml | 2 +- android/keystores/.gitkeep | 0 ios/MetaMask.xcodeproj/project.pbxproj | 20 ++++++++++++ package.json | 13 +++++--- scripts/build.sh | 45 +++++++++++++++++++++++++- 5 files changed, 73 insertions(+), 7 deletions(-) create mode 100644 android/keystores/.gitkeep diff --git a/.circleci/config.yml b/.circleci/config.yml index f61a1b7ced3..a4170493b88 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -11,7 +11,7 @@ aliases: - &install-node-dependencies | - rm -rf node_modules/websocket/.git && yarn install --network-timeout 300000 --frozen-lockfile --network-concurrency 1 + rm -rf node_modules/websocket/.git && yarn install --network-timeout 300000 --frozen-lockfile --network-concurrency 1 && (cd ios/ && pod install && cd ..) defaults: &defaults working_directory: ~/MetaMask diff --git a/android/keystores/.gitkeep b/android/keystores/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/ios/MetaMask.xcodeproj/project.pbxproj b/ios/MetaMask.xcodeproj/project.pbxproj index 20d1ac088ef..75410465661 100644 --- a/ios/MetaMask.xcodeproj/project.pbxproj +++ b/ios/MetaMask.xcodeproj/project.pbxproj @@ -466,6 +466,7 @@ buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "MetaMask" */; buildPhases = ( 6DA7FCA07245EB28ED1BEB65 /* [CP] Check Pods Manifest.lock */, + 65E00B0A247EA25400E5AC88 /* Start Packager */, 15FDD86321B76696006B7C35 /* Override xcconfig files */, 13B07F871A680F5B00A75B9A /* Sources */, 13B07F8C1A680F5B00A75B9A /* Frameworks */, @@ -692,6 +693,25 @@ shellPath = /bin/sh; shellScript = "if [ -e ../.ios.env ]\nthen\n cp -rf ../.ios.env debug.xcconfig\n cp -rf ../.ios.env release.xcconfig\nelse\n cp -rf ../.ios.env.example debug.xcconfig\n cp -rf ../.ios.env.example release.xcconfig\nfi\n\n"; }; + 65E00B0A247EA25400E5AC88 /* Start Packager */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = "Start Packager"; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../node_modules/react-native/scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n exit 2\n fi\n else\n open \"$SRCROOT/../node_modules/react-native/scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi\n"; + showEnvVarsInLog = 0; + }; 6DA7FCA07245EB28ED1BEB65 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; diff --git a/package.json b/package.json index b3e47ee6b68..eeb72853e57 100644 --- a/package.json +++ b/package.json @@ -13,13 +13,16 @@ "lint:fix": "eslint '**/*.js' --fix --ignore-path=.prettierignore", "format": "prettier '**/*.{js,json}' --write", "start:ios": "./scripts/build.sh ios debug", + "start:ios:e2e": "./scripts/build.sh ios debugE2E", "start:ios:device": "./scripts/build.sh ios debug --device", "start:android": "./scripts/build.sh android debug", + "start:android:e2e": "./scripts/build.sh android debugE2E", "build:announce": "node ./scripts/metamask-bot-build-announce.js", "build:android:release": "./scripts/build.sh android release", + "build:android:release:e2e": "./scripts/build.sh android releaseE2E", "build:android:pre-release": "./scripts/build.sh android release --pre", "build:android:pre-release:bundle": "GENERATE_BUNDLE=true ./scripts/build.sh android release --pre", - "build:ios:release": "./scripts/build.sh ios release", + "build:ios:release:e2e": "./scripts/build.sh ios releaseE2E", "build:ios:pre-release": "./scripts/build.sh ios release --pre", "release:android": "./scripts/build.sh android release && open android/app/build/outputs/apk/release/", "release:ios": "./scripts/build.sh ios release", @@ -210,7 +213,7 @@ "configurations": { "ios.sim.debug": { "binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/MetaMask.app", - "build": "yarn start:ios && xcodebuild -workspace ios/MetaMask.xcworkspace -scheme MetaMask -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build", + "build": "yarn start:ios:e2e", "type": "ios.simulator", "device": { "type": "iPhone 11 Pro" @@ -218,7 +221,7 @@ }, "ios.sim.release": { "binaryPath": "ios/build/Build/Products/Release-iphonesimulator/MetaMask.app", - "build": "METAMASK_ENVIRONMENT='production' yarn build:ios:release && METAMASK_ENVIRONMENT='production' xcodebuild -workspace ios/MetaMask.xcworkspace -scheme MetaMask -configuration Release -sdk iphonesimulator -derivedDataPath ios/build", + "build": "METAMASK_ENVIRONMENT='production' yarn build:ios:release:e2e", "type": "ios.simulator", "device": { "type": "iPhone 11 Pro" @@ -226,7 +229,7 @@ }, "android.emu.debug": { "binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk", - "build": "source .android.env && cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ..", + "build": "yarn start:android:e2e", "type": "android.emulator", "device": { "avdName": "Pixel_3_API_29" @@ -234,7 +237,7 @@ }, "android.emu.release": { "binaryPath": "android/app/build/outputs/apk/release/app-release.apk", - "build": "source .android.env && cd android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release && cd ..", + "build": "METAMASK_ENVIRONMENT='production' yarn build:android:release:e2e", "type": "android.emulator", "device": { "avdName": "Pixel_3_API_29" diff --git a/scripts/build.sh b/scripts/build.sh index d18a8ab856c..ed0902be0ea 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -151,11 +151,21 @@ buildAndroidRun(){ react-native run-android } +buildAndroidRunE2E(){ + prebuild_android + source .android.env && cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd .. +} + buildIosSimulator(){ prebuild_ios react-native run-ios --simulator "iPhone 11 Pro" } +buildIosSimulatorE2E(){ + prebuild_ios + xcodebuild -workspace ios/MetaMask.xcworkspace -scheme MetaMask -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build +} + buildIosDevice(){ prebuild_ios react-native run-ios --device @@ -181,6 +191,26 @@ buildIosRelease(){ fi } +buildIosReleaseE2E(){ + prebuild_ios + + # Replace release.xcconfig with ENV vars + if [ "$PRE_RELEASE" = true ] ; then + echo "Setting up env vars..."; + echo "$IOS_ENV" | tr "|" "\n" > $IOS_ENV_FILE + echo "Build started..." + brew install watchman + cd ios && bundle install && bundle exec fastlane prerelease + # Generate sourcemaps + yarn sourcemaps:ios + else + if [ ! -f "ios/release.xcconfig" ] ; then + echo "$IOS_ENV" | tr "|" "\n" > ios/release.xcconfig + fi + xcodebuild -workspace ios/MetaMask.xcworkspace -scheme MetaMask -configuration Release -sdk iphonesimulator -derivedDataPath ios/build + fi +} + buildAndroidRelease(){ if [ "$PRE_RELEASE" = false ] ; then adb uninstall io.metamask || true @@ -212,9 +242,18 @@ buildAndroidRelease(){ fi } +buildAndroidReleaseE2E(){ + prebuild_android + source .android.env && cd android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release && cd .. +} + buildAndroid() { if [ "$MODE" == "release" ] ; then buildAndroidRelease + elif [ "$MODE" == "releaseE2E" ] ; then + buildAndroidReleaseE2E + elif [ "$MODE" == "debugE2E" ] ; then + buildAndroidRunE2E else buildAndroidRun fi @@ -223,6 +262,10 @@ buildAndroid() { buildIos() { if [ "$MODE" == "release" ] ; then buildIosRelease + elif [ "$MODE" == "releaseE2E" ] ; then + buildIosReleaseE2E + elif [ "$MODE" == "debugE2E" ] ; then + buildIosSimulatorE2E else if [ "$RUN_DEVICE" = true ] ; then buildIosDevice @@ -256,7 +299,7 @@ checkParameters "$@" printTitle -if [ "$MODE" == "release" ]; then +if [ "$MODE" == "release" ] || [ "$MODE" == "releaseE2E" ] ; then checkAuthToken 'sentry.release.properties' export SENTRY_PROPERTIES="${REPO_ROOT_DIR}/sentry.release.properties" if [ -z "$METAMASK_ENVIRONMENT" ]; then From cf8b1ce0d9a6c7b92fee079983b66d73595d9935 Mon Sep 17 00:00:00 2001 From: andrepimenta Date: Wed, 27 May 2020 20:45:10 +0100 Subject: [PATCH 2/9] Update config.yml --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index a4170493b88..f98b52e19ed 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -23,6 +23,7 @@ jobs: - image: circleci/node:10 steps: - checkout + - run: curl https://cocoapods-specs.circleci.com/fetch-cocoapods-repo-from-s3.sh | bash -s cf - run: *install-node-dependencies - persist_to_workspace: root: . From c443a89bb31ff5aecbf7c14edccc63dfdec242d9 Mon Sep 17 00:00:00 2001 From: andrepimenta Date: Wed, 27 May 2020 20:49:46 +0100 Subject: [PATCH 3/9] install pods and fix removed command --- .circleci/config.yml | 1 + package.json | 1 + 2 files changed, 2 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index f98b52e19ed..d39ab81d993 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -36,6 +36,7 @@ jobs: steps: - checkout - restore_cache: *restore-node-cache + - run: curl https://cocoapods-specs.circleci.com/fetch-cocoapods-repo-from-s3.sh | bash -s cf - run: *install-node-dependencies - persist_to_workspace: root: . diff --git a/package.json b/package.json index eeb72853e57..e80ceac7ebe 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "build:android:release:e2e": "./scripts/build.sh android releaseE2E", "build:android:pre-release": "./scripts/build.sh android release --pre", "build:android:pre-release:bundle": "GENERATE_BUNDLE=true ./scripts/build.sh android release --pre", + "build:ios:release": "./scripts/build.sh ios release", "build:ios:release:e2e": "./scripts/build.sh ios releaseE2E", "build:ios:pre-release": "./scripts/build.sh ios release --pre", "release:android": "./scripts/build.sh android release && open android/app/build/outputs/apk/release/", From aeaec9afdce78675f42320c7440a8fdb46d3d56e Mon Sep 17 00:00:00 2001 From: andrepimenta Date: Wed, 27 May 2020 21:05:33 +0100 Subject: [PATCH 4/9] test another way to install pods --- .circleci/config.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d39ab81d993..2e3e8e26964 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -11,7 +11,7 @@ aliases: - &install-node-dependencies | - rm -rf node_modules/websocket/.git && yarn install --network-timeout 300000 --frozen-lockfile --network-concurrency 1 && (cd ios/ && pod install && cd ..) + rm -rf node_modules/websocket/.git && yarn install --network-timeout 300000 --frozen-lockfile --network-concurrency 1 defaults: &defaults working_directory: ~/MetaMask @@ -23,8 +23,12 @@ jobs: - image: circleci/node:10 steps: - checkout - - run: curl https://cocoapods-specs.circleci.com/fetch-cocoapods-repo-from-s3.sh | bash -s cf - run: *install-node-dependencies + - run: + name: Install CocoaPods + command: | + curl https://cocoapods-specs.circleci.com/fetch-cocoapods-repo-from-s3.sh | bash -s cf + cd ios && pod install && cd .. - persist_to_workspace: root: . paths: @@ -36,8 +40,12 @@ jobs: steps: - checkout - restore_cache: *restore-node-cache - - run: curl https://cocoapods-specs.circleci.com/fetch-cocoapods-repo-from-s3.sh | bash -s cf - run: *install-node-dependencies + - run: + name: Install CocoaPods + command: | + curl https://cocoapods-specs.circleci.com/fetch-cocoapods-repo-from-s3.sh | bash -s cf + cd ios && pod install && cd .. - persist_to_workspace: root: . paths: From 8cacbb7d3d4525ec21e89c8d587fc6e24b3fe1b0 Mon Sep 17 00:00:00 2001 From: andrepimenta Date: Wed, 27 May 2020 21:18:21 +0100 Subject: [PATCH 5/9] yet another coocapods try --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2e3e8e26964..bb972107a7b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -27,7 +27,7 @@ jobs: - run: name: Install CocoaPods command: | - curl https://cocoapods-specs.circleci.com/fetch-cocoapods-repo-from-s3.sh | bash -s cf + sudo gem install cocoapods cd ios && pod install && cd .. - persist_to_workspace: root: . @@ -44,7 +44,7 @@ jobs: - run: name: Install CocoaPods command: | - curl https://cocoapods-specs.circleci.com/fetch-cocoapods-repo-from-s3.sh | bash -s cf + sudo gem install cocoapods cd ios && pod install && cd .. - persist_to_workspace: root: . From 04cbd1ee5217915fbb23d4a77e650a7f2a255772 Mon Sep 17 00:00:00 2001 From: andrepimenta Date: Wed, 27 May 2020 21:47:40 +0100 Subject: [PATCH 6/9] trying brew install --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index bb972107a7b..1f83b71769c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -27,7 +27,7 @@ jobs: - run: name: Install CocoaPods command: | - sudo gem install cocoapods + brew install cocoapods cd ios && pod install && cd .. - persist_to_workspace: root: . @@ -44,7 +44,7 @@ jobs: - run: name: Install CocoaPods command: | - sudo gem install cocoapods + brew install cocoapods cd ios && pod install && cd .. - persist_to_workspace: root: . From 45945d6ff2f76d6b0a2123ee8537ba912b918d54 Mon Sep 17 00:00:00 2001 From: andrepimenta Date: Wed, 27 May 2020 22:06:10 +0100 Subject: [PATCH 7/9] Moving cocapods install to pre release ios --- .circleci/config.yml | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1f83b71769c..d674fb0ee90 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -24,11 +24,6 @@ jobs: steps: - checkout - run: *install-node-dependencies - - run: - name: Install CocoaPods - command: | - brew install cocoapods - cd ios && pod install && cd .. - persist_to_workspace: root: . paths: @@ -41,11 +36,6 @@ jobs: - checkout - restore_cache: *restore-node-cache - run: *install-node-dependencies - - run: - name: Install CocoaPods - command: | - brew install cocoapods - cd ios && pod install && cd .. - persist_to_workspace: root: . paths: @@ -158,6 +148,11 @@ jobs: - run: name: Install Sentry CLI command: curl -sL https://sentry.io/get-cli/ | bash + - run: + name: Install CocoaPods + command: | + brew install cocoapods + cd ios && pod install && cd .. - run: name: pre-release command: METAMASK_ENVIRONMENT='production' yarn build:ios:pre-release From ffa6cf8a63b948223975dcb728706e029a446d37 Mon Sep 17 00:00:00 2001 From: andrepimenta Date: Wed, 27 May 2020 22:16:20 +0100 Subject: [PATCH 8/9] Install cocoapods with gem --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d674fb0ee90..630f28b0517 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -151,7 +151,7 @@ jobs: - run: name: Install CocoaPods command: | - brew install cocoapods + sudo gem install cocoapods cd ios && pod install && cd .. - run: name: pre-release From 3be94aa87e5166441bbea3dedb7cf39db1c897d0 Mon Sep 17 00:00:00 2001 From: andrepimenta Date: Thu, 28 May 2020 14:01:01 +0100 Subject: [PATCH 9/9] Trying increasing java memory on circleci pre release android --- .circleci/config.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 630f28b0517..92d598c0f26 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -108,6 +108,8 @@ jobs: command: echo 'weew - everything passed!' publish-pre-release-android: working_directory: ~/MetaMask + environment: + _JAVA_OPTIONS: -Xmx3g docker: - image: circleci/android:api-28-node8-alpha steps: