From da4a9fcc218bea029f21fead63a4e8e9281e514f Mon Sep 17 00:00:00 2001 From: Gonzalo Martinez Lema Date: Sun, 3 Nov 2024 18:13:55 +0100 Subject: [PATCH] Extract coverage report into its own workflow For now I keep the failure, to see how it works --- .github/workflows/coverage.yml | 41 ++++++++++++++++++++++++++++++++ .github/workflows/test_suite.yml | 20 +--------------- 2 files changed, 42 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/coverage.yml diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 000000000..535af3dd5 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -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 diff --git a/.github/workflows/test_suite.yml b/.github/workflows/test_suite.yml index 7e004c673..61fcde281 100644 --- a/.github/workflows/test_suite.yml +++ b/.github/workflows/test_suite.yml @@ -7,7 +7,7 @@ on: pull_request: jobs: - build: + build-and-test: strategy: fail-fast: false @@ -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