Skip to content
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

Bugfix/rn upgrade circleci and e2e #1602

Merged
merged 10 commits into from
May 28, 2020
Merged
7 changes: 7 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -148,6 +150,11 @@ jobs:
- run:
name: Install Sentry CLI
command: curl -sL https://sentry.io/get-cli/ | bash
- run:
name: Install CocoaPods
command: |
sudo gem install cocoapods
cd ios && pod install && cd ..
- run:
name: pre-release
command: METAMASK_ENVIRONMENT='production' yarn build:ios:pre-release
Expand Down
Empty file added android/keystores/.gitkeep
Empty file.
20 changes: 20 additions & 0 deletions ios/MetaMask.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */,
Expand Down Expand Up @@ -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;
Expand Down
12 changes: 8 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@
"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",
Expand Down Expand Up @@ -210,31 +214,31 @@
"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"
}
},
"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"
}
},
"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"
}
},
"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"
Expand Down
45 changes: 44 additions & 1 deletion scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down