Skip to content

Commit cb8c2f3

Browse files
committed
Set up gradle build for CircleCI
1 parent ef833aa commit cb8c2f3

10 files changed

Lines changed: 351 additions & 102 deletions

File tree

.gitignore

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Created by .ignore support plugin (hsz.mobi)
2+
### Java template
3+
*.class
4+
5+
# Package Files #
6+
*.jar
7+
8+
### Maven template
9+
target/
10+
pom.xml.tag
11+
pom.xml.releaseBackup
12+
pom.xml.versionsBackup
13+
pom.xml.next
14+
release.properties
15+
dependency-reduced-pom.xml
16+
buildNumber.properties
17+
.mvn/timing.properties
18+
19+
### JetBrains template
20+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio
21+
22+
*.iml
23+
24+
## Directory-based project format:
25+
.idea/
26+
27+
28+
### Gradle template
29+
.gradle
30+
build/
31+
32+
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
33+
!gradle-wrapper.jar
34+

README.md

Lines changed: 28 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,65 +4,48 @@ Codecov Java Example
44
| [https://codecov.io][1] | [@codecov][2] | [hello@codecov.io][3] |
55
| ----------------------- | ------------- | --------------------- |
66

7-
This repository serves as an **example** on how to use [Codecov Global][4] for Java.
7+
This repository serves as an **example** on how to use [Codecov Global][4] for Java with a [Gradle][5] build script.
88

99
## Usage
1010

1111

1212
### Add Jacoco plugin
13-
```xml
14-
<plugin>
15-
<groupId>org.jacoco</groupId>
16-
<artifactId>jacoco-maven-plugin</artifactId>
17-
<version>0.7.5.201505241946</version>
18-
<executions>
19-
<execution>
20-
<goals>
21-
<goal>prepare-agent</goal>
22-
</goals>
23-
</execution>
24-
<execution>
25-
<id>report</id>
26-
<phase>test</phase>
27-
<goals>
28-
<goal>report</goal>
29-
</goals>
30-
</execution>
31-
</executions>
32-
</plugin>
13+
Gradle ships with a [JaCoCo plugin][6]. Just add it to your `build.gradle`.
14+
```groovy
15+
apply plugin: 'jacoco'
3316
```
34-
> For the [newest version check here](http://www.eclemma.org/jacoco/)
3517

18+
And enable the `jacoco` XML report.
19+
```groovy
20+
jacocoTestReport {
21+
reports {
22+
xml.enabled true
23+
}
24+
}
25+
```
3626

37-
# Travis CI
27+
# Circle CI
3828

39-
Add to your `.travis.yml` file.
29+
Add to your `circle.yml` file.
4030
```yml
41-
language:
42-
java
43-
44-
before_script:
45-
- pip install --user codecov
46-
47-
after_success:
48-
- codecov
31+
test:
32+
post:
33+
- if [ -e ./gradlew ]; then ./gradlew jacocoTestReport;else gradle jacocoTestReport;fi
34+
- pip install --user codecov && codecov
4935
```
5036
51-
> Another option is our [Bash uploader](https://github.com/codecov/codecov-bash)
37+
> Another option is our [Bash uploader][7]
5238
5339
## Private Repos
5440
5541
Add to your `.travis.yml` file.
5642
```yml
57-
env:
58-
global:
59-
- CODECOV_TOKEN=:uuid-repo-token
60-
61-
before_script:
62-
- pip install --user codecov
63-
64-
after_success:
65-
- codecov
43+
test:
44+
post:
45+
- if [ -e ./gradlew ]; then ./gradlew jacocoTestReport;else gradle jacocoTestReport;fi
46+
- pip install --user codecov && codecov:
47+
environment:
48+
CODECOV_TOKEN: uuid-repo-token
6649
```
6750

6851
View source and learn more about [Codecov Global Uploader][4]
@@ -71,3 +54,6 @@ View source and learn more about [Codecov Global Uploader][4]
7154
[2]: https://twitter.com/codecov
7255
[3]: mailto:hello@codecov.io
7356
[4]: https://github.com/codecov/codecov-python
57+
[5]: http://gradle.org/
58+
[6]: https://docs.gradle.org/current/userguide/jacoco_plugin.html
59+
[7]: https://github.com/codecov/codecov-bash

build.gradle

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
group 'org.jacoco'
2+
version '1.0-SNAPSHOT'
3+
4+
apply plugin: 'java'
5+
apply plugin: 'jacoco'
6+
7+
sourceCompatibility = 1.7
8+
targetCompatibility = 1.7
9+
10+
repositories {
11+
mavenCentral()
12+
}
13+
14+
dependencies {
15+
testCompile group: 'junit', name: 'junit', version: '4.11'
16+
}
17+
18+
jacocoTestReport {
19+
reports {
20+
xml.enabled true
21+
html.enabled false
22+
}
23+
}

circle.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
test:
2+
post:
3+
- if [ -e ./gradlew ]; then ./gradlew jacocoTestReport;else gradle jacocoTestReport;fi
4+
- pip install --user codecov && codecov

gradle/wrapper/gradle-wrapper.jar

51 KB
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Fri Mar 04 11:32:27 CST 2016
2+
distributionBase=GRADLE_USER_HOME
3+
distributionPath=wrapper/dists
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-2.5-bin.zip

gradlew

Lines changed: 164 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)