Skip to content

Add pytest runner mode #157

Add pytest runner mode

Add pytest runner mode #157

Workflow file for this run

name: Tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
tests:
name: tests-python${{ matrix.python-version }}-${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
os: ["macOS-latest", "ubuntu-latest", "windows-latest"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Pip cache
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-tests-${{ hashFiles('setup.py','requirements-dev.txt','constraints.txt') }}
restore-keys: |
${{ runner.os }}-${{ matrix.python-version }}-pip-tests-
${{ runner.os }}-${{ matrix.python-version }}-pip-
${{ runner.os }}-${{ matrix.python-version }}
- name: Install Deps
run: python -m pip install -U 'tox<4' setuptools virtualenv wheel
- name: Install and Run Tests
run: tox -e py
if: runner.os != 'macOS'
- name: Install and run tests macOS
run: |
tox -epy --notest
.tox/py/bin/pip install gnureadline
tox -epy
if: runner.os == 'macOS'
pytest:
name: test-pytest-${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["macOS-latest", "ubuntu-latest", "windows-latest"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Pip cache
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-tests-${{ hashFiles('setup.py','requirements-dev.txt','constraints.txt') }}
restore-keys: |
${{ runner.os }}-${{ matrix.python-version }}-pip-tests-
${{ runner.os }}-${{ matrix.python-version }}-pip-
${{ runner.os }}-${{ matrix.python-version }}
- name: Install Deps
run: python -m pip install -U 'tox<4' setuptools virtualenv wheel
- name: Install and Run Tests
run: tox -e py -- --pytest
if: runner.os != 'macOS'
- name: Install and run tests macOS
run: |
tox -epy --notest
.tox/py/bin/pip install gnureadline
tox -epy -- --pytest
if: runner.os == 'macOS'
lint:
name: pep8
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Pip cache
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-lint-${{ hashFiles('setup.py','requirements-dev.txt','constraints.txt') }}
restore-keys: |
${{ runner.os }}-${{ matrix.python-version }}-pip-lint-
${{ runner.os }}-${{ matrix.python-version }}-pip-
${{ runner.os }}-${{ matrix.python-version }}-
- name: Install Deps
run: python -m pip install -U 'tox<4'
- name: Run lint
run: tox -epep8
cover:
name: cover
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Pip cache
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-lint-${{ hashFiles('setup.py','requirements-dev.txt','constraints.txt') }}
restore-keys: |
${{ runner.os }}-${{ matrix.python-version }}-pip-lint-
${{ runner.os }}-${{ matrix.python-version }}-pip-
${{ runner.os }}-${{ matrix.python-version }}-
- name: Install Deps
run: python -m pip install -U 'tox<4'
- name: Run coverxml
run: tox -ecoverxml
- name: codecov
uses: codecov/codecov-action@v3
with:
files: ./cover/coverage.xml # optional
flags: unittests # optional
name: stestr # optional
fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)
docs:
name: docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Pip cache
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-docs-${{ hashFiles('setup.py','requirements-dev.txt','constraints.txt') }}
restore-keys: |
${{ runner.os }}-pip-docs-
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install Deps
run: python -m pip install -U 'tox<4'
- name: Build Docs
run: tox -edocs
- uses: actions/upload-artifact@v3
with:
name: html_docs
path: docs/_build