Skip to content

Commit

Permalink
Improve build performance (#298)
Browse files Browse the repository at this point in the history
* Test debug build only and reduce output

* Gradle 3.3 and android-maven plugin 1.5

* Adds --configure-on-demand option to circle.yml

* Adds -PdisablePreDex option to circle.yml

* Build and test modules in parallel

* Deploy sample apps to AWS on release build only

* Publish docs on release build only

* Install core lib to local .m2 repo before resolving dependencies

* Copy test results into archive folder

* Disable Javadoc tasks

* Build sample app but do not deploy to s3. Archive APKs on Circle CI.

* Update gradle options to limit memory use and dump heap on OOM error

* Relative path for artifacts folder

* Circle CI syntax for "artifacts"

* Test deployment on non-master branch

* Revert full build including sample apps to master only
  • Loading branch information
ecgreb authored Feb 10, 2017
1 parent 2db52f9 commit 7ca6f4f
Show file tree
Hide file tree
Showing 11 changed files with 59 additions and 57 deletions.
17 changes: 17 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,23 @@ allprojects {
}
}

subprojects {
task verify(dependsOn: ['compileDebugSources',
'testDebugUnitTest',
'checkstyle',
'lint'])

tasks.withType(Test) {
testLogging {
exceptionFormat "full"
events "skipped", "passed", "failed"
showStandardStreams true
}
}

tasks.withType(Javadoc).all { enabled = false }
}

task clean(type: Delete) {
delete rootProject.buildDir
}
Expand Down
25 changes: 18 additions & 7 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
general:
artifacts:
- "samples/mapzen-android-sdk-sample/build/outputs/apk"
- "samples/mapzen-places-api-sample/build/outputs/apk"

machine:
java:
version: oraclejdk8
python:
version: 2.7.10
environment:
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"'
TEST_FLAGS: "--configure-on-demand -PdisablePreDex"

checkout:
post:
Expand All @@ -14,20 +22,23 @@ dependencies:
- echo y | android update sdk --all --no-ui --force --filter "build-tools-25.0.2"
- echo y | android update sdk --all --no-ui --force --filter "android-25"
- echo y | android update sdk --all --no-ui --force --filter "extra-android-m2repository"
- sudo apt-get update; sudo apt-get install s3cmd
- printf "[default]\naccess_key = $S3_ACCESS_KEY\n secret_key = $S3_SECRET_KEY" > ~/.s3cfg
- ./gradlew :core:install

test:
override:
- ./gradlew clean :core:install :core:verify :mapzen-android-sdk:verify :mapzen-places-api:verify
- case $CIRCLE_NODE_INDEX in 0) ./gradlew :core:verify $TEST_FLAGS ;; 1) ./gradlew :mapzen-android-sdk:verify $TEST_FLAGS ;; 2) ./gradlew :mapzen-places-api:verify $TEST_FLAGS ;; esac:
parallel: true
post:
- mkdir -p $CIRCLE_TEST_REPORTS/junit/
- find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} $CIRCLE_TEST_REPORTS/junit/ \;

deployment:
master:
branch: master
commands:
- ./gradlew :samples_mapzen-android-sdk-sample:assembleDebug -PmapzenApiKey=$MAPZEN_API_KEY
- ./gradlew :samples_mapzen-place-api-sample:assembleDebug -PmapzenApiKey=$MAPZEN_API_KEY
- ./gradlew uploadArchives -PsonatypeUsername=$SONATYPE_NEXUS_SNAPSHOTS_USERNAME -PsonatypePassword=$SONATYPE_NEXUS_SNAPSHOTS_PASSWORD
- scripts/deploy-android-sdk-sample-app.sh
- scripts/deploy-places-api-sample-app.sh
- ./gradlew aarSize countReleaseDexMethods permissions mapzen-android-sdk:dependencies --configuration compile
- pip install 'Circle-Tickler == 1.0.1'
- tickle-circle mapzen documentation master $CIRCLE_TOKEN
- scripts/deploy-samples.sh
- scripts/publish-docs.sh
15 changes: 1 addition & 14 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
}
}
dependencies {
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath 'net.researchgate:gradle-release:2.4.0'
}
}
Expand Down Expand Up @@ -60,14 +60,6 @@ android {
}
}

tasks.withType(Test) {
testLogging {
exceptionFormat "full"
events "started", "skipped", "passed", "failed"
showStandardStreams true
}
}

task checkstyle(type: Checkstyle) {
configFile file("${project.rootDir}/config/checkstyle/checkstyle.xml")
source 'src'
Expand All @@ -77,11 +69,6 @@ task checkstyle(type: Checkstyle) {
classpath = files()
}

task verify(dependsOn: ['compileDebugSources',
'test',
'checkstyle',
'lint'])

apply from: rootProject.file('gradle/gradle-mvn-push.gradle')

task submodules {
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
15 changes: 1 addition & 14 deletions mapzen-android-sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
}
}
dependencies {
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath 'net.researchgate:gradle-release:2.4.0'
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.6.1'
}
Expand Down Expand Up @@ -58,14 +58,6 @@ android {
}
}

