From 9d452a4138ce8421365658a433073cf90a9e3749 Mon Sep 17 00:00:00 2001 From: StepanMoc Date: Tue, 2 Apr 2024 22:14:52 +0200 Subject: [PATCH 1/5] changed build.gradle.kts --- .idea/.gitignore | 10 ---------- .idea/misc.xml | 1 - backend/build.gradle.kts | 2 +- 3 files changed, 1 insertion(+), 12 deletions(-) delete mode 100644 .idea/.gitignore diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index a9d7db9..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml -# GitHub Copilot persisted chat sessions -/copilot/chatSessions diff --git a/.idea/misc.xml b/.idea/misc.xml index d79bd4e..f45063f 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,3 @@ - diff --git a/backend/build.gradle.kts b/backend/build.gradle.kts index fc35ec1..7aeca54 100644 --- a/backend/build.gradle.kts +++ b/backend/build.gradle.kts @@ -65,7 +65,7 @@ tasks.jacocoTestReport { reports { xml.required = false csv.required = false - html.outputLocation = layout.buildDirectory.dir("jacocoHtml") + html.outputLocation = layout.buildDirectory.dir("reports/jacoco/test/html") } } From e0de5020cba16c2d46ef8a923c5e8ba5721f6b0a Mon Sep 17 00:00:00 2001 From: "stepan.moc" Date: Tue, 2 Apr 2024 22:26:37 +0200 Subject: [PATCH 2/5] Update gradle.yml --- .github/workflows/gradle.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index eb2cd22..eae0c56 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -74,3 +74,4 @@ jobs: with: token: ${{ secrets.CODECOV_TOKEN }} slug: MocStepan/STIN-semestral-project + directory: backend/build/reports/jacoco/test/html From 3bff23143e02dc24385b3242f7c92157a9bb3156 Mon Sep 17 00:00:00 2001 From: StepanMoc Date: Wed, 3 Apr 2024 21:52:06 +0200 Subject: [PATCH 3/5] changed build.gradle.kts and gradle.yml --- .github/workflows/gradle.yml | 1 + backend/build.gradle.kts | 21 ++++++++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index eb2cd22..a139a03 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -74,3 +74,4 @@ jobs: with: token: ${{ secrets.CODECOV_TOKEN }} slug: MocStepan/STIN-semestral-project + file: backend/build/reports/jacoco/test/html/jacocoTestReport.xml diff --git a/backend/build.gradle.kts b/backend/build.gradle.kts index 7aeca54..1e3ba22 100644 --- a/backend/build.gradle.kts +++ b/backend/build.gradle.kts @@ -27,6 +27,7 @@ dependencies { implementation("org.springframework.boot:spring-boot-starter-security") implementation("org.springframework.boot:spring-boot-starter-web") implementation("org.springframework.boot:spring-boot-starter-web-services") + implementation("org.springframework.boot:spring-boot-starter-actuator") implementation("com.fasterxml.jackson.module:jackson-module-kotlin") implementation("org.jetbrains.kotlin:kotlin-reflect") runtimeOnly("org.postgresql:postgresql") @@ -55,17 +56,19 @@ tasks.test { finalizedBy(tasks.jacocoTestReport) // report is always generated after tests run } -jacoco { - toolVersion = "0.8.11" - reportsDirectory = layout.buildDirectory.dir("customJacocoReportDir") -} - tasks.jacocoTestReport { - dependsOn(tasks.test) // tests are required to run before generating the report reports { - xml.required = false - csv.required = false - html.outputLocation = layout.buildDirectory.dir("reports/jacoco/test/html") + xml.required = true + } + dependsOn(tasks.test) // tests are required to run before generating the report +} +tasks.jacocoTestCoverageVerification { + violationRules { + rule { + limit { + minimum = BigDecimal("0.8") + } + } } } From 99692f88982dd89022145b1ce9ff575d8afec267 Mon Sep 17 00:00:00 2001 From: StepanMoc Date: Wed, 3 Apr 2024 22:04:01 +0200 Subject: [PATCH 4/5] renames and changed format --- .github/workflows/build-backend.yml | 45 +++++++++++++++++ .github/workflows/gradle.yml | 77 ----------------------------- 2 files changed, 45 insertions(+), 77 deletions(-) create mode 100644 .github/workflows/build-backend.yml delete mode 100644 .github/workflows/gradle.yml diff --git a/.github/workflows/build-backend.yml b/.github/workflows/build-backend.yml new file mode 100644 index 0000000..5929789 --- /dev/null +++ b/.github/workflows/build-backend.yml @@ -0,0 +1,45 @@ +name: Build backend + +on: + push: + branches: + - * + pull_request: + branches: + - * + +jobs: + backend: + runs-on: ubuntu-latest + permissions: + contents: read + defaults: + run: + working-directory: backend + steps: + - uses: actions/checkout@v4 + + - name: Set up JDK 17 for backend + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: temurin + + - name: setup Gradle + uses: gradle/actions/setup-gradle@v3 + with: + generate-job-summary: true + add-job-summary-as-pr-comment: on-failure + cache-disabled: true + - name: Set execute permissions for backend gradlew + run: chmod +x gradlew + + - name: Build backend and run tests with Gradle Wrapper + run: ./gradlew build + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v4.0.1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + slug: MocStepan/STIN-semestral-project + file: backend/build/reports/jacoco/test/html/jacocoTestReport.xml \ No newline at end of file diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml deleted file mode 100644 index a139a03..0000000 --- a/.github/workflows/gradle.yml +++ /dev/null @@ -1,77 +0,0 @@ -name: Java CI with Gradle - -on: - push: - branches: "*" - pull_request: - branches: "*" - -jobs: - build: - runs-on: ubuntu-latest - permissions: - contents: read - steps: - - uses: actions/checkout@v4 - - - name: Set up JDK 17 for backend - uses: actions/setup-java@v4 - with: - java-version: '17' - distribution: 'temurin' - - - name: Set execute permissions for backend gradlew - run: chmod +x ./backend/gradlew - - - name: Build backend with Gradle Wrapper - run: ./gradlew build - working-directory: ./backend - - tests: - runs-on: ubuntu-latest - needs: build - permissions: - contents: read - steps: - - uses: actions/checkout@v4 - - - name: Set up JDK 17 for backend - uses: actions/setup-java@v4 - with: - java-version: '17' - distribution: 'temurin' - - - name: Set execute permissions for backend gradlew - run: chmod +x ./backend/gradlew - - - name: Run backend tests - run: ./gradlew test - working-directory: ./backend - - jacoco: - runs-on: ubuntu-latest - needs: build - permissions: - contents: read - steps: - - uses: actions/checkout@v4 - - - name: Set up JDK 17 for backend - uses: actions/setup-java@v4 - with: - java-version: '17' - distribution: 'temurin' - - - name: Set execute permissions for backend gradlew - run: chmod +x ./backend/gradlew - - - name: Generate Jacoco report - run: ./gradlew jacocoTestReport - working-directory: ./backend - - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v4.0.1 - with: - token: ${{ secrets.CODECOV_TOKEN }} - slug: MocStepan/STIN-semestral-project - file: backend/build/reports/jacoco/test/html/jacocoTestReport.xml From fa6541e37d8a4bbe57afa7c56c44feb3780a57f0 Mon Sep 17 00:00:00 2001 From: StepanMoc Date: Wed, 3 Apr 2024 22:07:35 +0200 Subject: [PATCH 5/5] added codecov.yml and change build-backend.yml --- .github/workflows/build-backend.yml | 10 +++--- codecov.yml | 49 +++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 5 deletions(-) create mode 100644 codecov.yml diff --git a/.github/workflows/build-backend.yml b/.github/workflows/build-backend.yml index 5929789..c7a4585 100644 --- a/.github/workflows/build-backend.yml +++ b/.github/workflows/build-backend.yml @@ -1,12 +1,11 @@ name: Build backend +run-name: "Run ${{github.run_id}}, triggered by ${{github.actor}}" on: push: - branches: - - * + branches: "*" pull_request: - branches: - - * + branches: "*" jobs: backend: @@ -41,5 +40,6 @@ jobs: uses: codecov/codecov-action@v4.0.1 with: token: ${{ secrets.CODECOV_TOKEN }} - slug: MocStepan/STIN-semestral-project + flags: backend + slugs: ${{ github.repository }} file: backend/build/reports/jacoco/test/html/jacocoTestReport.xml \ No newline at end of file diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..fe6a864 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,49 @@ +coverage: + range: "80..100" + round: down + status: + project: + default: + target: auto + threshold: "80%" + base: auto + if_not_found: success + informational: false + only_pulls: false +flag_management: + default_rules: + carryforward: true + statuses: + - type: project + target: auto + threshold: 80% + - type: patch + target: 80% + individual_flags: + - name: backend + paths: + - backend + carryforward: true + statuses: + - type: project + target: 80% + - type: patch + target: 80% + - name: frontend + paths: + - frontend + carryforward: true + statuses: + - type: project + target: 80% + - type: patch + target: 80% +comment: + layout: "diff, flags, files" + behavior: default + require_changes: false + require_base: false + require_head: true + hide_project_coverage: false +github_checks: + annotations: true \ No newline at end of file