CI #31
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: CI | |
# Notes: | |
# - The os job installs phmutest in a virtual environment. | |
# - The coverage job installs phmutest dependencies, but does | |
# not install phmutest. It imports phmutest from the checked | |
# out src folder set by the environment variable PYTHONPATH. | |
# - The inspect job installs phmutest. | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
- 'main' | |
paths-ignore: | |
- '.github/workflows/publish.yml' | |
- '.github/workflows/wheel.yml' | |
jobs: | |
os: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.x | |
uses: actions/setup-python@v4 | |
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 | |
python -m pip install --no-deps "." | |
python -m pip install -r tests/requirements.txt | |
- name: Tests | |
run: | | |
pytest -vv tests | |
versions: | |
needs: os | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [ "pypy-3.10", "3.8", "3.9", "3.10", "3.11"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install | |
run: | | |
python -m pip install --upgrade pip | |
pip install --no-deps "." | |
pip install -r tests/requirements.txt | |
pip freeze | |
- name: Test suite | |
run: | | |
pytest -vv tests | |
- name: Usage tests | |
run: | | |
# Run some examples. Just check for success. | |
phmutest --version | |
phmutest docs/advanced/skip.md --log | |
phmutest docs/advanced/skipif.md --log | |
phmutest docs/advanced/label.md --log | |
phmutest docs/advanced/labelanyfcb.md --log | |
phmutest tests/md/optionflags.md --log --replmode --fixture tests.test_patching.setflags | |
phmutest docs/fix/code/globdemo.md --fixture docs.fix.code.globdemo.init_globals --log | |
phmutest tests/md/project.md --report | |
inspect: | |
needs: versions | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Install phmutest | |
run: | | |
python -m pip install --upgrade pip | |
pip install --no-deps "." | |
pip install -r requirements.txt | |
pip install -r tests/requirements_inspect.txt | |
pip install trove-classifiers | |
pip freeze | |
- name: Isort | |
run: | | |
isort - | |
- name: Formatting | |
# Show reformatting changes. | |
# Make the changes. | |
# Subsequent steps run with the modified files. | |
# Don't run black on the generated test files. | |
run: | | |
black **/*.py --check --force-exclude="tests/py" | |
black **/*.py --force-exclude="tests/py" | |
continue-on-error: true | |
- name: Code Style | |
run: | | |
flake8 --exit-zero --max-complexity=10 | |
- name: Type Hints | |
run: | | |
mypy src/phmutest --strict | |
mypy tests/test_type_packaging.py --strict | |
continue-on-error: true | |
- name: Deployable | |
run: | | |
python tests/check_classifiers.py | |
- name: Docs | |
run: | | |
python docs/premkdocs.py | |
mkdocs build | |
- name: Upload mkdocs site | |
uses: actions/upload-artifact@v3 | |
with: | |
name: site | |
path: site | |
retention-days: 5 | |
coverage: | |
needs: inspect | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.x | |
id: setuppython | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.x | |
- name: Install phmutest | |
run: | | |
python -m pip install --upgrade pip | |
pip install coverage | |
pip install -r tests/requirements.txt | |
pip freeze | |
- name: Tests, coverage report | |
run: | | |
coverage erase | |
coverage run --branch --source=src -m phmutest --version | |
coverage run --branch --source=src --append -m phmutest README.md --report | |
coverage run --branch --source=src --append -m phmutest README.md | |
coverage run --branch --source=src --append -m pytest -vv tests | |
coverage report --show-missing | |
coverage xml | |
env: | |
PYTHONPATH: ${{ github.workspace }}/src | |
continue-on-error: true | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./coverage.xml # optional | |
flags: pytest,python-${{ steps.setuppython.outputs.python-version }},ubuntu-latest # optional | |
name: codecov-umbrella # optional | |
fail_ci_if_error: false # optional (default = false) | |
verbose: true # optional (default = false) |