Skip to content

Commit

Permalink
Measure game test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensworks committed Dec 2, 2024
1 parent 2cc5182 commit 267bcea
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 26 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,9 @@ jobs:
GITHUB_USER: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: 'Test'
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
if: ${{ env.COVERALLS_REPO_TOKEN }}
run: ./gradlew test jacocoTestReport coveralls
- name: 'Game Test'
run: ./gradlew runGameTestServer -x :loader-forge:downloadAssets
run: ./gradlew test runGameTestServer jacocoTestReport -x :loader-forge:downloadAssets
- name: 'Submit coverage results'
uses: coverallsapp/github-action@v2
- name: 'Deploy as GitHub CI artifacts'
uses: actions/upload-artifact@v4
with:
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## Colossal Chests

[![Build Status](https://github.com/CyclopsMC/ColossalChests/workflows/CI/badge.svg)](https://github.com/CyclopsMC/ColossalChests/actions?query=workflow%3ACI)
[![Coverage Status](https://coveralls.io/repos/github/CyclopsMC/ColossalChests/badge.svg)](https://coveralls.io/github/CyclopsMC/ColossalChests)
[![Download](https://img.shields.io/static/v1?label=Maven&message=GitHub%20Packages&color=blue)](https://github.com/CyclopsMC/packages/packages/770015)
[![CurseForge](http://cf.way2muchnoise.eu/full_237875_downloads.svg)](https://www.curseforge.com/minecraft/mc-mods/colossal-chests)
[![Discord](https://img.shields.io/discord/386052815128100865.svg?colorB=7289DA&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHYAAABWAgMAAABnZYq0AAAACVBMVEUAAB38%2FPz%2F%2F%2F%2Bm8P%2F9AAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfhBxwQJhxy2iqrAAABoElEQVRIx7WWzdGEIAyGgcMeKMESrMJ6rILZCiiBg4eYKr%2Fd1ZAfgXFm98sJfAyGNwno3G9sLucgYGpQ4OGVRxQTREMDZjF7ILSWjoiHo1n%2BE03Aw8p7CNY5IhkYd%2F%2F6MtO3f8BNhR1QWnarCH4tr6myl0cWgUVNcfMcXACP1hKrGMt8wcAyxide7Ymcgqale7hN6846uJCkQxw6GG7h2MH4Czz3cLqD1zHu0VOXMfZjHLoYvsdd0Q7ZvsOkafJ1P4QXxrWFd14wMc60h8JKCbyQvImzlFjyGoZTKzohwWR2UzSONHhYXBQOaKKsySsahwGGDnb%2FiYPJw22sCqzirSULYy1qtHhXGbtgrM0oagBV4XiTJok3GoLoDNH8ooTmBm7ZMsbpFzi2bgPGoXWXME6XT%2BRJ4GLddxJ4PpQy7tmfoU2HPN6cKg%2BledKHBKlF8oNSt5w5g5o8eXhu1IOlpl5kGerDxIVT%2BztzKepulD8utXqpChamkzzuo7xYGk%2FkpSYuviLXun5bzdRf0Krejzqyz7Z3p0I1v2d6HmA07dofmS48njAiuMgAAAAASUVORK5CYII%3D)](https://discord.gg/9yDxubB)
Expand Down
1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
plugins {
id 'net.darkhax.curseforgegradle' version '1.0.8' apply false
id 'com.github.kt3k.coveralls' version '2.12.0' apply false
id 'com.diffplug.spotless' version '6.25.0' apply false
id 'com.modrinth.minotaur' version '2.+' apply false

Expand Down
8 changes: 0 additions & 8 deletions buildSrc/src/main/groovy/multiloader-common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ plugins {
id 'java-library'
id 'maven-publish'
id 'jacoco'
id 'com.github.kt3k.coveralls'
id 'com.diffplug.spotless'
}

Expand Down Expand Up @@ -291,13 +290,6 @@ tasks.configureEach { task ->
}
}

jacocoTestReport {
reports {
xml.required = true
html.required = true
}
}

javadoc {
// prevent java 8's strict doclint for javadocs from failing builds
options.addStringOption('Xdoclint:accessibility,html,reference,syntax', '-quiet')
Expand Down
15 changes: 15 additions & 0 deletions buildSrc/src/main/groovy/multiloader-loader-fabric.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,21 @@ task runGameTestServer {
dependsOn tasks.runGameTest
}

jacoco {
toolVersion = "0.8.12"
applyTo runGameTest
}

jacocoTestReport {
dependsOn test, runGameTest
// Include unit and game test coverage
executionData fileTree(project.rootDir.absolutePath).include("loader-fabric/build/jacoco/*.exec")
reports {
xml.required = true
html.required = true
}
}

publishing {
publications { PublicationContainer publicationContainer ->
publicationContainer.getByName("maven") { MavenPublication publication ->
Expand Down
43 changes: 32 additions & 11 deletions buildSrc/src/main/groovy/multiloader-loader-neoforge.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,38 @@ runs {
}
}

tasks.register('signJar').configure {
dependsOn(tasks.jar)

onlyIf {
System.getenv().SIGN_KEYSTORE
// Disabled because signed jars are not being checked anyways
//tasks.register('signJar').configure {
// dependsOn(tasks.jar)
//
// onlyIf {
// System.getenv().SIGN_KEYSTORE
// }
//
// keyStore = System.getenv().SIGN_KEYSTORE
// alias = System.getenv().SIGN_ALIAS
// storePass = System.getenv().SIGN_STOREPASS
// keyPass = System.getenv().SIGN_KEYPASS
// input = jar.archivePath
// output = jar.archivePath
//}

jacocoTestReport {
// Include unit and game test coverage
executionData fileTree(project.rootDir.absolutePath).include("loader-neoforge/build/jacoco/*.exec")
reports {
xml.required = true
html.required = true
}
}

keyStore = System.getenv().SIGN_KEYSTORE
alias = System.getenv().SIGN_ALIAS
storePass = System.getenv().SIGN_STOREPASS
keyPass = System.getenv().SIGN_KEYPASS
input = jar.archivePath
output = jar.archivePath
// Also measure coverage for game tests
tasks.whenTaskAdded { task ->
if (task.name.equals('runGameTestServer')) {
jacocoTestReport.dependsOn test, task
jacoco {
toolVersion = "0.8.12"
applyTo task
}
}
}

0 comments on commit 267bcea

Please sign in to comment.