Skip to content

Update .coveragerc #350

Update .coveragerc

Update .coveragerc #350

Workflow file for this run

name: pr-validation
# Controls when the workflow will run
on:
push:
branches:
- main
pull_request:
paths-ignore:
- 'experiments/**' # if only the exps are modified, no need to run it
- 'docs/**' # if only the docs are modified, no need to run it
schedule:
# Every monday at 3h30 UTC
- cron: '30 3 * * 1'
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
verify_windows_setup:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ windows-2019 ]
python: [ "3.9" ]
steps:
- uses: actions/checkout@v3
with:
# Do not checkout in the current working directory to ensure the further imported module is the installed one
path: anywhere
- name: Install miniconda
uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python }}
activate-environment: fedeca
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e "./anywhere/[all_extra]"
- name: Test import successful
run: |
python -c "import fedeca"
pip list
run_tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
python: ["3.9"]
# python: ["3.9", "3.10", "3.11"] # TODO: expand to other pythons
steps:
- uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[all_extra]"
- name: Testing with pytest
run: |
coverage run -m pytest -v fedeca
- name: Generate code coverage report
run: |
coverage html
- name: Upload coverage artifacts
uses: actions/upload-artifact@v4
with:
name: test-coverage-report
path: htmlcov/
retention-days: 20
- name: Generate coverage status badge
if: github.event_name == 'pull_request'
run: |
set -x
total_cov=`grep -Eo '<span class="pc_cov">[0-9]+%</span>' htmlcov/index.html | grep -oe '\([0-9.]*\)'`
echo $total_cov
if [ "$total_cov" -le "50" ] ; then
COLOR=red
elif [ "$total_cov" -ge "90" ] ; then
COLOR=green
else
COLOR=orange
fi
echo $COLOR
echo "https://img.shields.io/badge/coverage-${total_cov}%25-${COLOR}"
curl "https://img.shields.io/badge/coverage-${total_cov}%25-${COLOR}" > badges/cov_badge.svg
echo "" >> badges/cov_badge.svg
- name: Commit coverage badge
if: github.event_name == 'pull_request'
uses: EndBug/add-and-commit@v9
with:
add: badges/cov_badge.svg
default_author: github_actor
pull: "--no-rebase"
message: "update coverage badge"