From 4580a5873e47bda049f7b705ff266f2d2caa3ca4 Mon Sep 17 00:00:00 2001 From: Mikhail Ustyantsev Date: Wed, 5 Jun 2024 14:50:54 +0300 Subject: [PATCH 01/12] add code coverage --- .github/workflows/coverage.yaml | 37 +++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/coverage.yaml diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml new file mode 100644 index 00000000..877e5c1c --- /dev/null +++ b/.github/workflows/coverage.yaml @@ -0,0 +1,37 @@ +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: 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 with Jacoco Report + run: mvn jacoco:report + + - name: Upload coverage report + uses: actions/upload-artifact@v4 + with: + name: coverage-report + path: target/site/jacoco/index.html + + From af0713c79764795b9106b094cd16904b18bdbcd0 Mon Sep 17 00:00:00 2001 From: Mikhail Ustyantsev Date: Wed, 5 Jun 2024 15:43:07 +0300 Subject: [PATCH 02/12] install buf --- .github/workflows/coverage.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml index 877e5c1c..c9e495a3 100644 --- a/.github/workflows/coverage.yaml +++ b/.github/workflows/coverage.yaml @@ -16,6 +16,11 @@ jobs: - 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: From 961b669b5d9f6329c8b5faaab39fdc23fb00061d Mon Sep 17 00:00:00 2001 From: Mikhail Ustyantsev Date: Wed, 5 Jun 2024 15:46:13 +0300 Subject: [PATCH 03/12] add jacoco plugin --- pom.xml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/pom.xml b/pom.xml index caf70549..a7b11b0f 100644 --- a/pom.xml +++ b/pom.xml @@ -168,6 +168,25 @@ + + org.jacoco + jacoco-maven-plugin + 0.8.8 + + + + prepare-agent + + + + report + test + + report + + + + From 76c3f56e238b4abb2bd51ed4e529779d98c6e61f Mon Sep 17 00:00:00 2001 From: Mikhail Ustyantsev Date: Wed, 5 Jun 2024 15:51:59 +0300 Subject: [PATCH 04/12] step - run test --- .github/workflows/coverage.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml index c9e495a3..9b4148e0 100644 --- a/.github/workflows/coverage.yaml +++ b/.github/workflows/coverage.yaml @@ -30,13 +30,16 @@ jobs: - name: Build with Maven run: mvn -B clean package - - name: Run Tests with Jacoco Report + - name: Run tests + run: mvn test + + - name: Generate Jacoco coverage report run: mvn jacoco:report - name: Upload coverage report uses: actions/upload-artifact@v4 with: name: coverage-report - path: target/site/jacoco/index.html + path: target/site/jacoco/jacoco.xml From 0a23f935fd9327c24dcf6b8ece3825a186d2ec47 Mon Sep 17 00:00:00 2001 From: Mikhail Ustyantsev Date: Wed, 5 Jun 2024 16:39:11 +0300 Subject: [PATCH 05/12] outputdir for report --- pom.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pom.xml b/pom.xml index a7b11b0f..2babf84d 100644 --- a/pom.xml +++ b/pom.xml @@ -184,6 +184,12 @@ report + + ${project.build.directory}/site/jacoco + + xml + + From 927d40b4693c91b3ce2ca8df6850c5cf6b6e3879 Mon Sep 17 00:00:00 2001 From: Mikhail Ustyantsev Date: Wed, 5 Jun 2024 16:47:00 +0300 Subject: [PATCH 06/12] specify report path --- .github/workflows/coverage.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml index 9b4148e0..e5b8b45e 100644 --- a/.github/workflows/coverage.yaml +++ b/.github/workflows/coverage.yaml @@ -40,6 +40,8 @@ jobs: uses: actions/upload-artifact@v4 with: name: coverage-report - path: target/site/jacoco/jacoco.xml + path: | + ${{ github.workspace }}/target/site/jacoco/jacoco.xml + ${{ github.workspace }}/target/site/jacoco/index.html From f461e3d7e68159c5bc5984f1a119d859d0b8a9e5 Mon Sep 17 00:00:00 2001 From: Mikhail Ustyantsev Date: Wed, 5 Jun 2024 17:27:06 +0300 Subject: [PATCH 07/12] show files --- .github/workflows/coverage.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml index e5b8b45e..abef2291 100644 --- a/.github/workflows/coverage.yaml +++ b/.github/workflows/coverage.yaml @@ -36,6 +36,10 @@ jobs: - name: Generate Jacoco coverage report run: mvn jacoco:report + - name: show files + run: | + - ls + - pwd - name: Upload coverage report uses: actions/upload-artifact@v4 with: From b5263e1a983cc735922b439beef7d7178bda3308 Mon Sep 17 00:00:00 2001 From: Mikhail Ustyantsev Date: Wed, 5 Jun 2024 17:29:13 +0300 Subject: [PATCH 08/12] show files --- .github/workflows/coverage.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml index abef2291..d30f7b0f 100644 --- a/.github/workflows/coverage.yaml +++ b/.github/workflows/coverage.yaml @@ -38,8 +38,8 @@ jobs: - name: show files run: | - - ls - - pwd + ls + pwd - name: Upload coverage report uses: actions/upload-artifact@v4 with: From e282d9b4cd5bd369c36853012a4b87a29aaa5567 Mon Sep 17 00:00:00 2001 From: Mikhail Ustyantsev Date: Fri, 7 Jun 2024 10:55:29 +0300 Subject: [PATCH 09/12] change report path --- .github/workflows/coverage.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml index d30f7b0f..6e14d75d 100644 --- a/.github/workflows/coverage.yaml +++ b/.github/workflows/coverage.yaml @@ -34,7 +34,7 @@ jobs: run: mvn test - name: Generate Jacoco coverage report - run: mvn jacoco:report + run: mvn jacoco:report -DreportOutputDirectory=${{ github.workspace }}/target/site/jacoco - name: show files run: | From e7f6116fd81add24a2c607b7aa29918c86c1d4db Mon Sep 17 00:00:00 2001 From: Mikhail Ustyantsev Date: Fri, 7 Jun 2024 11:00:00 +0300 Subject: [PATCH 10/12] change report path --- .github/workflows/coverage.yaml | 2 +- pom.xml | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml index 6e14d75d..e792406a 100644 --- a/.github/workflows/coverage.yaml +++ b/.github/workflows/coverage.yaml @@ -31,7 +31,7 @@ jobs: run: mvn -B clean package - name: Run tests - run: mvn test + run: mvn test jacoco:prepare-agent - name: Generate Jacoco coverage report run: mvn jacoco:report -DreportOutputDirectory=${{ github.workspace }}/target/site/jacoco diff --git a/pom.xml b/pom.xml index 2301cd2b..5612fab3 100644 --- a/pom.xml +++ b/pom.xml @@ -178,6 +178,9 @@ prepare-agent + + ${project.build.directory}/jacoco.exec + report From cb523b6ba1fa10feabb66471420fd7fdb8a8464d Mon Sep 17 00:00:00 2001 From: Mikhail Ustyantsev Date: Fri, 7 Jun 2024 15:43:34 +0300 Subject: [PATCH 11/12] make it works --- .github/workflows/coverage.yaml | 10 ++----- pom.xml | 50 ++++++++++++++++----------------- 2 files changed, 28 insertions(+), 32 deletions(-) diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml index e792406a..512972b6 100644 --- a/.github/workflows/coverage.yaml +++ b/.github/workflows/coverage.yaml @@ -34,18 +34,14 @@ jobs: run: mvn test jacoco:prepare-agent - name: Generate Jacoco coverage report - run: mvn jacoco:report -DreportOutputDirectory=${{ github.workspace }}/target/site/jacoco + run: mvn jacoco:report - - name: show files - run: | - ls - pwd - name: Upload coverage report uses: actions/upload-artifact@v4 with: name: coverage-report path: | - ${{ github.workspace }}/target/site/jacoco/jacoco.xml - ${{ github.workspace }}/target/site/jacoco/index.html + ${{ github.workspace }}/sdk/target/site/jacoco/jacoco.xml + ${{ github.workspace }}/sdk/target/site/jacoco/index.html diff --git a/pom.xml b/pom.xml index 5612fab3..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 @@ -172,30 +173,7 @@ org.jacoco jacoco-maven-plugin - 0.8.8 - - - - prepare-agent - - - ${project.build.directory}/jacoco.exec - - - - report - test - - report - - - ${project.build.directory}/site/jacoco - - xml - - - - + 0.8.12 @@ -239,6 +217,28 @@ + + org.jacoco + jacoco-maven-plugin + + + + prepare-agent + report + + + ${project.basedir}/coverage-report + + + + generate-code-coverage-report + test + + report + + + + From 493f9b76470dcbed924d2e819d2580dad0c7b455 Mon Sep 17 00:00:00 2001 From: Mikhail Ustyantsev Date: Tue, 11 Jun 2024 15:16:56 +0300 Subject: [PATCH 12/12] upload entire folder with coverage data --- .github/workflows/coverage.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml index 512972b6..44fe0127 100644 --- a/.github/workflows/coverage.yaml +++ b/.github/workflows/coverage.yaml @@ -41,7 +41,6 @@ jobs: with: name: coverage-report path: | - ${{ github.workspace }}/sdk/target/site/jacoco/jacoco.xml - ${{ github.workspace }}/sdk/target/site/jacoco/index.html + ${{ github.workspace }}/sdk/target/site/jacoco/