Skip to content

Commit

Permalink
Merge pull request #14 from MocStepan/12-fix-codecov-and-jacoco-report
Browse files Browse the repository at this point in the history
12 fix codecov and jacoco report
  • Loading branch information
MocStepan authored Apr 3, 2024
2 parents 594372d + fa6541e commit 6a3c203
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 96 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/build-backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Build backend
run-name: "Run ${{github.run_id}}, triggered by ${{github.actor}}"

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/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: backend
slugs: ${{ github.repository }}
file: backend/build/reports/jacoco/test/html/jacocoTestReport.xml
76 changes: 0 additions & 76 deletions .github/workflows/gradle.yml

This file was deleted.

10 changes: 0 additions & 10 deletions .idea/.gitignore

This file was deleted.

1 change: 0 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 12 additions & 9 deletions backend/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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("jacocoHtml")
xml.required = true
}
dependsOn(tasks.test) // tests are required to run before generating the report
}
tasks.jacocoTestCoverageVerification {
violationRules {
rule {
limit {
minimum = BigDecimal("0.8")
}
}
}
}

49 changes: 49 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 6a3c203

Please sign in to comment.