Skip to content

Commit 1a671b9

Browse files
authored
Badges, coveralls, docs (#4)
* add travis badge * add coverage badge * maven badges * maven badges * badges, coveralls plugin * coveralls in travis * travis tweaks * travis tweaks * only run reportScoverage task * update readme * show logging streams in testScoverage task * skip travis install step * update readme * update readme
1 parent ed4edae commit 1a671b9

File tree

6 files changed

+90
-24
lines changed

6 files changed

+90
-24
lines changed

.travis.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ jdk:
66
services:
77
- docker
88

9+
# skip the install step, we don't want to compile code again in this step
10+
# the default is gradle assemble task. ideally we probably want to just download
11+
# all dependencies in this step
12+
install: true
13+
14+
# see https://docs.travis-ci.com/user/languages/java/#caching
915
before_cache:
1016
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
1117
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
@@ -17,5 +23,7 @@ cache:
1723

1824
script:
1925
- docker-compose up -d
20-
- ./gradlew clean test checkScoverage
21-
- docker-compose down
26+
- ./gradlew -PallScalaVersions reportScoverage checkScoverage
27+
28+
after_success:
29+
- ./gradlew coveralls

README.md

Lines changed: 49 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# warp-core
22

3+
[![Build Status](https://travis-ci.org/Workday/warp-core.svg?branch=master)](https://travis-ci.org/Workday/warp-core)
4+
[![Coverage Status](https://coveralls.io/repos/github/Workday/warp-core/badge.svg?branch=master)](https://coveralls.io/github/Workday/warp-core?branch=master)
5+
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.workday.warp/warp-core_2.11/badge.svg?subject=scala+2.11)](https://maven-badges.herokuapp.com/maven-central/com.workday.warp/warp-core_2.11)
6+
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.workday.warp/warp-core_2.12/badge.svg?subject=scala+2.12)](https://maven-badges.herokuapp.com/maven-central/com.workday.warp/warp-core_2.12)
7+
38
WARP (Workday Automated Regression Platform) is a flexible, lightweight, (mostly) functional Scala framework for collecting performance metrics and conducting sound experimental benchmarking.
49

510
WARP features a domain specific language for describing experimental designs (conducting repeated trials for different experimental groups). Our library allows users to wrap existing tests with layers of measurement collectors that write performance metrics to a relational database. We also allow users to create arbiters to express custom failure criteria and performance requirements. One arbiter included out of the box is the RobustPcaArbiter, which uses machine learning to detect when a test is deviating from expected behavior and signal an alert.
@@ -21,13 +26,41 @@ or to just run unit tests, run the `unitTest` task.
2126

2227
All port values and service version numbers are in `.env`.
2328

29+
## Code Coverage Requirements
30+
31+
We use scoverage and coveralls gradle plugins to track code coverage. We enforce that high coverage should be maintained. At time of
32+
writing, coverage must be at least 92% for a build to pass. If you want to test coveralls out on your fork, sign in to coveralls
33+
and get your repo token. Then you can generate the coverage reports and submit them to coveralls using
34+
```
35+
$ export COVERALLS_REPO_TOKEN=abcdefg
36+
$ ./gradlew clean reportScoverage coveralls
37+
```
38+
2439

2540
## Publishing
2641
We use the `maven-publish` gradle plugin.
2742
https://docs.gradle.org/current/userguide/publishing_maven.html
2843

29-
Artifacts can be published to sonatype using `./gradlew publish`.
30-
You'll need to configure your sonatype and signing credentials as project properties:
44+
Please use the included `publish.sh` for uploading artifacts. This script handles some subtle interaction between
45+
creating repo tags and scala multiversion plugin.
46+
47+
Example usage:
48+
```
49+
./publish.sh snapshot minor local
50+
```
51+
52+
Will increment minor version component and publish a snapshot (eg 2.3.0-SNAPSHOT) to local maven repo.
53+
54+
To publish to sonatype, the invocation would be something like:
55+
```
56+
./publish.sh candidate minor sonatype
57+
```
58+
59+
To publish to sonatype, you'll need to configure your sonatype and signing credentials as project properties:
60+
61+
[create sonatype jira account](https://issues.sonatype.org/secure/Signup!default.jspa)
62+
63+
[create pgp keys](https://central.sonatype.org/pages/working-with-pgp-signatures.html)
3164
```
3265
signing.keyId=BEEF
3366
signing.password=abc123
@@ -36,7 +69,7 @@ signing.secretKeyRingFile=/full/path/to/secring.gpg
3669
sonatypeUsername=jean-luc.picard
3770
sonatypePassword=makeItSoNumberOne
3871
```
39-
Artifacts can be published to local maven repo using `./gradlew publishToMavenLocal`. Signing is not required for local publish.
72+
Signing is not required for a local publish.
4073

4174
## Scala Multiversion
4275
We use [gradle-scala-multiversion-plugin](https://github.com/ADTRAN/gradle-scala-multiversion-plugin)
@@ -45,6 +78,13 @@ The versions are defined in gradle.properties, however you can also override fro
4578
```
4679
$ ./gradlew -PscalaVersions=2.11.8,2.12.6 test
4780
```
81+
This plugin works by repeatedly invoking the gradle task graph with each different scala version specified.
82+
Without any version specified, gradle will use the defaultScalaVersion from gradle.properties. This means local IDE builds
83+
will use just one scala version. If you need to run with all configured scala versions, pass the project property `allScalaVersions`
84+
```
85+
$ ./gradlew -PallScalaVersions test
86+
```
87+
4888

4989
## Versioning
5090
We use the `nebula.release` plugin to determine versions.
@@ -60,22 +100,15 @@ git push origin --tags
60100
There are 4 types of releases we support:
61101
- final
62102
- candidate (rc)
63-
- devSnapshot includes some extra information in the version, including branch name and commit hash.
103+
- devSnapshot (includes some extra information in the version, including branch name and commit hash)
64104
- snapshot
65105

66-
Artifacts with type `snapshot` or `devSnapshot` are published to workday-unit repo,
67-
while `final` and `candidate` artifacts are published to workday-release.
106+
Artifacts with type `snapshot` or `devSnapshot` are published to sonatype snapshots repo,
107+
while `final` and `candidate` artifacts are published to sonatype releases repo.
68108

69-
By default, the minor version number will be incremented based on the most recent tagged release. If you instead need to
70-
increment the major or patch version, use the property `release.scope`:
71-
```
72-
./gradlew <snapshot|devSnapshot|candidate|final> -Prelease.scope=patch
73-
```
74-
75-
The version can also be overridden using the property `release.version` (please refrain from using this if possible):
76-
```
77-
./gradlew -Prelease.version=1.2.3 final
78-
```
109+
Please use the included `publish.sh` script for publishing, as that script handles interaction between creating repo tags
110+
and scala multiversion. We don't want to create multiple tags during a release process and incorrectly publish some artifacts
111+
under the wrong version.
79112

80113

81114
## Dependencies

build.gradle

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ allprojects {
1212
apply plugin: 'nebula.release'
1313
apply plugin: "nebula.maven-resolved-dependencies"
1414
apply plugin: "org.scoverage"
15+
apply plugin: "com.github.kt3k.coveralls"
1516
apply plugin: 'maven-publish'
1617
apply plugin: 'signing'
1718
}
@@ -33,6 +34,7 @@ buildscript {
3334
classpath "com.netflix.nebula:nebula-publishing-plugin:${versions.nebulaPublish}"
3435
classpath "org.ajoberstar:grgit:${versions.gradleGit}"
3536
classpath "org.github.ngbinh.scalastyle:gradle-scalastyle-plugin${project.scalaSuffix}:${versions.scalaStyle}"
37+
classpath "org.kt3k.gradle.plugin:coveralls-gradle-plugin:${versions.coveralls}"
3638
classpath "org.scoverage:gradle-scoverage:${versions.gradleScoverage}"
3739
}
3840
}
@@ -154,6 +156,16 @@ test {
154156
}
155157
}
156158

159+
testScoverage {
160+
minHeapSize = "500m"
161+
maxHeapSize = "8g"
162+
163+
testLogging {
164+
events 'started', 'passed'
165+
showStandardStreams = true
166+
}
167+
}
168+
157169
task deleteSchema(type: JavaExec, dependsOn: compileTestScala) {
158170
description = "deletes the db schema prior to running tests"
159171
main = "com.workday.warp.persistence.DropCoreSchema"
@@ -217,6 +229,10 @@ checkScoverage {
217229
minimumRate = 0.92
218230
}
219231

232+
coveralls {
233+
coberturaReportPath = "${buildDir}/reports/scoverage/cobertura.xml"
234+
}
235+
220236
/**
221237
* @return true iff we are building a maven snapshot or a devSnapshot.
222238
*/
@@ -274,6 +290,7 @@ publishing {
274290
}
275291

276292
signing {
293+
// only require signing for non-snapshot versions being published to maven central
277294
required {
278295
!isSnapshot(version.toString()) && gradle.taskGraph.hasTask("publish")
279296
}

gradle.properties

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
// scala cross compilation
1+
# scala cross compilation
2+
# by default, gradle invocations will use only this version. useful for ide invocations.
3+
defaultScalaVersions=2.12.6
4+
# if we need to cross-compile and rerun the entire task graph (like in a ci build or publish), run with -PallScalaVersions
5+
# see https://github.com/ADTRAN/gradle-scala-multiversion-plugin#examples
26
scalaVersions=2.11.8,2.12.6
37

4-
// during releases, we only want to create 1 repo tag.
5-
// note that devSnapshot and snapshot tasks won't create repo tags
6-
// see https://github.com/ADTRAN/gradle-scala-multiversion-plugin#advanced-configuration
8+
# during releases, we only want to create 1 repo tag.
9+
# note that devSnapshot and snapshot tasks won't create repo tags
10+
# see https://github.com/ADTRAN/gradle-scala-multiversion-plugin#advanced-configuration
711
runOnceTasks=clean,candidate,final,release

publish.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ set -e
55
# release type must be one of { devSnapshot, snapshot, candidate, final }
66
# release scope must be one of { major, minor, patch }
77
# repository must be one of { local, sonatype }
8+
#
9+
# example: ./publish.sh snapshot minor local
10+
# will increment minor version component and publish snapshots to local maven repository
811

912
if [[ $# -ne 3 ]]
1013
then
@@ -42,11 +45,11 @@ then
4245
echo "creating repo tag for $RELEASE_TYPE release"
4346
./gradlew -Prelease.scope=$RELEASE_SCOPE clean $RELEASE_TYPE
4447
echo "publishing $REPOSITORY artifacts for $RELEASE_SCOPE $RELEASE_TYPE release"
45-
./gradlew -Prelease.useLastTag=true $PUBLISH_TASK
48+
./gradlew -Prelease.useLastTag=true -PallScalaVersions $PUBLISH_TASK
4649
elif [[ $RELEASE_TYPE = 'devSnapshot' || $RELEASE_TYPE == 'snapshot' ]]
4750
then
4851
echo "publishing $REPOSITORY artifacts for $RELEASE_SCOPE $RELEASE_TYPE release. repo tag will not be created."
49-
./gradlew -Prelease.scope=$RELEASE_SCOPE clean $RELEASE_TYPE $PUBLISH_TASK
52+
./gradlew -Prelease.scope=$RELEASE_SCOPE -PallScalaVersions clean $RELEASE_TYPE $PUBLISH_TASK
5053
else
5154
echo "$RELEASE_TYPE is not a valid release type"
5255
exit 1

versionInfo.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ project.ext.versions = [
4444
, commonsConfiguration: '1.9'
4545
, commonsIo: '2.4'
4646
, commonsLang3: '3.4'
47+
, coveralls: '2.8.2'
4748
, dispatch: '0.13.0'
4849
, flyway: '5.1.1'
4950
, freemarker: '2.3.19'

0 commit comments

Comments
 (0)