Skip to content

Commit 06880e6

Browse files
Merge pull request #20 from codecov/update-repo
fix: update repo with calculator app and GHA + CircleCI
2 parents d185350 + 8055050 commit 06880e6

File tree

17 files changed

+126
-419
lines changed

17 files changed

+126
-419
lines changed

.circleci/config.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
version: 2.1
2+
orbs:
3+
codecov: codecov/codecov@3
4+
5+
jobs:
6+
build:
7+
docker:
8+
- image: cimg/openjdk:18.0.2
9+
steps:
10+
- checkout
11+
- run:
12+
name: Install dependencies, run tests, and collect coverage
13+
command: gradle build
14+
- codecov/upload
15+
16+
workflow:
17+
version: 2.1
18+
build-test:
19+
jobs:
20+
- build

.github/dependabot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: maven
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
open-pull-requests-limit: 10

.github/workflows/ci.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Workflow for Codecov example-java-maven
2+
on: [push, pull_request]
3+
jobs:
4+
run:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- name: Checkout
8+
uses: actions/checkout@v2
9+
- name: Set up JDK 18
10+
uses: actions/setup-java@v1
11+
with:
12+
java-version: 18
13+
- name: Install dependencies, run tests, and collect coverage
14+
run: gradle build
15+
- name: Upload coverage to Codecov
16+
uses: codecov/codecov-action@v3

.gitignore

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,2 @@
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
1+
.gradle/
302
build/
31-
32-
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
33-
!gradle-wrapper.jar
34-

.travis.yml

Lines changed: 0 additions & 4 deletions
This file was deleted.

README.md

Lines changed: 8 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,18 @@
1-
# [Codecov](https://codecov.io) Gradle Example
2-
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcodecov%2Fexample-gradle.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fcodecov%2Fexample-gradle?ref=badge_shield)
1+
# [Codecov](https://codecov.io) Java Gradle Example
2+
[![codecov](https://codecov.io/github/codecov/example-java-gradle/branch/main/graph/badge.svg?token=jotejZaRVK)](https://app.codecov.io/github/codecov/example-java-gradle)
3+
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcodecov%2Fexample-java-gradle.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fcodecov%2Fexample-java-gradle?ref=badge_shield)
34

5+
This example repository shows how Codecov can be integrated with a simple java-gradle project. It uses **GitHub Actions** and **CircleCI** as CI/CD providers and **Jacoco** as the coverage provider.
46

5-
## Guide
6-
### Travis Setup
7-
8-
Add to your `.travis.yml` file.
9-
```yml
10-
language: java
11-
jdk:
12-
- oraclejdk8
13-
before_script:
14-
- chmod +x gradlew
15-
script:
16-
- ./gradlew check
17-
- ./gradlew codeCoverageReport
18-
after_success:
19-
- bash <(curl -s https://codecov.io/bash)
20-
```
21-
22-
### Produce Coverage Reports
23-
1. Add Jacoco Plugin to your `build.gradle`. [See here](https://github.com/codecov/example-gradle/blob/master/build.gradle#L5)
24-
2. Set Jacoco to export xml. [See here](https://github.com/codecov/example-gradle/blob/master/build.gradle#L18-L23)
25-
3. Execute your tests as normal
26-
4. Call `gradle jacocoTestReport` to generate report. [See here](https://github.com/codecov/example-gradle/blob/65f88382659cf17c8693c3079941a12c8d004f03/circle.yml#L3)
27-
28-
### FAQ
29-
- Q: Do you support Multi-module projects?<br/>A:Update your parent (root) `build.gradle`:
30-
```groovy
31-
allprojects {
32-
apply plugin: 'java'
33-
apply plugin: 'maven'
34-
apply plugin: 'jacoco'
35-
36-
sourceCompatibility = 1.8
37-
targetCompatibility = 1.8
38-
39-
repositories {
40-
mavenLocal()
41-
mavenCentral()
42-
jcenter()
43-
44-
maven { url "http://repo1.maven.org/maven2/" }
45-
}
46-
}
47-
48-
subprojects {
49-
dependencies {
50-
...
51-
}
52-
53-
test.useTestNG()
54-
}
55-
56-
task codeCoverageReport(type: JacocoReport) {
57-
executionData fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec")
58-
59-
subprojects.each {
60-
sourceSets it.sourceSets.main
61-
}
62-
63-
reports {
64-
xml.enabled true
65-
xml.destination file("${buildDir}/reports/jacoco/report.xml")
66-
html.enabled false
67-
csv.enabled false
68-
}
69-
}
70-
71-
codeCoverageReport.dependsOn {
72-
subprojects*.test
73-
}
74-
```
75-
76-
## Caveats
77-
### Private Repo
78-
Repository tokens are required for (a) all private repos, (b) public repos not using Travis-CI, CircleCI or AppVeyor. Find your repository token at Codecov and provide via appending `-t <your upload token>` to you where you upload reports.
7+
For more information, please see the links below.
798

809
## Links
10+
- [Quick Start](https://docs.codecov.com/docs/quick-start)
11+
- [GitHub Tutorial](https://docs.codecov.com/docs/github-tutorial)
8112
- [Community Boards](https://community.codecov.io)
8213
- [Support](https://codecov.io/support)
8314
- [Documentation](https://docs.codecov.io)
8415

8516

8617
## License
87-
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcodecov%2Fexample-gradle.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fcodecov%2Fexample-gradle?ref=badge_large)
18+
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcodecov%2Fexample-java-gradle.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fcodecov%2Fexample-java-gradle?ref=badge_large)

build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
group 'org.jacoco'
2-
version '1.0-SNAPSHOT'
1+
group 'io.codecov'
2+
version '1.0'
33

44
apply plugin: 'java'
55
apply plugin: 'jacoco'
66

7-
sourceCompatibility = 1.7
8-
targetCompatibility = 1.7
7+
sourceCompatibility = 18
8+
targetCompatibility = 18
99

1010
repositories {
1111
mavenCentral()
1212
}
1313

1414
dependencies {
15-
testCompile group: 'junit', name: 'junit', version: '4.11'
15+
testImplementation "junit:junit:4.13"
1616
}
1717

1818
jacocoTestReport {

circle.yml

Lines changed: 0 additions & 4 deletions
This file was deleted.

gradle/wrapper/gradle-wrapper.jar

-51 KB
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)