Merge pull request #8 from harryhaller001/dev #41
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: Package testing | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
# Run action when pull request is opened | |
pull_request: | |
types: [opened, reopened, synchronize] | |
# Jobs | |
jobs: | |
build: | |
# Run on ubuntu latest | |
runs-on: ubuntu-latest | |
# Matrix testing | |
strategy: | |
matrix: | |
# Check for all python versions >=3.8 | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# Install dependencies from freeze | |
- name: Install dependencies | |
run: | | |
sudo apt-get install -y graphviz | |
python -m pip install --upgrade pip | |
pip install mypy flake8 pytest coverage twine setuptools types-requests responses flit | |
pip install requests scipy pydot pandas | |
# Linting package | |
- name: Lint | |
run: | | |
flake8 --max-line-length 120 ./keggtools | |
flake8 --max-line-length 120 ./test/*.py | |
# Install package from setup.py and static code analysis | |
- name: Static code analysis | |
run: | | |
mypy ./test | |
mypy ./keggtools | |
# Run unittest on installed package | |
- name: Unit testing with pytest | |
run: | | |
pytest ./test --show-capture=log | |
# Build wheel and egg with flit backend | |
- name: Build package | |
run: | | |
flit build --setup-py | |
twine check --strict ./dist/* | |
flit install | |
# Test and build the docs for keggtools | |
- name: test and build docs | |
run: | | |
pip install Sphinx furo | |
mypy ./docs/conf.py | |
flake8 --max-line-length 120 ./docs/conf.py | |
python -m sphinx -M doctest ./docs ./docs/_build | |
python -m sphinx -M coverage ./docs ./docs/_build | |
python -m sphinx -M html ./docs ./docs/_build | |