Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add code coverage requirements for new code #1216

Merged
merged 5 commits into from
Nov 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
name: Publish Snapshot
name: Build
on:
push:
branches:
- master

permissions:
contents: write

jobs:
gradle:
runs-on: ubuntu-latest
Expand All @@ -13,7 +16,6 @@ jobs:
with:
distribution: temurin
java-version: 11

- name: Setup and execute Gradle 'publish' task
uses: gradle/gradle-build-action@v2
with:
Expand All @@ -22,3 +24,12 @@ jobs:
env:
OSSRH_USERNAME: ${{ vars.OSSRH_USERNAME }}
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
- name: Publish Test Report
uses: mikepenz/action-junit-report@v3
if: success() || failure() # always run even if the previous step fails
with:
report_paths: '**/build/test-results/test/TEST-*.xml'
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
8 changes: 5 additions & 3 deletions .github/workflows/check-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@ jobs:
with:
distribution: temurin
java-version: 11

- name: Setup and execute Gradle 'check' task
uses: gradle/gradle-build-action@v2
with:
arguments: check -i
build-root-directory: Src/java

- name: Publish Test Report
uses: mikepenz/action-junit-report@v3
if: success() || failure() # always run even if the previous step fails
with:
report_paths: '**/build/test-results/test/TEST-*.xml'
report_paths: '**/build/test-results/test/TEST-*.xml'
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
13 changes: 11 additions & 2 deletions Src/java/buildSrc/src/main/groovy/cql.java-conventions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,19 @@ jar {
}

jacoco {
toolVersion = "0.8.8"
toolVersion = "0.8.9"
}

check.dependsOn(jacocoTestReport)
test {
finalizedBy jacocoTestReport // report is always generated after tests run
}

jacocoTestReport {
reports {
xml.required = true
}
dependsOn test // tests are required to run before generating the report
}

tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
Expand Down
20 changes: 20 additions & 0 deletions codecov.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
coverage:
status:
project:
default:
target: auto
paths:
- "Src/java"
patch:
default:
# basic
target: 80
threshold: 0%
base: auto
# advanced
branches:
- master
if_ci_failed: error #success, failure, error, ignore
only_pulls: false
paths:
- "Src/java"