From 2f592c2b1f2276f87fab5bc97c78e2cd46c43292 Mon Sep 17 00:00:00 2001 From: asavershin Date: Wed, 2 Oct 2024 23:04:03 +0300 Subject: [PATCH 1/4] 46 Add github flows --- .github/workflows/JavaMavenCI.yml | 55 +++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/JavaMavenCI.yml diff --git a/.github/workflows/JavaMavenCI.yml b/.github/workflows/JavaMavenCI.yml new file mode 100644 index 0000000..9e637d8 --- /dev/null +++ b/.github/workflows/JavaMavenCI.yml @@ -0,0 +1,55 @@ +name: Java CI with Maven + +on: + push: + branches: + - '*' + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + cache: maven + - name: Compile with maven + run: mvn clean compile + + checkstyle: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + cache: maven + - name: Checkstyle with maven + run: mvn checkstyle:check + + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + cache: maven + - name: Compile maven project + run: mvn clean compile + - name: Test maven project + run: mvn test \ No newline at end of file From 5419f70e91b6755f62a4341675a76b146239bdd2 Mon Sep 17 00:00:00 2001 From: asavershin Date: Wed, 2 Oct 2024 23:23:08 +0300 Subject: [PATCH 2/4] 46 Add jacoco reporter --- .github/workflows/JavaMavenCI.yml | 27 +++++++++++++++++++++++++-- pom.xml | 1 + 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/.github/workflows/JavaMavenCI.yml b/.github/workflows/JavaMavenCI.yml index 9e637d8..7a8797f 100644 --- a/.github/workflows/JavaMavenCI.yml +++ b/.github/workflows/JavaMavenCI.yml @@ -7,6 +7,7 @@ on: pull_request: jobs: + build: runs-on: ubuntu-latest @@ -39,7 +40,8 @@ jobs: test: runs-on: ubuntu-latest - + permissions: + pull-requests: write steps: - name: Checkout uses: actions/checkout@v4 @@ -52,4 +54,25 @@ jobs: - name: Compile maven project run: mvn clean compile - name: Test maven project - run: mvn test \ No newline at end of file + run: mvn test + - name: Add coverage to PR + id: jacoco + uses: madrapps/jacoco-report@v1.6.1 + with: + paths: | + ${{ github.workspace }}/**/target/site/jacoco/*.xml + token: ${{ secrets.TEST_SECRET }} + min-coverage-overall: 50 + min-coverage-changed-files: 50 + - name: Upload coverage report + uses: actions/upload-artifact@v4 + with: + name: jacoco-report + path: ${{ github.workspace }}/**/target/site/jacoco/ + + - name: Fail PR if overall coverage is less than 50% + if: ${{ steps.jacoco.outputs.coverage-overall < 50.0 }} + uses: actions/github-script@v6 + with: + script: | + core.setFailed('Overall coverage is less than 50%!') \ No newline at end of file diff --git a/pom.xml b/pom.xml index cc53273..3d964f3 100644 --- a/pom.xml +++ b/pom.xml @@ -240,6 +240,7 @@ agroscience/fields/services/Field* agroscience/fields/services/Soil* agroscience/fields/services/Crops* + agroscience/fields/controllers/* From 74cc711446c027f8a5afb7612d155fb29901f1c8 Mon Sep 17 00:00:00 2001 From: asavershin Date: Wed, 2 Oct 2024 23:26:53 +0300 Subject: [PATCH 3/4] Revert "46 Add jacoco reporter" This reverts commit 5419f70e91b6755f62a4341675a76b146239bdd2. --- .github/workflows/JavaMavenCI.yml | 27 ++------------------------- pom.xml | 1 - 2 files changed, 2 insertions(+), 26 deletions(-) diff --git a/.github/workflows/JavaMavenCI.yml b/.github/workflows/JavaMavenCI.yml index 7a8797f..9e637d8 100644 --- a/.github/workflows/JavaMavenCI.yml +++ b/.github/workflows/JavaMavenCI.yml @@ -7,7 +7,6 @@ on: pull_request: jobs: - build: runs-on: ubuntu-latest @@ -40,8 +39,7 @@ jobs: test: runs-on: ubuntu-latest - permissions: - pull-requests: write + steps: - name: Checkout uses: actions/checkout@v4 @@ -54,25 +52,4 @@ jobs: - name: Compile maven project run: mvn clean compile - name: Test maven project - run: mvn test - - name: Add coverage to PR - id: jacoco - uses: madrapps/jacoco-report@v1.6.1 - with: - paths: | - ${{ github.workspace }}/**/target/site/jacoco/*.xml - token: ${{ secrets.TEST_SECRET }} - min-coverage-overall: 50 - min-coverage-changed-files: 50 - - name: Upload coverage report - uses: actions/upload-artifact@v4 - with: - name: jacoco-report - path: ${{ github.workspace }}/**/target/site/jacoco/ - - - name: Fail PR if overall coverage is less than 50% - if: ${{ steps.jacoco.outputs.coverage-overall < 50.0 }} - uses: actions/github-script@v6 - with: - script: | - core.setFailed('Overall coverage is less than 50%!') \ No newline at end of file + run: mvn test \ No newline at end of file diff --git a/pom.xml b/pom.xml index 3d964f3..cc53273 100644 --- a/pom.xml +++ b/pom.xml @@ -240,7 +240,6 @@ agroscience/fields/services/Field* agroscience/fields/services/Soil* agroscience/fields/services/Crops* - agroscience/fields/controllers/* From 31695e05ded63aca5c848a26efb8717d19111573 Mon Sep 17 00:00:00 2001 From: asavershin Date: Wed, 2 Oct 2024 23:27:20 +0300 Subject: [PATCH 4/4] 46 Add controllers to jacoco --- pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/pom.xml b/pom.xml index cc53273..3d964f3 100644 --- a/pom.xml +++ b/pom.xml @@ -240,6 +240,7 @@ agroscience/fields/services/Field* agroscience/fields/services/Soil* agroscience/fields/services/Crops* + agroscience/fields/controllers/*