Skip to content

Commit 45480f5

Browse files
authored
Merge pull request #870 from NativeScript/pete/travis-build-stages
Configure Build Stages for travis CI
2 parents 4e8483c + 0371c47 commit 45480f5

File tree

2 files changed

+61
-35
lines changed

2 files changed

+61
-35
lines changed

.travis.yml

Lines changed: 56 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,66 @@ env:
77
- EMULATOR_API_LEVEL=21
88
- ANDROID_ABI=armeabi-v7a
99
- EMULATOR_NAME=runtime-emu
10-
sudo: true
11-
language: android
12-
jdk:
13-
- oraclejdk8
14-
git:
15-
submodules: false
10+
11+
matrix:
12+
include:
13+
- stage: "Static Binding Generator Parser Tests"
14+
language: node_js
15+
node_js: "6"
16+
git:
17+
submodules: false
18+
script:
19+
- cd android-static-binding-generator
20+
- npm install && node run-tests
21+
- cd ..
22+
- stage: "Static Binding Generator Class Generator Tests"
23+
language: android
24+
jdk: oraclejdk8
25+
git:
26+
submodules: false
27+
script:
28+
- "android-static-binding-generator/project/staticbindinggenerator/gradlew test --project-dir android-static-binding-generator/project/staticbindinggenerator/"
29+
- stage: "Build and Tests"
30+
sudo: true
31+
language: android
32+
jdk: oraclejdk8
33+
android:
34+
components:
35+
- android-$EMULATOR_API_LEVEL
36+
- extra-android-support
37+
- extra-android-m2repository
38+
- cmake
39+
- sys-img-$ANDROID_ABI-android-$EMULATOR_API_LEVEL
40+
git:
41+
submodules: false
42+
script:
43+
# (master branch) build the runtime twice - optimized, and regular packages, skip on PRs
44+
# test-app/gradlew runtest will take care of building the runtime for its testing needs
45+
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then bash ./gradlew -PpreReleaseVersion=$PACKAGE_VERSION -PgitCommitVersion=$TRAVIS_COMMIT --stacktrace; fi'
46+
- echo no | android create avd --force -n $EMULATOR_NAME-$EMULATOR_API_LEVEL -t android-$EMULATOR_API_LEVEL --abi $ANDROID_ABI -c 12M
47+
- emulator -avd $EMULATOR_NAME-$EMULATOR_API_LEVEL -no-skin -no-audio -no-window &
48+
- android-wait-for-emulator
49+
- cd test-app
50+
- "./gradlew runtest --stacktrace"
51+
- adb -e logcat -d 300
52+
- cd ..
53+
before_install:
54+
- echo "y" | sdkmanager "cmake;3.6.4111459"
55+
- sed -i 's/[email protected]:/https:\/\/github.com\//' .gitmodules
56+
- git submodule update --init --recursive
57+
- wget https://dl.google.com/android/repository/android-ndk-$NDK_VERSION-linux-x86_64.zip
58+
- chmod +x android-ndk-$NDK_VERSION-linux-x86_64.zip
59+
- "unzip -q android-ndk-$NDK_VERSION-linux-x86_64.zip"
60+
- "rm -rf android-ndk-$NDK_VERSION-linux-x86_64.zip"
61+
- export ANDROID_NDK_HOME=`pwd`/android-ndk-$NDK_VERSION
62+
- export PATH=${PATH}:${ANDROID_NDK_HOME}
63+
1664
android:
1765
components:
1866
- platform-tools
1967
- tools
2068
- build-tools-26.0.1
2169
- android-26
22-
- android-$EMULATOR_API_LEVEL
23-
- extra-android-support
24-
- extra-android-m2repository
25-
- cmake
26-
- sys-img-$ANDROID_ABI-android-$EMULATOR_API_LEVEL
2770
licenses:
2871
- 'android-sdk-preview-license-52d11cd2'
2972
- 'android-sdk-license-.+'
@@ -34,28 +77,7 @@ cache:
3477
directories:
3578
- "$HOME/.gradle/caches/"
3679
- "$HOME/.gradle/wrapper/"
37-
before_install:
38-
- echo "y" | sdkmanager "cmake;3.6.4111459"
39-
- sed -i 's/[email protected]:/https:\/\/github.com\//' .gitmodules
40-
- git submodule update --init --recursive
41-
- wget https://dl.google.com/android/repository/android-ndk-$NDK_VERSION-linux-x86_64.zip
42-
- chmod +x android-ndk-$NDK_VERSION-linux-x86_64.zip
43-
- "unzip -q android-ndk-$NDK_VERSION-linux-x86_64.zip"
44-
- "rm -rf android-ndk-$NDK_VERSION-linux-x86_64.zip"
45-
- export ANDROID_NDK_HOME=`pwd`/android-ndk-$NDK_VERSION
46-
- export PATH=${PATH}:${ANDROID_NDK_HOME}
80+
4781
install:
4882
- nvm install $NODE_VERSION
49-
script:
50-
- "./gradlew -PpreReleaseVersion=$PACKAGE_VERSION -PgitCommitVersion=$TRAVIS_COMMIT --stacktrace"
51-
- echo no | android create avd --force -n $EMULATOR_NAME-$EMULATOR_API_LEVEL -t android-$EMULATOR_API_LEVEL --abi $ANDROID_ABI -c 12M
52-
- emulator -avd $EMULATOR_NAME-$EMULATOR_API_LEVEL -no-skin -no-audio -no-window &
53-
- android-wait-for-emulator
54-
- cd android-static-binding-generator
55-
- "npm install"
56-
- "node run-tests"
57-
- cd ..
58-
- "android-static-binding-generator/project/staticbindinggenerator/gradlew clean test --project-dir android-static-binding-generator/project/staticbindinggenerator/"
59-
- "cd test-app && ./gradlew runtest --stacktrace"
60-
- adb -e logcat -d 300
61-
- cd ..
83+

build.gradle

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def localMetadataGen = "../android-metadata-generator/dist/tns-android-metadata-
1818
def distDir = "$projectDir/dist"
1919
def pVersion = "no package version was provided by build.gradle build"
2020
def arVersion = "no commit sha was provided by build.gradle build"
21+
def generateRegularRuntimePackage = !project.hasProperty("skipUnoptimized");
2122

2223
task checkEnvironmentVariables {
2324
if ("$System.env.JAVA_HOME" == "" || "$System.env.JAVA_HOME" == "null") {
@@ -130,7 +131,10 @@ task getCommitVersion {
130131
task generateRuntime {
131132
doFirst {
132133
tasks.generateOptimizedRuntimeAar.execute();
133-
tasks.generateRuntimeAar.execute();
134+
135+
if (generateRegularRuntimePackage) {
136+
tasks.generateRuntimeAar.execute();
137+
}
134138
}
135139
}
136140

0 commit comments

Comments
 (0)