提交 f2946578 创建 作者: Greyson Parrelli's avatar Greyson Parrelli

Add comments, break up CI into two stages.

上级 ca0b8bcd
image: openjdk:8-jdk image: openjdk:8-jdk
variables: variables:
ANDROID_TARGET_SDK: "25" ANDROID_COMPILE_SDK: "25"
ANDROID_BUILD_TOOLS: "24.0.0" ANDROID_BUILD_TOOLS: "24.0.0"
ANDROID_SDK_TOOLS: "24.4.1" ANDROID_SDK_TOOLS: "24.4.1"
...@@ -10,7 +10,7 @@ before_script: ...@@ -10,7 +10,7 @@ before_script:
- apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1 - apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1
- wget --quiet --output-document=android-sdk.tgz https://dl.google.com/android/android-sdk_r${ANDROID_SDK_TOOLS}-linux.tgz - wget --quiet --output-document=android-sdk.tgz https://dl.google.com/android/android-sdk_r${ANDROID_SDK_TOOLS}-linux.tgz
- tar --extract --gzip --file=android-sdk.tgz - tar --extract --gzip --file=android-sdk.tgz
- echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter android-${ANDROID_TARGET_SDK} - echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter android-${ANDROID_COMPILE_SDK}
- echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter platform-tools - echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter platform-tools
- echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter build-tools-${ANDROID_BUILD_TOOLS} - echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter build-tools-${ANDROID_BUILD_TOOLS}
- echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter extra-android-m2repository - echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter extra-android-m2repository
...@@ -21,10 +21,11 @@ before_script: ...@@ -21,10 +21,11 @@ before_script:
- chmod +x ./gradlew - chmod +x ./gradlew
stages: stages:
- build
- test - test
build: build:
stage: test stage: build
script: script:
- ./gradlew assembleDebug - ./gradlew assembleDebug
artifacts: artifacts:
...@@ -41,9 +42,12 @@ functionalTests: ...@@ -41,9 +42,12 @@ functionalTests:
script: script:
- wget --quiet --output-document=android-wait-for-emulator https://raw.githubusercontent.com/travis-ci/travis-cookbooks/0f497eb71291b52a703143c5cd63a217c8766dc9/community-cookbooks/android-sdk/files/default/android-wait-for-emulator - wget --quiet --output-document=android-wait-for-emulator https://raw.githubusercontent.com/travis-ci/travis-cookbooks/0f497eb71291b52a703143c5cd63a217c8766dc9/community-cookbooks/android-sdk/files/default/android-wait-for-emulator
- chmod +x android-wait-for-emulator - chmod +x android-wait-for-emulator
- echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter sys-img-x86-google_apis-${ANDROID_TARGET_SDK} - echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter sys-img-x86-google_apis-${ANDROID_COMPILE_SDK}
- echo no | android-sdk-linux/tools/android create avd -n test -t android-${ANDROID_TARGET_SDK} --abi google_apis/x86 - echo no | android-sdk-linux/tools/android create avd -n test -t android-${ANDROID_COMPILE_SDK} --abi google_apis/x86
- android-sdk-linux/tools/emulator64-x86 -avd test -no-window -no-audio & - android-sdk-linux/tools/emulator64-x86 -avd test -no-window -no-audio &
- ./android-wait-for-emulator - ./android-wait-for-emulator
- adb shell input keyevent 82 - adb shell input keyevent 82
- ./gradlew cAT - ./gradlew cAT
\ No newline at end of file artifacts:
paths:
- app/build/reports/androidTests/
\ No newline at end of file
...@@ -16,9 +16,9 @@ import static android.support.test.espresso.matcher.ViewMatchers.withId; ...@@ -16,9 +16,9 @@ import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText; import static android.support.test.espresso.matcher.ViewMatchers.withText;
/** /**
* Instrumentation test, which will execute on an Android device. * Tests the adding flow in the app.
* *
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a> * @author Greyson Parrelli (keybase.io/greyson)
*/ */
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public class AddingTest extends TestBase { public class AddingTest extends TestBase {
......
...@@ -18,6 +18,7 @@ public abstract class TestBase { ...@@ -18,6 +18,7 @@ public abstract class TestBase {
@Before @Before
public void setup() { public void setup() {
// Unlock the screen if it's locked
UiDevice device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()); UiDevice device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
try { try {
device.wakeUp(); device.wakeUp();
...@@ -25,6 +26,7 @@ public abstract class TestBase { ...@@ -25,6 +26,7 @@ public abstract class TestBase {
e.printStackTrace(); e.printStackTrace();
} }
// Set the flags on our activity so it'll appear regardless of lock screen state
final Activity activity = getActivityRule().getActivity(); final Activity activity = getActivityRule().getActivity();
Runnable wakeUpDevice = new Runnable() { Runnable wakeUpDevice = new Runnable() {
public void run() { public void run() {
......
...@@ -6,7 +6,7 @@ import org.junit.Test; ...@@ -6,7 +6,7 @@ import org.junit.Test;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
/** /**
* Adds numbers together. * Tests the {@link Adder} class.
* *
* @author Greyson Parrelli (keybase.io/greyson) * @author Greyson Parrelli (keybase.io/greyson)
*/ */
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论