diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a0094382..e717ae94 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: diff --git a/buildSrc/src/main/groovy/multiloader-common.gradle b/buildSrc/src/main/groovy/multiloader-common.gradle index 78885d89..f5f8eeb3 100644 --- a/buildSrc/src/main/groovy/multiloader-common.gradle +++ b/buildSrc/src/main/groovy/multiloader-common.gradle @@ -292,6 +292,8 @@ tasks.configureEach { task -> } jacocoTestReport { + // Include unit and game test coverage + executionData fileTree(project.rootDir.absolutePath).include("loader-((fabric)|(neoforge))/build/jacoco/*.exec") reports { xml.required = true html.required = true diff --git a/buildSrc/src/main/groovy/multiloader-loader-fabric.gradle b/buildSrc/src/main/groovy/multiloader-loader-fabric.gradle index 5e2372e3..ae892078 100644 --- a/buildSrc/src/main/groovy/multiloader-loader-fabric.gradle +++ b/buildSrc/src/main/groovy/multiloader-loader-fabric.gradle @@ -52,6 +52,12 @@ task runGameTestServer { dependsOn tasks.runGameTest } +jacocoTestReport.dependsOn test, runGameTest +jacoco { + toolVersion = "0.8.12" + applyTo runGameTest +} + publishing { publications { PublicationContainer publicationContainer -> publicationContainer.getByName("maven") { MavenPublication publication -> diff --git a/buildSrc/src/main/groovy/multiloader-loader-neoforge.gradle b/buildSrc/src/main/groovy/multiloader-loader-neoforge.gradle index e0eb0c81..9906fcb9 100644 --- a/buildSrc/src/main/groovy/multiloader-loader-neoforge.gradle +++ b/buildSrc/src/main/groovy/multiloader-loader-neoforge.gradle @@ -76,17 +76,30 @@ runs { } } -tasks.register('signJar').configure { - dependsOn(tasks.jar) +if (System.getenv().SIGN_KEYSTORE) { + tasks.register('signJar').configure { + dependsOn(tasks.jar) - onlyIf { - System.getenv().SIGN_KEYSTORE + 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 } +} - 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 + } + } }