Skip to content

Commit 828ceb0

Browse files
author
Josh Deffibaugh
committed
Merge branch 'beta'
2 parents 7882f3e + c5eb882 commit 828ceb0

File tree

5 files changed

+48
-16
lines changed

5 files changed

+48
-16
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ before_script:
2323
- adb shell input keyevent 82 &
2424
script:
2525
- ./gradlew testAllModules
26-
- if [[ ( "$TRAVIS_BRANCH" == "beta" || "$TRAVIS_BRANCH" == "master" ) && ( -z "$TRAVIS_TAG") ]]; then ./gradlew ship; fi
26+
- if [[ ( "$TRAVIS_BRANCH" == "beta" || "$TRAVIS_BRANCH" == "master" ) && ( -n "$TRAVIS_TAG") ]]; then ./gradlew ship; fi

README.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# optimizely-ab-android-sdk
22
Master<br/>
3-
[![Master Status](https://travis-ci.com/optimizely/android-sdk.svg?token=gwpzBrYRAoACxHs4ThQT&branch=master)](https://travis-ci.com/optimizely/android-sdk)
3+
[![Master Status](https://travis-ci.org/optimizely/android-sdk.svg?branch=master)](https://travis-ci.org/optimizely/android-sdk)
44
<br/>
55
Beta<br/>
6-
[![Beta Status](https://travis-ci.com/optimizely/android-sdk.svg?token=gwpzBrYRAoACxHs4ThQT&branch=beta)](https://travis-ci.com/optimizely/android-sdk)
6+
[![Beta Status](https://travis-ci.org/optimizely/android-sdk.svg?branch=beta)](https://travis-ci.org/optimizely/android-sdk)
77
<br/>
88
Devel<br/>
9-
[![Devel Status](https://travis-ci.com/optimizely/android-sdk.svg?token=gwpzBrYRAoACxHs4ThQT&branch=devel)](https://travis-ci.com/optimizely/android-sdk)
9+
[![Devel Status](https://travis-ci.org/optimizely/android-sdk.svg?branch=devel)](https://travis-ci.org/optimizely/android-sdk)
1010
<br/>
1111
<br/>
1212
[![Apache 2.0](https://img.shields.io/github/license/nebula-plugins/gradle-extra-configurations-plugin.svg)](http://www.apache.org/licenses/LICENSE-2.0)
@@ -16,6 +16,8 @@ Our Optimizely X Android solution allows you to easily run experiments anywhere
1616

1717
To find out more check out the [documentation](https://developers.optimizely.com/x/solutions/sdks/introduction/index.html?language=android&platform=mobile).
1818

19+
This repo depends on [Optimizely X Java](https://github.com/optimizely/java-sdk).
20+
1921
## Architecture
2022

2123
This project has 5 modules. Each module has source in `<module>/src/main/java`
@@ -78,13 +80,18 @@ Tests can be run by right clicking the file in the project pane or by clicking t
7880

7981
## Releasing
8082

81-
The default branch is devel. Feature branch PRs are automatically made against it. When PRs are reviewed and pass checks they should be squashed and merged into devel. The version of the SDK in devel should always be the version of the next release plus `-SNAPSHOT`.
83+
The default branch is devel. Feature branch PRs are automatically made against it. When PRs are reviewed and pass checks they should be squashed and merged into devel. Devel will be built and tested for each commit.
8284

83-
If a beta, or snapshot, build needs to be published simply checkout beta and merge devel. The beta branch should fast forward. Push devel and Travis will start. If the tests pass the build will be sent to our Maven repos on Bintray.
85+
Versions are managed via git tags. Tags can be created from the command line or from the Github UI.
8486

85-
When a release version needs to be published checkout the master branch and merge devel. The master branch should be fast forwarded. Remove the `-SNAPSHOT` from the version in `build.gradle` and commit directly onto master. Push master and if the tests pass Travis will publish the version to our Maven repos on Bintray. if the version already exists on Bintray the upload will be rejected. The commit that updates the version should also be tagged with the version number.
87+
Snapshot builds are made off of the beta branch. Travis will test all commits to this branch. When commit is tagged and pushed travis will build, test, *and*, ship the build bintray. The version name used
88+
is the name of the tag. For snapshot builds the version should have `-SNAPSHOT` appended. For example `0.1.2-SNAPSHOT`. Multiple builds with the same version can be pushed to Bintray when using snapshot versions.
89+
This keeps the version number from increasing too quickly for beta builds. Grade and maven ensure that users are on the latest snapshot via timestamps.
90+
There can be only one git tag per version name so snapshot tags may need to be moved. For example `git tag -f -a 0.1.2` and `git push -f --tags`.
8691

87-
Once the next release has been published from the master branch the snapshot version in devel should be bumped to the next targeted version.
92+
Release builds are made off of the master branch. Travis will test all commits to this branch. Just like the beta branch, pushing a tag will trigger a build, tests, and release of the version of the tag to Bintray.
93+
For example, to release version 0.1.2 you need to pull devel, checkout master, pull master, fast-forward master to devel, push master, then release 0.1.2 on Github, which creates a tag. You could also run
94+
`git tag -a 0.1.2 -m 'Version 0.1.2`. The argument to `-a` is the actual version name used on Bintray so it must be exact. Then run `git push --tags` to trigger Travis.
8895

8996
*Note:* only Optimizely employees can push to master, beta, and devel branches.
9097

build.gradle

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,17 @@
1717
// Top-level build file where you can add configuration options common to all sub-projects/modules.
1818

1919
buildscript {
20-
def bintrayUser = System.getenv('BINTRAY_USER')
21-
def bintrayApiKey = System.getenv('BINTRAY_API_KEY')
22-
if (bintrayUser != null && bintrayApiKey != null) {
23-
rootProject.ext.bintray_user = bintrayUser
24-
rootProject.ext.bintray_api_key = bintrayApiKey
20+
def bintray_user = System.getenv('BINTRAY_USER')
21+
def bintray_api_key = System.getenv('BINTRAY_API_KEY')
22+
def version_name = System.getenv('TRAVIS_TAG')
23+
if (bintray_user != null && bintray_api_key != null && version_name != null) {
24+
rootProject.ext.bintray_user = bintray_user
25+
rootProject.ext.bintray_api_key = bintray_api_key
26+
rootProject.ext.version_name = version_name
2527
} else {
2628
rootProject.ext.bintray_user = ''
2729
rootProject.ext.bintray_api_key = ''
30+
rootProject.ext.version_name= ''
2831
}
2932
repositories {
3033
jcenter()
@@ -80,5 +83,4 @@ task testAllModules << {
8083

8184
testAllModules.dependsOn(':android-sdk:connectedAndroidTest', ':android-sdk:test',
8285
':event-handler:connectedAndroidTest', ':event-handler:test',
83-
':user-experiment-record:connectedAndroidTest', ':shared:connectedAndroidTest',
84-
':test-app:connectedAndroidTest')
86+
':user-experiment-record:connectedAndroidTest', ':shared:connectedAndroidTest')

test-app/src/androidTest/java/com/optimizely/ab/android/test_app/MainActivityEspressoTest.java

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import android.support.test.rule.ActivityTestRule;
2626
import android.support.test.runner.AndroidJUnit4;
2727
import android.util.Pair;
28+
import android.view.WindowManager;
2829

2930
import com.optimizely.ab.android.event_handler.EventIntentService;
3031
import com.optimizely.ab.android.sdk.DataFileService;
@@ -122,7 +123,26 @@ protected void after() {
122123
CountingIdlingResourceManager.clearEvents();
123124
}
124125
})
125-
.around(activityTestRule);
126+
.around(activityTestRule)
127+
.around(new ExternalResource() {
128+
@Override
129+
protected void before() throws Throwable {
130+
super.before();
131+
Runnable wakeUpDevice = new Runnable() {
132+
public void run() {
133+
activityTestRule.getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON |
134+
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED |
135+
WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
136+
}
137+
};
138+
activityTestRule.getActivity().runOnUiThread(wakeUpDevice);
139+
}
140+
141+
@Override
142+
protected void after() {
143+
super.after();
144+
}
145+
});
126146

127147
@Test
128148
public void experimentActivationForWhitelistUser() throws InterruptedException {

test-app/src/main/AndroidManifest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
<manifest package="com.optimizely.ab.android.test_app"
33
xmlns:android="http://schemas.android.com/apk/res/android">
44

5+
<uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>
6+
<uses-permission android:name="android.permission.WAKE_LOCK"/>
7+
58
<application
69
android:name=".MyApplication"
710
android:allowBackup="false"

0 commit comments

Comments
 (0)