change App ID for PRs on Android to avoid replacing release

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2019-02-11 22:24:36 +01:00
parent cf6cbd7fa8
commit 1d00e9bb3d
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
13 changed files with 103 additions and 25 deletions

View File

@ -6,8 +6,10 @@ import com.android.build.OutputFile
import com.sun.org.apache.xalan.internal.xsltc.compiler.Copy import com.sun.org.apache.xalan.internal.xsltc.compiler.Copy
/** /**
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets * The react.gradle file registers a task for each build variant:
* and bundleReleaseJsAndAssets). * - bundlePrJsAndAssets
* - bundleDebugJsAndAssets
* - bundleReleaseJsAndAssets
* These basically call `react-native bundle` with the correct arguments during the Android build * These basically call `react-native bundle` with the correct arguments during the Android build
* cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
* bundle directly from the development server. Below you can see all the possible configurations * bundle directly from the development server. Below you can see all the possible configurations
@ -75,8 +77,9 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.Copy
* ] * ]
*/ */
project.ext.react = [ project.ext.react = [
nodeExecutableAndArgs: ["node", "--max-old-space-size=16384"], nodeExecutableAndArgs: ["node", "--max-old-space-size=16384"],
entryFile: "index.android.js" entryFile: "index.android.js",
bundleInPr: true,
] ]
apply from: "../../node_modules/react-native/react.gradle" apply from: "../../node_modules/react-native/react.gradle"
@ -209,6 +212,14 @@ android {
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release signingConfig signingConfigs.release
} }
pr {
initWith release
applicationIdSuffix ".pr"
versionNameSuffix ".pr"
matchingFallbacks = ["release"]
// necessary to make react-native-config's code generation work
resValue "string", "build_config_package", "im.status.ethereum"
}
} }
// applicationVariants are e.g. debug, release // applicationVariants are e.g. debug, release
applicationVariants.all { variant -> applicationVariants.all { variant ->

View File

@ -1,3 +1,3 @@
<resources> <resources>
<string name="app_name">Status Debug</string> <string name="app_name">Status Debug</string>
</resources> </resources>

View File

@ -1,7 +1,6 @@
<resources> <resources>
<string name="app_name">Status</string>
<string name="root_warning">Your phone appears to be ROOTED, by pressing CONTINUE you understand and accept the risks in using this software.</string> <string name="root_warning">Your phone appears to be ROOTED, by pressing CONTINUE you understand and accept the risks in using this software.</string>
<string name="root_okay">Continue</string> <string name="root_okay">Continue</string>
<string name="root_cancel">Exit</string> <string name="root_cancel">Exit</string>
<string name="notification_channel_id">status-im</string> <string name="notification_channel_id">status-im</string>
</resources> </resources>

View File

@ -0,0 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<!-- These are added by React Native for debug mode, but actually aren't needed in release mode -->
<uses-permission tools:node="remove" android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
</manifest>

View File

@ -0,0 +1,42 @@
{
"project_info": {
"project_number": "854811651919",
"firebase_url": "https://status-react-app.firebaseio.com",
"project_id": "status-react-app",
"storage_bucket": "status-react-app.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:854811651919:android:11ee7444ded8a00a",
"android_client_info": {
"package_name": "im.status.ethereum.pr"
}
},
"oauth_client": [
{
"client_id": "854811651919-gua52csicclb5p9gr4eeu33ukk0aaphj.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyAOF4W1j8GYeXzzVKRfNKlXywD6bx0rJtQ"
}
],
"services": {
"analytics_service": {
"status": 1
},
"appinvite_service": {
"status": 1,
"other_platform_oauth_client": []
},
"ads_service": {
"status": 2
}
}
}
],
"configuration_version": "1"
}

View File

@ -0,0 +1,3 @@
<resources>
<string name="app_name">Status PR</string>
</resources>

View File

@ -0,0 +1,3 @@
<resources>
<string name="app_name">Status</string>
</resources>

View File

@ -3,7 +3,12 @@ utils = load 'ci/utils.groovy'
def bundle(type = 'nightly') { def bundle(type = 'nightly') {
/* Disable Gradle Daemon https://stackoverflow.com/questions/38710327/jenkins-builds-fail-using-the-gradle-daemon */ /* Disable Gradle Daemon https://stackoverflow.com/questions/38710327/jenkins-builds-fail-using-the-gradle-daemon */
def gradleOpt = "-PbuildUrl='${currentBuild.absoluteUrl}' -Dorg.gradle.daemon=false " def gradleOpt = "-PbuildUrl='${currentBuild.absoluteUrl}' -Dorg.gradle.daemon=false "
if (type == 'release') { def target = "release"
if (type in ['pr', 'e2e']) {
/* PR builds shouldn't replace normal releases */
target = 'pr'
} else if (type == 'release') {
gradleOpt += "-PreleaseVersion='${utils.getVersion('mobile_files')}'" gradleOpt += "-PreleaseVersion='${utils.getVersion('mobile_files')}'"
} }
dir('android') { dir('android') {
@ -18,12 +23,16 @@ def bundle(type = 'nightly') {
passwordVariable: 'STATUS_RELEASE_KEY_PASSWORD' passwordVariable: 'STATUS_RELEASE_KEY_PASSWORD'
) )
]) { ]) {
utils.nix_sh "./gradlew assembleRelease ${gradleOpt}" utils.nix_sh "./gradlew assemble${target.capitalize()} ${gradleOpt}"
} }
} }
sh 'find android/app/build/outputs/apk'
def outApk = "android/app/build/outputs/apk/${target}/app-${target}.apk"
def pkg = utils.pkgFilename(type, 'apk') def pkg = utils.pkgFilename(type, 'apk')
sh "cp android/app/build/outputs/apk/release/app-release.apk ${pkg}" /* rename for upload */
/* necessary for Diawi upload */ sh "cp ${outApk} ${pkg}"
/* necessary for Fastlane */
env.APK_PATH = pkg
env.DIAWI_APK = pkg env.DIAWI_APK = pkg
return pkg return pkg
} }

