add coverage.yml #4
Workflow file for this run
This file contains hidden or 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: CodeCoverage | |
| on: [push, pull_request, workflow_dispatch] | |
| jobs: | |
| run: | |
| runs-on: [ubuntu-24.04] | |
| strategy: | |
| matrix: | |
| python-versions: ['3.12'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-versions }} | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python-versions }} | |
| - name: setup | |
| run: | | |
| sudo apt update && sudo apt install --yes \ | |
| libcdd-dev \ | |
| libgmp-dev \ | |
| numdiff \ | |
| texlive \ | |
| texlive-latex-extra | |
| python -m pip install --upgrade pip | |
| pip install pycddlib autograd # this is optional | |
| pip install coverage | |
| python --version | |
| - name: Generate Report | |
| run: | | |
| python -m pip install git+https://github.com/geodynamics/burnman@main | |
| coverage run -m unittest discover ./tests | |
| main_coverage=$(coverage report --precision=7 --format=total) | |
| python -m pip install -q -e .[dev] | |
| coverage run -m unittest discover ./tests | |
| coverage report | |
| new_coverage=$(coverage report --precision=7 --format=total) | |
| echo "Main coverage: $main_coverage" | |
| echo "New coverage: $new_coverage" | |
| if (( $(echo "$new_coverage < $main_coverage" | bc -l) )); then | |
| echo "Coverage decreased relative to main" | |
| exit 1 | |
| fi |