debug ci #648
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Calculate code coverage | |
on: [push] | |
jobs: | |
pytest_coverage: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: 3.10.6 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libopenblas-dev | |
sudo apt-get install libxml2-utils | |
python -m pip install --upgrade pip | |
pip install numpy==1.23.3 | |
pip install scipy==1.8.1 | |
pip install scikit-learn==1.2.2 | |
pip install pandas | |
pip install pytest | |
pip install pytest-cov | |
pip install gcovr | |
pip install wheel | |
pip install libsvmdata | |
- name: Install the package your testing. | |
run: | | |
export COVERAGE=1 | |
pip install --no-build-isolation . | |
- name: Move conflicting folder | |
run: | | |
mv cyanure_lib cyanure_lib_tmp | |
- name: Get coverage | |
# fail_if_regression_in_coverage | |
run: | | |
pytest --cov-config=.coveragec --cov=cyanure --cov-report xml:coverage.xml | |
PYTHON_COVERAGE=$( xmllint --xpath 'string(/coverage/@line-rate)' coverage.xml) | |
echo $PYTHON_COVERAGE | |
test=$(echo "$PYTHON_COVERAGE < 0.8" | bc) | |
if ((test)); then echo "Failed because of python coverage";exit 1; fi | |
- name: Move coverage file folder | |
run: | | |
mv cyanure_lib_tmp cyanure_lib | |
mv build/temp.linux-x86_64-cpython-310/cyanure_lib/cyanure_wrap_module.gcno ./ | |
mv build/temp.linux-x86_64-cpython-310/cyanure_lib/cyanure_wrap_module.gcda ./ | |
gcovr -r ./ . --cobertura coverage_cxx.xml | |
CXX_COVERAGE=$( xmllint --xpath 'string(/coverage/@line-rate)' coverage_cxx.xml) | |
test_cxx=$(echo "$CXX_COVERAGE < 0.1" | bc) | |
if ((test_cxx)); then echo "Failed because of cxx coverage";exit 1; fi | |