View File

@ -270,12 +270,15 @@ end
platform :android do platform :android do
# Optional env variables
APK_PATH = ENV["APK_PATH"] || "android/app/build/outputs/apk/release/app-release.apk"
desc "Deploy a new internal build to Google Play" desc "Deploy a new internal build to Google Play"
desc "expects GOOGLE_PLAY_JSON_KEY environment variable" desc "expects GOOGLE_PLAY_JSON_KEY environment variable"
lane :nightly do lane :nightly do
upload_to_play_store( upload_to_play_store(
track: "internal", track: "internal",
apk: "android/app/build/outputs/apk/release/app-release.apk", apk: APK_PATH,
json_key_data: ENV["GOOGLE_PLAY_JSON_KEY"] json_key_data: ENV["GOOGLE_PLAY_JSON_KEY"]
) )
@ -286,7 +289,7 @@ platform :android do
lane :release do lane :release do
upload_to_play_store( upload_to_play_store(
track: "alpha", track: "alpha",
apk: "android/app/build/outputs/apk/release/app-release.apk", apk: APK_PATH,
json_key_data: ENV["GOOGLE_PLAY_JSON_KEY"] json_key_data: ENV["GOOGLE_PLAY_JSON_KEY"]
) )
end end
@ -310,8 +313,7 @@ platform :android do
desc "---" desc "---"
desc "Output: writes `fastlane/diawi.out` file url of the uploded file" desc "Output: writes `fastlane/diawi.out` file url of the uploded file"
lane :upload_diawi do lane :upload_diawi do
apk = ENV["DIAWI_APK"] || "android/app/build/outputs/apk/release/app-release.apk" upload_to_diawi(APK_PATH)
upload_to_diawi(apk)
end end
desc "`fastlane android saucelabs` - upload .apk to sauce labs" desc "`fastlane android saucelabs` - upload .apk to sauce labs"
@ -321,8 +323,6 @@ platform :android do
desc "expects to have a saucelabs destination name as SAUCE_LABS_NAME env variable" desc "expects to have a saucelabs destination name as SAUCE_LABS_NAME env variable"
desc "will fails if file isn't there" desc "will fails if file isn't there"
lane :saucelabs do lane :saucelabs do
upload_to_saucelabs( upload_to_saucelabs(APK_PATH)
"android/app/build/outputs/apk/release/app-release.apk"
)
end end
end end

View File

@ -13,8 +13,9 @@
[goog.object :as object] [goog.object :as object]
cljs.core.specs.alpha)) cljs.core.specs.alpha))
(when js/goog.DEBUG (if js/goog.DEBUG
(.ignoreWarnings (.-YellowBox js-dependencies/react-native) #js ["re-frame: overwriting"])) (.ignoreWarnings (.-YellowBox js-dependencies/react-native) #js ["re-frame: overwriting"])
(aset js/console "disableYellowBox" true))
(defn init [app-root] (defn init [app-root]
(log/set-level! config/log-level) (log/set-level! config/log-level)

View File

@ -64,6 +64,6 @@ class TestSignInOffline(MultipleDeviceTestCase):
sign_in.accept_agreements() sign_in.accept_agreements()
home = sign_in.sign_in() home = sign_in.sign_in()
home.home_button.wait_for_visibility_of_element() home.home_button.wait_for_visibility_of_element()
connection_text = home.connection_status.text connection_text = sign_in.connection_status.text
if connection_text != 'Offline': if connection_text != 'Offline':
pytest.fail("Connection status text '%s' doesn't match expected 'Offline'" % connection_text) pytest.fail("Connection status text '%s' doesn't match expected 'Offline'" % connection_text)

View File

@ -232,9 +232,8 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
# When the placeholder is visible, the offline status bar does not appear # When the placeholder is visible, the offline status bar does not appear
wallet_view = home_view.wallet_button.click() wallet_view = home_view.wallet_button.click()
wallet_view.home_button.click() wallet_view.home_button.click()
home_view.toggle_airplane_mode()
sign_in.toggle_airplane_mode() home_view.accept_agreements()
sign_in.accept_agreements()
home_view = sign_in.sign_in() home_view = sign_in.sign_in()
chat = home_view.add_contact(transaction_senders['C']['public_key']) chat = home_view.add_contact(transaction_senders['C']['public_key'])

View File

@ -583,10 +583,14 @@ class BaseView(object):
airplane_toggle.wait_for_visibility_of_element() airplane_toggle.wait_for_visibility_of_element()
airplane_toggle.click() airplane_toggle.click()
# opening Status app # opening Status app
self.driver.start_activity(app_package='im.status.ethereum', app_activity='.MainActivity') app_package, app_activity = 'im.status.ethereum', '.MainActivity'
if pytest.config.getoption('pr_number'):
app_package, app_activity = 'im.status.ethereum.pr', 'im.status.ethereum.MainActivity'
self.driver.start_activity(app_package=app_package, app_activity=app_activity)
def open_universal_web_link(self, deep_link): def open_universal_web_link(self, deep_link):
start_web_browser(self.driver) start_web_browser(self.driver)
self.send_as_keyevent(deep_link) self.send_as_keyevent(deep_link)
self.confirm() self.confirm()
self.open_in_status_button.click() self.open_in_status_button.click()