Update README. #473
Workflow file for this run
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: test | |
on: | |
push: | |
pull_request: | |
jobs: | |
# First, check if the types/formatting is correct. | |
types-and-linting: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
architecture: x64 | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install flake8 black mypy | |
python -m pip install -r requirements.txt | |
- name: Lint with Black | |
uses: rickstaa/action-black@v1 | |
with: | |
black_args: ". --check" | |
- name: Check types | |
run: | | |
mypy balm | |
- name: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 balm --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
flake8 balm --ignore=E203,W503,C901 --select=C,E,F,W,B,B950 --max-line-length=127 --statistics --count --max-complexity=10 | |
doctests: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
needs: [types-and-linting] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install clingo | |
run: sudo apt-get -y install gringo | |
- name: Install Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
architecture: x64 | |
- name: Fetch and install native Pint | |
run: | | |
wget https://github.com/pauleve/pint/releases/download//2019-05-24/pint_2019-05-24_amd64.deb | |
sudo apt install ./pint_2019-05-24_amd64.deb | |
- name: Fetch and install Mole | |
run: | | |
wget http://www.lsv.fr/~schwoon/tools/mole/mole-140428.tar.gz | |
tar -xvf mole-140428.tar.gz | |
(cd ./mole-140428 && make) | |
(cd ./mole-140428 && pwd >> $GITHUB_PATH) | |
- name: Install repo dependencies | |
run: pip install -r requirements.txt | |
- name: Run doctests | |
run: python -m doctest balm/*.py | |
# Then do a "small" test run with code coverage. | |
coverage: | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
needs: [types-and-linting, doctests] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install clingo | |
run: sudo apt-get -y install gringo | |
- name: Install Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
architecture: x64 | |
- name: Fetch and install native Pint | |
run: | | |
wget https://github.com/pauleve/pint/releases/download//2019-05-24/pint_2019-05-24_amd64.deb | |
sudo apt install ./pint_2019-05-24_amd64.deb | |
- name: Fetch and install Mole | |
run: | | |
wget http://www.lsv.fr/~schwoon/tools/mole/mole-140428.tar.gz | |
tar -xvf mole-140428.tar.gz | |
(cd ./mole-140428 && make) | |
(cd ./mole-140428 && pwd >> $GITHUB_PATH) | |
- name: Install repo dependencies | |
run: pip install -r requirements.txt | |
- name: Install pytest | |
run: pip install pytest pytest-cov | |
- name: Run pytest with coverage | |
run: python3 -m pytest --networksize 20 --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=balm tests/ | tee pytest-coverage.txt | |
- name: Pytest coverage comment | |
uses: MishaKav/pytest-coverage-comment@main | |
with: | |
pytest-coverage-path: ./pytest-coverage.txt | |
junitxml-path: ./pytest.xml | |
# Then do a full test for correctness using larger networks. | |
tests: | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
needs: [types-and-linting, doctests, coverage] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install clingo | |
run: sudo apt-get -y install gringo | |
- name: Install Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
architecture: x64 | |
- name: Fetch and install native Pint | |
run: | | |
wget https://github.com/pauleve/pint/releases/download//2019-05-24/pint_2019-05-24_amd64.deb | |
sudo apt install ./pint_2019-05-24_amd64.deb | |
- name: Fetch and install Mole | |
run: | | |
wget http://www.lsv.fr/~schwoon/tools/mole/mole-140428.tar.gz | |
tar -xvf mole-140428.tar.gz | |
(cd ./mole-140428 && make) | |
(cd ./mole-140428 && pwd >> $GITHUB_PATH) | |
- name: Install repo dependencies | |
run: pip install -r requirements.txt | |
- name: Install pytest | |
run: pip install pytest | |
- name: Run pytest (without coverage) | |
run: python3 -m pytest --networksize 30 tests/ |