tasks.withType(Test) {
testLogging {
exceptionFormat "full"
events "started", "skipped", "passed", "failed"
showStandardStreams true
}
}

task checkstyle(type: Checkstyle) {
configFile file("${project.rootDir}/config/checkstyle/checkstyle.xml")
source 'src'
Expand All @@ -75,11 +67,6 @@ task checkstyle(type: Checkstyle) {
classpath = files()
}

task verify(dependsOn: ['compileDebugSources',
'test',
'checkstyle',
'lint'])

dependencies {
compile 'com.mapzen:mapzen-core:1.3.0-SNAPSHOT'
compile ('com.mapzen:on-the-road:1.2.0-SNAPSHOT') {
Expand Down
15 changes: 1 addition & 14 deletions mapzen-places-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
}
}
dependencies {
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath 'net.researchgate:gradle-release:2.4.0'
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.6.1'
}
Expand Down Expand Up @@ -55,14 +55,6 @@ android {
}
}

tasks.withType(Test) {
testLogging {
exceptionFormat "full"
events "started", "skipped", "passed", "failed"
showStandardStreams true
}
}

task checkstyle(type: Checkstyle) {
configFile file("${project.rootDir}/config/checkstyle/checkstyle.xml")
source 'src'
Expand All @@ -72,11 +64,6 @@ task checkstyle(type: Checkstyle) {
classpath = files()
}

task verify(dependsOn: ['compileDebugSources',
'test',
'checkstyle',
'lint'])

dependencies {
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.mapzen:mapzen-core:1.3.0-SNAPSHOT'
Expand Down
5 changes: 0 additions & 5 deletions samples/mapzen-android-sdk-sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@ task checkstyle(type: Checkstyle) {
classpath = files()
}

task verify(dependsOn: ['compileDebugSources',
'test',
'checkstyle',
'lint'])

dependencies {
compile(project(':mapzen-android-sdk')) {
transitive = true;
Expand Down
1 change: 0 additions & 1 deletion scripts/deploy-android-sdk-sample-app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
#
# Builds mapzen android sdk sample app and uploads APK to s3://android.mapzen.com/mapzen-android-sdk-sample-snapshots/.

./gradlew assembleDebug -PmapzenApiKey=$MAPZEN_API_KEY
s3cmd put samples/mapzen-android-sdk-sample/build/outputs/apk/samples_mapzen-android-sdk-sample-debug.apk s3://android.mapzen.com/mapzen-android-sdk-sample-latest.apk
s3cmd put samples/mapzen-android-sdk-sample/build/outputs/apk/samples_mapzen-android-sdk-sample-debug.apk s3://android.mapzen.com/mapzen-android-sdk-sample-snapshots/mapzen-android-sdk-sample-$CIRCLE_BUILD_NUM.apk
1 change: 0 additions & 1 deletion scripts/deploy-places-api-sample-app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
#
# Builds mapzen places api sample app and uploads APK to s3://android.mapzen.com/mapzen-places-api-sample-snapshots/.

./gradlew assembleDebug -PmapzenApiKey=$MAPZEN_API_KEY
s3cmd put samples/mapzen-places-api-sample/build/outputs/apk/samples_mapzen-places-api-sample-debug.apk s3://android.mapzen.com/mapzen-places-api-sample-latest.apk
s3cmd put samples/mapzen-places-api-sample/build/outputs/apk/samples_mapzen-places-api-sample-debug.apk s3://android.mapzen.com/places-api-sample-snapshots/mapzen-places-api-sample-$CIRCLE_BUILD_NUM.apk
11 changes: 11 additions & 0 deletions scripts/deploy-samples.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
#
# Builds and uploads sample apps to S3 on release build only.

if [[ ${PERFORM_RELEASE} ]]
then
sudo apt-get update; sudo apt-get install s3cmd
printf "[default]\naccess_key = $S3_ACCESS_KEY\n secret_key = $S3_SECRET_KEY" > ~/.s3cfg
scripts/deploy-android-sdk-sample-app.sh
scripts/deploy-places-api-sample-app.sh
fi
9 changes: 9 additions & 0 deletions scripts/publish-docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
#
# Triggers mapzen docs build to publish to https://mapzen.com/documentation/.

if [[ ${PERFORM_RELEASE} ]]
then
pip install 'Circle-Tickler == 1.0.1'
tickle-circle mapzen documentation master $CIRCLE_TOKEN
fi

0 comments on commit 7ca6f4f

Please sign in to comment.