Skip to content

Commit

Permalink
Only create coverage reports in a CI environment. Adding forking base…
Browse files Browse the repository at this point in the history
…d on the guide
  • Loading branch information
AndrewQuijano committed Apr 25, 2024
1 parent 7fa1b35 commit 508ac18
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-gradle-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ jobs:
java-version: '17'
cache: 'gradle'

- name: Run Gradle Testing
run: sh gradlew build
- name: Run Gradle Testing and Create Coverage Report
run: sh gradlew build -Pcoverage=true

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
Expand Down
14 changes: 12 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,21 @@ gradle.projectsEvaluated {
}
}

tasks.withType(JavaCompile).configureEach {
options.fork = true
}

jacocoTestReport {
reports {
xml.required=true
html.required=true
// By default do NOT create reports
if (project.hasProperty("coverage")) {
xml.required=true
html.required=true
}
else {
xml.required=false
html.required=false
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ if [[ $(id) != *\(docker\)* ]]; then
echo '[*] Configuring Docker...'
echo '##################################################'
sleep 3
sudo usermod -aG docker $USER
sudo usermod -aG docker "$USER"

echo '#####################################################################'
echo '[*] Almost there! Reboot and run this script one more time to finish.'
Expand Down

0 comments on commit 508ac18

Please sign in to comment.