diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml
new file mode 100644
index 00000000..44fe0127
--- /dev/null
+++ b/.github/workflows/coverage.yaml
@@ -0,0 +1,46 @@
+name: Java Code Coverage
+
+on:
+ push:
+ branches:
+ - main
+ pull_request:
+ branches: [ '*' ]
+
+jobs:
+ coverage:
+ name: Generate Coverage Report
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ - name: Install buf
+ run: |
+ curl -sSL "https://github.com/bufbuild/buf/releases/latest/download/buf-$(uname -s)-$(uname -m)" -o /usr/local/bin/buf
+ chmod +x /usr/local/bin/buf
+
+ - name: Set up JDK 11
+ uses: actions/setup-java@v4
+ with:
+ distribution: 'temurin'
+ java-version: '11'
+
+ - name: Build with Maven
+ run: mvn -B clean package
+
+ - name: Run tests
+ run: mvn test jacoco:prepare-agent
+
+ - name: Generate Jacoco coverage report
+ run: mvn jacoco:report
+
+ - name: Upload coverage report
+ uses: actions/upload-artifact@v4
+ with:
+ name: coverage-report
+ path: |
+ ${{ github.workspace }}/sdk/target/site/jacoco/
+
+
diff --git a/pom.xml b/pom.xml
index d2eecec4..2b8c0049 100644
--- a/pom.xml
+++ b/pom.xml
@@ -131,8 +131,9 @@
3.8.0
+ org.apache.maven.plugins
maven-surefire-plugin
- 3.0.0
+ 3.2.5
maven-jar-plugin
@@ -169,6 +170,11 @@
+
+ org.jacoco
+ jacoco-maven-plugin
+ 0.8.12
+
@@ -211,6 +217,28 @@
+
+ org.jacoco
+ jacoco-maven-plugin
+
+
+
+ prepare-agent
+ report
+
+
+ ${project.basedir}/coverage-report
+
+
+
+ generate-code-coverage-report
+ test
+
+ report
+
+
+
+