Font license #134
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: Python Build | |
on: | |
pull_request: | |
branches: | |
- develop | |
jobs: | |
build-linux: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies/Build/Test | |
run: | | |
pip install pytest | |
pip install pytest-cov | |
pip install -e . | |
pytest --cov=src/Models | |
build: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' # Specify the Python version you need | |
- name: Install dependencies and build project | |
run: | | |
pip install pytest | |
pip install pytest-cov | |
pip install -e . | |
- name: Install xmlstarlet | |
run: brew install xmlstarlet | |
- name: Get current and previous coverage | |
run: | | |
pytest --cov=src/Models --cov-report xml:current.xml | |
git checkout HEAD^ | |
pytest --cov=src/Models --cov-report xml:previous.xml | |
git checkout - | |
- name: Compare coverage | |
run: | | |
current_coverage=$(xml sel -t -v "/coverage/@line-rate" current.xml) | |
previous_coverage=$(xml sel -t -v "/coverage/@line-rate" previous.xml) | |
echo "Current coverage: $current_coverage" | |
echo "Previous coverage: $previous_coverage" | |
if (( $(echo "$current_coverage < $previous_coverage" | bc -l) )); then | |
echo "Code coverage decreased from previous commit." | |
exit 1 | |
fi | |
- name: View Pytest Results | |
run: | |
pytest --cov=src/Models |