Skip to content

Commit 6ddca65

Browse files
author
Cameron Mace
committed
initial ci integration
1 parent 74c7af3 commit 6ddca65

80 files changed

Lines changed: 1023 additions & 830 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
Mapbox welcomes participation and contributions from everyone.
44

5+
### v3.0.0
6+
7+
- Model and GeoJSON classes made immutable using AutoValue.
8+
- Directions API UUID added inside the `DirectionsResponse` model.
9+
- Position object removed in favor of GeoJSON `Point` for coordinate representation.
10+
- Support for direction `class` has been added.
11+
- Requesting `RoundaboutExit` is now possible and adds an additional instruction when traversing inside a roundabout or rotary.
12+
13+
14+
515
### v2.2.3
616

717
- Introduce setDebugLoggingEnabled API [#549](https://github.com/mapbox/mapbox-java/pull/549)

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
<a href="https://circleci.com/gh/mapbox/mapbox-java">
1414
<img src="https://circleci.com/gh/mapbox/mapbox-java.svg?style=shield&circle-token=:circle-token">
1515
</a>
16+
<a href="https://www.codacy.com/app/Mapbox/mapbox-java?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=mapbox/mapbox-java&amp;utm_campaign=Badge_Grade"><img src="https://api.codacy.com/project/badge/Grade/ca94241293664cdf86bd1848111955c5"/></a>
17+
1618
</p>
1719
<br>
1820

build.gradle

Lines changed: 62 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,82 @@
1+
apply plugin: 'com.github.kt3k.coveralls'
2+
apply plugin: 'findbugs'
3+
apply plugin: 'jacoco'
4+
15
buildscript {
6+
apply from: "${rootDir}/gradle/dependencies.gradle"
27

38
repositories {
4-
google()
9+
maven { url 'https://plugins.gradle.org/m2' }
10+
maven { url "https://maven.google.com" }
11+
mavenCentral()
512
jcenter()
613
}
14+
715
dependencies {
16+
17+
dependencies.create("com.puppycrawl.tools:checkstyle:${pluginVersion.checkstyle}") {
18+
transitive = false
19+
}
20+
21+
//nexus: "com.bmuschko:gradle-nexus-plugin:${pluginVersions.nexus}",
22+
classpath pluginDependencies.spotbugs
23+
classpath pluginDependencies.sonarqube
824
classpath 'com.android.tools.build:gradle:2.3.3'
25+
classpath "org.kt3k.gradle.plugin:coveralls-gradle-plugin:${pluginVersion.coveralls}"
26+
classpath "net.ltgt.gradle:gradle-errorprone-plugin:${pluginVersion.errorprone}"
927
}
1028
}
1129

12-
plugins {
13-
id 'com.gradle.build-scan' version '1.9'
30+
task testReport(type: TestReport, group: 'Build') {
31+
description = 'Generates an aggregate test report'
32+
destinationDir = file("${buildDir}/reports/allTests")
1433
}
1534

16-
buildScan {
17-
licenseAgreementUrl = 'https://gradle.com/terms-of-service'
18-
licenseAgree = 'yes'
35+
allprojects {
36+
repositories {
37+
maven { url 'https://plugins.gradle.org/m2' }
38+
maven { url "https://maven.google.com" }
39+
mavenCentral()
40+
jcenter()
41+
}
1942
}
2043

21-
allprojects {
44+
subprojects {
2245
apply from: "${rootDir}/gradle/dependencies.gradle"
2346
apply from: "${rootDir}/gradle/code-quality.gradle"
24-
repositories {
25-
google()
26-
jcenter()
47+
apply plugin: 'java'
48+
apply plugin: 'idea'
49+
apply plugin: 'net.ltgt.errorprone'
50+
51+
// Fixes issue with test resources not being found inside Intellij
52+
idea {
53+
module {
54+
testOutputDir = file('build/resources/test')
55+
}
56+
}
57+
58+
sonarqube {
59+
properties {
60+
property "sonar.java.binaries", "build/intermediates/classes/debug"
61+
property "sonar.jacoco.reportPath","build/outputs/code-coverage/connected/coverage.ec"
62+
}
63+
}
64+
65+
sourceCompatibility = "1.7"
66+
targetCompatibility = "1.7"
67+
68+
dependencies {
69+
70+
errorprone dependenciesList.errorprone
71+
72+
// Test Dependencies
73+
testCompile dependenciesList.junit
74+
testCompile dependenciesList.hamcrestJunit
2775
}
2876
}
2977

30-
task clean(type: Delete) {
31-
delete rootProject.buildDir
78+
task copyTestResources(type: Copy) {
79+
from "${projectDir}/src/test/resources"
80+
into "${buildDir}/classes/test"
3281
}
82+

circle.yml

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
version: 2
2+
3+
workflows:
4+
version: 2
5+
default:
6+
jobs:
7+
- build
8+
- release
9+
jobs:
10+
build:
11+
working_directory: ~/code
12+
docker:
13+
- image: mbgl/ci@sha256:c34e221294d81da80918d3e9a9df5de795b067e88f86d7c9a5e262763332536e
14+
environment:
15+
JVM_OPTS: -Xmx3200m
16+
BUILDTYPE: Debug
17+
IS_LOCAL_DEVELOPMENT: false
18+
steps:
19+
- checkout
20+
- restore_cache:
21+
key: jars-{{ checksum "mapbox/build.gradle" }}-{{ checksum "mapbox/app/build.gradle" }}
22+
- run:
23+
name: Accept Android license
24+
command: |
25+
echo y | $ANDROID_HOME/tools/bin/sdkmanager "build-tools;26.0.1"
26+
- run:
27+
name: Coveralls
28+
command: ./gradlew coveralls
29+
- run:
30+
name: Download Dependencies
31+
command: cd mapbox && ./gradlew androidDependencies
32+
- save_cache:
33+
paths:
34+
- ~/.gradle
35+
key: jars-{{ checksum "mapbox/build.gradle" }}-{{ checksum "mapbox/app/build.gradle" }}
36+
- run:
37+
name: Check Java code style
38+
command: make checkstyle
39+
- run:
40+
name: Run unit-test in Java libraries
41+
command: make test-java
42+
- run:
43+
name: Run unit-test in Android libraries
44+
command: make test-android
45+
- run:
46+
name: Build testapp APK
47+
command: |
48+
cd mapbox && ./gradlew accessToken
49+
./gradlew app:assembleDebug
50+
- run:
51+
name: Log in to Google Cloud Platform
52+
shell: /bin/bash -euo pipefail
53+
command: |
54+
echo "${GCLOUD_SERVICE_ACCOUNT_JSON}" > secret.json
55+
gcloud auth activate-service-account --key-file secret.json --project mapbox-java
56+
rm secret.json
57+
- run:
58+
name: Run instrumentation tests on Firebase
59+
no_output_timeout: 1200
60+
shell: /bin/bash -euo pipefail
61+
command: |
62+
gcloud firebase test android run --type robo --app mapbox/app/build/outputs/apk/app-debug.apk --device-ids shamu --os-version-ids 22 --locales en --orientations portrait --timeout 10m
63+
- run:
64+
name: Update Transifex
65+
command: |
66+
if [ "${CIRCLE_BRANCH}" == "${DEPLOY_BRANCH}" ]; then
67+
pip install transifex-client
68+
echo $'[https://www.transifex.com]\nhostname = https://www.transifex.com\nusername = '"${TRANSIFEX_USER}"$'\npassword = '"${TRANSIFEX_API_TOKEN}"$'\ntoken = '""$'\n' > ~/.transifexrc
69+
tx push -s
70+
else
71+
echo "Skipping push to Transifex"
72+
fi
73+
- store_artifacts:
74+
path: mapbox/app/build/reports
75+
destination: reports
76+
- store_test_results:
77+
path: mapbox/app/build/test-results
78+
79+
# ------------------------------------------------------------------------------
80+
release:
81+
branch:
82+
only:
83+
- master
84+
docker:
85+
- image: mbgl/ci@sha256:c34e221294d81da80918d3e9a9df5de795b067e88f86d7c9a5e262763332536e
86+
working_directory: ~/code
87+
environment:
88+
environment:
89+
BUILDTYPE: Release
90+
IS_LOCAL_DEVELOPMENT: false
91+
steps:
92+
- checkout
93+
- run:
94+
name: Accept Android license
95+
command: |
96+
echo y | $ANDROID_HOME/tools/bin/sdkmanager "build-tools;26.0.1"
97+
- run:
98+
name: Generate Maven credentials
99+
shell: /bin/bash -euo pipefail
100+
command: |
101+
aws s3 cp s3://mapbox/android/signing-credentials/secring.gpg secring.gpg
102+
echo "NEXUS_USERNAME=$PUBLISH_NEXUS_USERNAME
103+
NEXUS_PASSWORD=$PUBLISH_NEXUS_PASSWORD
104+
signing.keyId=$SIGNING_KEYID
105+
signing.password=$SIGNING_PASSWORD
106+
signing.secretKeyRingFile=../../secring.gpg" >> mapbox/gradle.properties
107+
- run:
108+
name: Build Java libraries
109+
command: make build-release-java
110+
- run:
111+
name: Build Android libraries
112+
command: make build-release-android
113+
- deploy:
114+
name: Publish Java Services To Maven Central
115+
command: |
116+
if [ "${CIRCLE_BRANCH}" == "master" ]; then
117+
make publish-java ;
118+
fi
119+
- deploy:
120+
name: Publish Android Services To Maven Central
121+
command: |
122+
if [ "${CIRCLE_BRANCH}" == "master" ]; then
123+
make publish-android ;
124+
fi
125+
- store_artifacts:
126+
path: mapbox/app/build/reports
127+
destination: reports

gradle.properties

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ org.gradle.jvmargs=-Xmx1536m
1414
# When configured, Gradle will run in incubating parallel mode.
1515
# This option should only be used with decoupled projects. More details, visit
1616
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17-
# org.gradle.parallel=true
18-
19-
org.gradle.parallel=true
17+
org.gradle.parallel=true
2018

2119

gradle/code-quality.gradle

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
1+
apply plugin: 'com.github.spotbugs'
2+
apply plugin: 'org.sonarqube'
3+
apply plugin: "com.github.kt3k.coveralls"
14
apply plugin: 'checkstyle'
5+
apply plugin: 'jacoco'
6+
apply plugin: 'java'
27
apply plugin: 'pmd'
38

9+
configurations {
10+
checkstyleConfig
11+
}
12+
13+
414
checkstyle {
515
configFile = rootProject.file('config/checkstyle/checkstyle.xml')
616
configProperties = [
@@ -11,6 +21,34 @@ checkstyle {
1121
showViolations = true
1222
}
1323

24+
25+
spotbugs {
26+
effort = 'max'
27+
excludeFilter = file("${rootDir}/config/findbugs/exclude.xml")
28+
}
29+
30+
pmd {
31+
ruleSets = ["basic", "braces"]
32+
toolVersion = pluginVersion.pmd
33+
}
34+
35+
36+
37+
jacocoTestReport {
38+
group = 'Coverage reports'
39+
description = 'Generates a test coverage report for a project'
40+
41+
reports {
42+
xml.enabled = true
43+
html.enabled = true
44+
}
45+
}
46+
47+
48+
49+
50+
51+
1452
pmd {
1553
ignoreFailures = true
1654
sourceSets = [sourceSets.main]
@@ -19,4 +57,41 @@ pmd {
1957
"basic",
2058
"braces"
2159
]
60+
}
61+
62+
jacoco {
63+
toolVersion = pluginVersion.jacoco
64+
}
65+
66+
67+
68+
69+
70+
tasks.withType(Checkstyle) {
71+
enabled = System.properties.containsKey('checkstyle')
72+
group = 'Checkstyle'
73+
reports {
74+
xml.enabled = false
75+
html.enabled = true
76+
}
77+
}
78+
79+
afterEvaluate {
80+
tasks.findAll { it.name.startsWith('findbugs') }.each {
81+
it.enabled = System.properties.containsKey('findbugs')
82+
it.group = 'FindBugs'
83+
it.reports {
84+
xml.enabled = false
85+
html.enabled = true
86+
}
87+
}
88+
}
89+
90+
tasks.withType(Pmd) {
91+
enabled = System.properties.containsKey('pmd')
92+
group = 'PMD'
93+
reports {
94+
xml.enabled = false
95+
html.enabled = true
96+
}
2297
}

0 commit comments

Comments
 (0)