Skip to content

Add coverage report to GHA #255

Add coverage report to GHA

Add coverage report to GHA #255

Workflow file for this run

# This workflow will install IC and run all the tests with pytest
name: Test suite
on:
push:
pull_request:
jobs:
build:
strategy:
fail-fast: false
matrix:
python-version: [3.8]
#platform: [ubuntu-18.04, macos-latest]
platform: [ubuntu-20.04]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- name: Get LFS files
run: git lfs pull
# - name: Fix Conda permissions on macOS
# run: sudo chown -R $UID $CONDA
# if: runner.os == 'macOS'
- name: Install IC
run: |
source $CONDA/etc/profile.d/conda.sh
source manage.sh work_in_python_version_no_tests ${{ matrix.python-version }}
# - name: Run tests
# run: |
# 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 invisible_cities/types
coverage report -m > coverage_report
echo "Showing only files with coverage < 100%"
head -2 coverage_report
FAIL=0
head -n -2 coverage_report | tail -n +3 | grep -v "100%" | while read line; do
FAIL=1
printf '\033[0;31m%s\033[0m' "$line" # red color ... reset color
done
tail -2 coverage_report
$FAIL