From bd94ee18cfb6a001fcee26a649b3532bcf908805 Mon Sep 17 00:00:00 2001 From: Nate Mortensen Date: Fri, 11 Oct 2024 11:09:59 -0700 Subject: [PATCH] Add codecov --- .github/workflows/codecov.yml | 20 ++++++++++++++++++++ build.gradle | 1 + codecov.yml | 30 ++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 .github/workflows/codecov.yml create mode 100644 codecov.yml diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml new file mode 100644 index 000000000..ef77f9fbd --- /dev/null +++ b/.github/workflows/codecov.yml @@ -0,0 +1,20 @@ +name: Workflow for Codecov +on: [push, pull_request] +jobs: + run: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: 11 + - name: Install dependencies, run tests, and collect coverage + run: ./gradlew jacocoTestReport + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_ORG_TOKEN }} + slug: uber/cadence \ No newline at end of file diff --git a/build.gradle b/build.gradle index f6e051351..979977a3d 100644 --- a/build.gradle +++ b/build.gradle @@ -355,6 +355,7 @@ jacoco { } jacocoTestReport { + dependsOn test reports { xml.enabled = true // coveralls plugin depends on xml format report html.enabled = true diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 000000000..1c4ddbdd0 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,30 @@ +# Refs: +# - https://docs.codecov.com/docs/common-recipe-list +# - https://docs.codecov.com/docs/codecovyml-reference +# +# After making changes, run below command to validate +# curl --data-binary @codecov.yml https://codecov.io/validate +coverage: + range: 80...100 + round: down + precision: 2 + status: + project: # measuring the overall project coverage + default: # context, you can create multiple ones with custom titles + informational: true + target: 85% # specify the target coverage for each commit status + # option: "auto" (compare against parent commit or pull request base) + # option: "X%" a static target percentage to hit + threshold: 0% # allow the coverage drop by x% before marking as failure + if_ci_failed: ignore # require the CI to pass before setting the status + patch: + default: + target: 85% # specify the target coverage for each commit status + # option: "auto" (compare against parent commit or pull request base) + # option: "X%" a static target percentage to hit + threshold: 0% # allow the coverage drop by x% before marking as failure +comment: + layout: "header, files, footer" + hide_project_coverage: false +codecov: + require_ci_to_pass: false \ No newline at end of file