Skip to content

CONTRIBUTING.md, README.md: Update documentation for contributors #492

CONTRIBUTING.md, README.md: Update documentation for contributors

CONTRIBUTING.md, README.md: Update documentation for contributors #492

Workflow file for this run

# actions can be run locally using act and docker, on Fedora 37 also with podman, using:
# https://github.com/nektos/act
# sudo dnf install -y act-cli podman-docker
# act --bind --container-daemon-socket $XDG_RUNTIME_DIR/podman/podman.sock -W .github/workflows/main.yml
name: Unit tests
# Checks can be skipped by adding "skip-checks: true" to a commit message,
# or requested by adding "request-checks: true" if disabled by default for pushes:
# https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/about-status-checks#skipping-and-requesting-checks-for-individual-commits
on: [push, pull_request]
env:
PYTHONWARNINGS: "ignore:DEPRECATION"
PIP_ROOT_USER_ACTION: "ignore" # For local testing using act-cli
PIP_NO_WARN_SCRIPT_LOCATION: "0" # For local testing using act-cli
PIP_DISABLE_PIP_VERSION_CHECK: "1" # Reduce noise in logs
jobs:
test:
strategy:
# See: https://github.com/xenserver/python-libs/pull/26#discussion_r1179482169
# max-parallel: 1
# Want to get the results of all the tests, don't terminate all on a fail:
fail-fast: false
matrix:
include:
- python-version: '3.11'
os: ubuntu-22.04
# This tests with Python 2.7 and the stock Python 3.10 for combined py2+3 coverage:
- python-version: '2.7'
os: ubuntu-22.04
- python-version: '3.8'
os: ubuntu-22.04
- python-version: '3.6'
os: ubuntu-22.04
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Needed by diff-cover to get the changed lines: origin/master..HEAD
- name: Set up Python ${{ matrix.python-version }}
# setup-python stopped supporting Python 2.7, use https://github.com/MatteoH2O1999/setup-python
# This action tries to build all Python versions that actions/setup-python does not support.
# It caches built versions, so that after the first run, installation time is really low.
uses: MatteoH2O1999/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
allow-build: info
cache-build: true
cache: pip
- name: Run of tox on ubuntu-latest
if: ${{ startsWith(matrix.python-version, '3.') && matrix.python-version != 3.6 }}
run: |
pip install 'virtualenv<20.22' 'tox>=4.5.1' tox-gh-actions
tox --workdir .github/workflows/.tox --recreate
# tox >= 4.0.0 is needed for using optional-dependencies from pyproject.toml, which is
# is not available for python <= 3.6, so use the python3.8 of Ubuntu-20.04 to install it:
- name: Install of tox on ubuntu-22.04 (to support optional-dependencies from pyproject.toml)
if: ${{ matrix.python-version == 2.7 || matrix.python-version == 3.6 }}
run: |
set -xv;curl -sSL https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3.10 get-pip.py
python3.10 -m pip install 'virtualenv<20.22' 'tox>=4.5.1' tox-gh-actions
- name: Run tox4 with Python 3.10(to support optional-dependencies from pyproject.toml) for Python3.6
if: ${{ matrix.python-version == 3.6 }}
run: tox --workdir .github/workflows/.tox --recreate -e py36-lint
- name: Generate combined test-coverage with Python 2.7 and 3.10 for Upload
if: ${{ matrix.python-version == 2.7 }}
run: tox --workdir .github/workflows/.tox --recreate -e py310-covcombine-check
- name: Upload coverage reports to Codecov
if: ${{ matrix.python-version == 2.7 }}
uses: codecov/codecov-action@v3
with:
directory: .github/workflows/.tox/py310-covcombine-check/log
env_vars: OS,PYTHON
fail_ci_if_error: true
flags: unittest
name: py27-py38-combined
verbose: true