Skip to content

Commit

Permalink
Extract coverage report into its own workflow
Browse files Browse the repository at this point in the history
For now I keep the failure, to see how it works
  • Loading branch information
gonzaponte committed Nov 3, 2024
1 parent 38d30af commit da4a9fc
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 19 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# This workflow will install IC and run all the tests with pytest

name: Test suite

on:
pull_request:

jobs:
check-coverage:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Get LFS files
run: git lfs pull

- name: Install IC
run: |
source $CONDA/etc/profile.d/conda.sh
source manage.sh work_in_python_version_no_tests ${{ matrix.python-version }}
- name: Produce coverage report
run: |
source $CONDA/etc/profile.d/conda.sh
source manage.sh work_in_python_version_no_tests ${{ matrix.python-version }}
coverage run -m pytest
coverage report -m > coverage_report
- name: Check coverage report
run: |
echo "Showing only files with coverage < 100%"
head -2 coverage_report
FAIL=0
incomplete_coverage=$(head -n -2 coverage_report | tail -n +3 | grep -v "100%")
while read line; do
FAIL=1
printf '\033[0;31m%s\033[0m\n' "$line" # red color ... reset color
done <<<${incomplete_coverage}
tail -2 coverage_report
exit $FAIL
20 changes: 1 addition & 19 deletions .github/workflows/test_suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
pull_request:

jobs:
build:
build-and-test:

strategy:
fail-fast: false
Expand Down Expand Up @@ -35,21 +35,3 @@ jobs:
source $CONDA/etc/profile.d/conda.sh
source manage.sh work_in_python_version_no_tests ${{ matrix.python-version }}
PYTEST_ADDOPTS=--color=yes HYPOTHESIS_PROFILE=travis-ci bash manage.sh run_tests_par
- name: Check code coverage
run: |
source $CONDA/etc/profile.d/conda.sh
source manage.sh work_in_python_version_no_tests ${{ matrix.python-version }}
coverage run -m pytest
coverage report -m > coverage_report
echo "Showing only files with coverage < 100%"
head -2 coverage_report
FAIL=0
incomplete_coverage=$(head -n -2 coverage_report | tail -n +3 | grep -v "100%")
while read line; do
FAIL=1
printf '\033[0;31m%s\033[0m\n' "$line" # red color ... reset color
done <<<${incomplete_coverage}
tail -2 coverage_report
exit $FAIL

0 comments on commit da4a9fc

Please sign in to comment.