CI #49
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: CI | |
on: | |
workflow_dispatch: | |
# push: | |
# paths-ignore: | |
# - .github/workflows/deploy.yml | |
pull_request: | |
branches: [develop] | |
paths-ignore: | |
- .github/workflows/deploy.yml | |
jobs: | |
versions: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] # todo- pypy | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install --no-deps "." | |
pip install -r test/requirements.txt | |
pip freeze | |
- name: pytest | |
run: | | |
pytest -v test | |
os: | |
needs: versions | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.x | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.x | |
- name: Windows Venv | |
run: | | |
python -m venv ${{ github.workspace }}\env | |
${{ github.workspace }}\env\Scripts\Activate.ps1 | |
python -m pip --version | |
if: startswith(runner.os, 'Windows') | |
- name: Linux/macOS Venv | |
run: | | |
python -m venv ${{ github.workspace }}/env | |
source ${{ github.workspace }}/env/bin/activate | |
python -m pip --version | |
if: startswith(runner.os, 'Linux') || startswith(runner.os, 'macOS') | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install --no-deps "." | |
pip install -r test/requirements.txt | |
pip freeze | |
- name: pytest | |
run: | | |
pytest -v test | |
coverage: | |
needs: os | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.x | |
id: setuppython | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.x | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r test/requirements.txt | |
pip freeze | |
- name: Coverage test | |
run: | | |
coverage run --branch --source=monotable -m pytest -v test | |
coverage report --show-missing | |
coverage xml | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
if: success() && ((github.ref == 'refs/heads/master') || (github.ref == 'refs/heads/develop')) | |
continue-on-error: true | |
with: | |
file: coverage.xml | |
flags: pytest,python-${{ steps.setuppython.outputs.python-version }},ubuntu-latest | |
fail_ci_if_error: false | |
token: ${{ secrets.CODECOV_TOKEN }} | |
inspect: | |
needs: coverage | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
repository: tmarktaylor/pytest-phmdoctest | |
ref: v1.0.0 | |
path: .test_tool | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.x | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r test/requirements_inspect.txt | |
pip install trove-classifiers | |
pip freeze | |
#- name: Formatting | |
# todo- Show reformatting changes. | |
# Make the changes. | |
# Subsequent steps run with the modified files. | |
#run: | | |
# black --diff --color "." | |
# black "." | |
# continue-on-error: true | |
- name: Code Style | |
run: | | |
flake8 --exit-zero --max-complexity=10 | |
- name: Type Hints | |
# requires Python>=3.10 | |
run: | | |
mypy monotable --strict | |
mypy test/test_examples.py --strict | |
continue-on-error: true | |
- name: Deployable | |
run: | | |
python .test_tool/tests/check_classifiers.py | |
check-manifest -v | |
python -m build | |
twine check dist/* | |
docs: | |
needs: inspect | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
# This should be the same as in .readthedocs.yml | |
python-version: 3.x | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install sphinx | |
pip install sphinx_rtd_theme | |
pip freeze | |
- name: Sphinx build | |
run: | | |
mkdir docbuild | |
sphinx-build -b doctest -d docbuild/doctrees . docbuild/doctest | |
sphinx-build -b html -d docbuild/doctrees . docbuild/html | |
working-directory: doc | |
- name: Upload docs | |
uses: actions/upload-artifact@v4 | |
with: | |
name: docs | |
path: doc/docbuild/html | |
retention-days: 5 |