Skip to content

Commit e72cd73

Browse files
feat: add JaCoCo + Coveralls + Codecov; refactor post-publish into report job before Maven Central
Add JaCoCo 0.8.14 plugin to pom.xml (prepare-agent + report in test phase). Upload jacoco.xml artifact from test-java-linux-x86_64. Rename post-publish to report, run it after package and before publish-snapshot/publish-release. Step order: dependency submission, Coveralls, Codecov.
1 parent 2d5a96e commit e72cd73

2 files changed

Lines changed: 56 additions & 19 deletions

File tree

.github/workflows/publish.yml

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,12 @@ jobs:
373373
echo "${{ github.workspace }}/core.%e.%p" | sudo tee /proc/sys/kernel/core_pattern
374374
- name: Run tests
375375
run: mvn --no-transfer-progress test
376+
- uses: actions/upload-artifact@v7
377+
if: success()
378+
with:
379+
name: jacoco-report
380+
path: target/site/jacoco/jacoco.xml
381+
if-no-files-found: ignore
376382
- name: Memory after tests
377383
if: always()
378384
run: free -h
@@ -586,9 +592,37 @@ jobs:
586592
name: llama-jars
587593
path: target/*.jar
588594

595+
report:
596+
name: Report
597+
needs: [package]
598+
runs-on: ubuntu-latest
599+
permissions:
600+
contents: write
601+
steps:
602+
- uses: actions/checkout@v6
603+
- uses: actions/setup-java@v5
604+
with: { java-version: '8', distribution: zulu }
605+
- uses: actions/download-artifact@v8
606+
with: { name: jacoco-report, path: target/site/jacoco/ }
607+
continue-on-error: true
608+
- uses: advanced-security/maven-dependency-submission-action@v5
609+
- name: Coveralls
610+
uses: coverallsapp/github-action@v2
611+
with:
612+
github-token: ${{ secrets.GITHUB_TOKEN }}
613+
file: target/site/jacoco/jacoco.xml
614+
format: jacoco
615+
continue-on-error: true
616+
- name: Codecov
617+
uses: codecov/codecov-action@v6
618+
with:
619+
token: ${{ secrets.CODECOV_TOKEN }}
620+
files: target/site/jacoco/jacoco.xml
621+
continue-on-error: true
622+
589623
publish-snapshot:
590624
name: Publish Snapshot to Central
591-
needs: [ package ]
625+
needs: [report]
592626
if: >-
593627
(github.event_name == 'push' && github.ref == 'refs/heads/main') ||
594628
github.event_name == 'workflow_dispatch'
@@ -624,7 +658,7 @@ jobs:
624658
publish-release:
625659
name: Publish Release to Central
626660
if: startsWith(github.ref, 'refs/tags/v') || github.event.inputs.release_to_maven_central == 'true'
627-
needs: [ package, crosscompile-linux-x86_64-cuda ]
661+
needs: [report, crosscompile-linux-x86_64-cuda]
628662
runs-on: ubuntu-latest
629663
environment: maven-central
630664
steps:
@@ -672,20 +706,3 @@ jobs:
672706
uses: softprops/action-gh-release@v2
673707
with:
674708
files: release-assets/*
675-
676-
post-publish:
677-
name: Post-Publish
678-
needs: [package, publish-snapshot, publish-release]
679-
if: >-
680-
always() &&
681-
needs.package.result == 'success' &&
682-
(needs.publish-snapshot.result == 'success' ||
683-
needs.publish-release.result == 'success')
684-
runs-on: ubuntu-latest
685-
permissions:
686-
contents: write
687-
steps:
688-
- uses: actions/checkout@v6
689-
- uses: actions/setup-java@v5
690-
with: { java-version: '8', distribution: zulu }
691-
- uses: advanced-security/maven-dependency-submission-action@v5

pom.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,26 @@
153153
</execution>
154154
</executions>
155155
</plugin>
156+
<plugin>
157+
<groupId>org.jacoco</groupId>
158+
<artifactId>jacoco-maven-plugin</artifactId>
159+
<version>0.8.14</version>
160+
<executions>
161+
<execution>
162+
<id>prepare-agent</id>
163+
<goals>
164+
<goal>prepare-agent</goal>
165+
</goals>
166+
</execution>
167+
<execution>
168+
<id>report</id>
169+
<phase>test</phase>
170+
<goals>
171+
<goal>report</goal>
172+
</goals>
173+
</execution>
174+
</executions>
175+
</plugin>
156176
</plugins>
157177
</build>
158178

0 commit comments

Comments
 (0)