CI #57
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: | |
pull_request: | |
push: | |
branches: | |
- 'main' | |
paths-ignore: | |
- '.github/workflows/publish.yml' | |
- '.github/workflows/wheel.yml' | |
jobs: | |
version37: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.7 | |
- 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 | |
versions: | |
needs: version37 | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.10"] | |
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 | |
- name: README.md examples | |
run: | | |
pip install phmutest | |
phmutest README.md --log | |
phmutest README.md --log --replmode | |
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 install phmutest | |
pip freeze | |
- name: Coverage test | |
run: | | |
coverage run --branch --source=monotable -m pytest -v test | |
coverage run --branch --source=monotable --append -m phmutest README.md --log --summary | |
coverage run --branch --source=monotable --append -m phmutest README.md --log --summary --replmode | |
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 # monotable | |
- uses: actions/checkout@v4 # test_tool | |
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: 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 |