From 99078f02e9b12aafa21b543b18f229a96996ff52 Mon Sep 17 00:00:00 2001 From: Ryan McGinty Date: Fri, 20 Dec 2024 22:49:04 -0800 Subject: [PATCH] Add Codecov integration and update GitHub Actions workflow --- .github/workflows/build.yml | 19 +++++++++++++++++++ README.md | 1 + codecov.yml | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+) create mode 100644 codecov.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 417f5ac..998681e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,6 +9,8 @@ on: branches: [ main ] paths-ignore: - '**/_version.py' + workflow_dispatch: + jobs: test: @@ -35,3 +37,20 @@ jobs: run: | make release shell: bash + - name: Upload coverage reports + if: | + ${{ + success() + && ( + (github.event_name == 'pull_request' && github.base_ref == 'main') + || (github.event_name == 'push' && github.ref_name == 'main') + || github.event_name == 'workflow_dispatch' + ) + && matrix.python-version == '3.11' + }} + uses: codecov/codecov-action@v5 + with: + # https://github.com/codecov/codecov-action#arguments + token: ${{ secrets.CODECOV_TOKEN }} + env_vars: PYTHON_VERSION + diff --git a/README.md b/README.md index 0763285..963087f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # AIBS Informatics AWS Lambda [![Build Status](https://github.com/AllenInstitute/aibs-informatics-aws-lambda/actions/workflows/build.yml/badge.svg)](https://github.com/AllenInstitute/aibs-informatics-aws-lambda/actions/workflows/build.yml) +[![codecov](https://codecov.io/gh/AllenInstitute/aibs-informatics-aws-lambda/graph/badge.svg?token=SEHNFMIX4G)](https://codecov.io/gh/AllenInstitute/aibs-informatics-aws-lambda) --- diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..a6bc968 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,34 @@ +codecov: + bot: aibsgithub + +coverage: + range: 0..100 + status: + project: + default: + target: auto # auto compares coverage to the previous base commit + informational: true + patch: + default: + informational: true + +comment: + layout: "reach, diff, flags, files" + behavior: default + require_changes: false # if true: only post the comment if coverage changes + require_head: yes # [yes :: must have a head report to post] + require_base: no # default yes + +github_checks: + # set to true in future perhaps? + annotations: false + +flag_management: + default_rules: # the rules that will be followed for any flag added, generally + carryforward: true + statuses: + - type: project + target: auto + threshold: 1% + - type: patch + target: 90% \ No newline at end of file