Start running tests against Py3.11 and Pytest 7.3.x
and 7.4.x
#90
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: [push, pull_request] | |
jobs: | |
Pre-Commit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Set Cache Key | |
run: echo "PY=$(python --version --version | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV | |
- name: Install System Deps | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libxml2 libxml2-dev libxslt-dev | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pre-commit | |
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} | |
- uses: pre-commit/action@v1.0.1 | |
Twine-Check: | |
runs-on: ubuntu-latest | |
needs: Pre-Commit | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Install Nox | |
run: | | |
python -m pip install --upgrade pip | |
pip install nox | |
- name: Twine check | |
run: | | |
nox -e twine-check | |
PyLint: | |
runs-on: ubuntu-latest | |
needs: Pre-Commit | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.9 For Nox | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Install Nox | |
run: | | |
python -m pip install --upgrade pip | |
pip install nox | |
- name: Install Lint Requirements | |
run: | | |
nox --force-color -e lint --install-only | |
- name: Build Docs | |
env: | |
SKIP_REQUIREMENTS_INSTALL: YES | |
run: | | |
nox --force-color -e lint | |
Docs: | |
runs-on: ubuntu-latest | |
needs: Pre-Commit | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.9 For Nox | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Install Nox | |
run: | | |
python -m pip install --upgrade pip | |
pip install nox | |
- name: Install Doc Requirements | |
run: | | |
nox --force-color -e docs --install-only | |
- name: Build Docs | |
env: | |
SKIP_REQUIREMENTS_INSTALL: YES | |
run: | | |
nox --force-color -e docs | |
Linux: | |
runs-on: ubuntu-latest | |
needs: Pre-Commit | |
timeout-minutes: 15 | |
strategy: | |
fail-fast: false | |
max-parallel: 4 | |
matrix: | |
python-version: | |
- "3.7" | |
- "3.8" | |
- "3.9" | |
- "3.10" | |
- "3.11" | |
pytest-version: | |
- "~=7.1.0" | |
- "~=7.2.0" | |
- "~=7.3.0" | |
- "~=7.4.0" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Nox | |
run: | | |
python -m pip install --upgrade pip | |
pip install nox 'pytest${{ matrix.pytest-version }}' | |
- name: Install Test Requirements | |
env: | |
PYTEST_VERSION_REQUIREMENT: pytest${{ matrix.pytest-version }} | |
run: | | |
nox --force-color -e tests-3 --install-only | |
- name: Test | |
env: | |
SKIP_REQUIREMENTS_INSTALL: YES | |
run: | | |
nox --force-color -e tests-3 -- -vv tests/ | |
- name: Gather CodeCov Info | |
if: always() | |
id: codecov-info | |
run: | | |
echo name=flag-python-version::$(python -c "import sys; print('Py{}{}'.format(*sys.version_info))") >> $GITHUB_OUTPUT | |
echo name=flag-pytest-version::$(python -c "import pytest; print('PyTest{}{}'.format(*pytest.__version__.split('.')))") >> $GITHUB_OUTPUT | |
echo name=flag-runner-os::$(python -c "print('${{ runner.os }}'.replace('-latest', ''))") >> $GITHUB_OUTPUT | |
echo name=uploader-url::$(python -c "print('https://uploader.codecov.io/latest/codecov-linux')") >> $GITHUB_OUTPUT | |
echo name=uploader-name::$(python -c "print('codecov-linux')") >> $GITHUB_OUTPUT | |
- name: Create CodeCov Flags | |
if: always() | |
id: codecov | |
run: | | |
echo name=flags::$(python -c "print(','.join(['${{ steps.codecov-info.outputs.flag-runner-os }}', '${{ steps.codecov-info.outputs.flag-python-version }}', '${{ steps.codecov-info.outputs.flag-pytest-version }}']))") >> $GITHUB_OUTPUT | |
echo name=report-name::$(python -c "print('-'.join(['${{ steps.codecov-info.outputs.flag-runner-os }}', '${{ steps.codecov-info.outputs.flag-python-version }}', '${{ steps.codecov-info.outputs.flag-pytest-version }}']))") >> $GITHUB_OUTPUT | |
- name: Download Code Coverage Tool | |
if: always() | |
shell: bash | |
run: | | |
if [ "$(which curl)x" == "x" ]; then | |
echo "Failed to find the 'curl' binary" | |
exit 0 | |
fi | |
if [ "$(which gpg)x" == "x" ]; then | |
echo "Failed to find the 'gpg' binary" | |
exit 0 | |
fi | |
if [ "$(which shasum)x" == "x" ]; then | |
echo "Failed to find the 'shasum' binary" | |
exit 0 | |
fi | |
if [ ! -x codecov-linux ]; then | |
n=0 | |
until [ "$n" -ge 5 ] | |
do | |
if curl --max-time 30 -L ${{ steps.codecov-info.outputs.uploader-url }} --output ${{ steps.codecov-info.outputs.uploader-name }}; then | |
break | |
fi | |
n=$((n+1)) | |
sleep 15 | |
done | |
n=0 | |
until [ "$n" -ge 5 ] | |
do | |
if curl --max-time 30 -L ${{ steps.codecov-info.outputs.uploader-url }}.SHA256SUM --output ${{ steps.codecov-info.outputs.uploader-name }}.SHA256SUM; then | |
break | |
fi | |
n=$((n+1)) | |
sleep 15 | |
done | |
n=0 | |
until [ "$n" -ge 5 ] | |
do | |
if curl --max-time 30 -L ${{ steps.codecov-info.outputs.uploader-url }}.SHA256SUM.sig --output ${{ steps.codecov-info.outputs.uploader-name }}.SHA256SUM.sig; then | |
break | |
fi | |
n=$((n+1)) | |
sleep 15 | |
done | |
n=0 | |
until [ "$n" -ge 5 ] | |
do | |
if curl --max-time 30 -L https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --import; then | |
break | |
fi | |
n=$((n+1)) | |
sleep 15 | |
done | |
gpg --verify ${{ steps.codecov-info.outputs.uploader-name }}.SHA256SUM.sig ${{ steps.codecov-info.outputs.uploader-name }}.SHA256SUM && \ | |
shasum -a 256 -c ${{ steps.codecov-info.outputs.uploader-name }}.SHA256SUM && \ | |
chmod +x ${{ steps.codecov-info.outputs.uploader-name }} || exit 0 | |
fi | |
- name: Upload Project Code Coverage | |
if: always() | |
shell: bash | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
REPORT_FLAGS: ${{ steps.codecov-flags.outputs.flags }},src | |
REPORT_NAME: ${{ runner.os }}-Py${{ matrix.python-version }}-src | |
REPORT_PATH: artifacts/coverage-project.xml | |
run: | | |
if [ -x ${{ steps.codecov-info.outputs.uploader-name }} ]; then | |
n=0 | |
until [ "$n" -ge 5 ] | |
do | |
if ./${{ steps.codecov-info.outputs.uploader-name }} -R $(pwd) -n "${REPORT_NAME}" -f "${REPORT_PATH}" -F "${REPORT_FLAGS}"; then | |
break | |
fi | |
n=$((n+1)) | |
sleep 15 | |
done | |
fi | |
- name: Upload Tests Code Coverage | |
if: always() | |
shell: bash | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
REPORT_FLAGS: ${{ steps.codecov-flags.outputs.flags }},tests | |
REPORT_NAME: ${{ runner.os }}-Py${{ matrix.python-version }}-tests | |
REPORT_PATH: artifacts/coverage-tests.xml | |
run: | | |
if [ -x ${{ steps.codecov-info.outputs.uploader-name }} ]; then | |
n=0 | |
until [ "$n" -ge 5 ] | |
do | |
if ./${{ steps.codecov-info.outputs.uploader-name }} -R $(pwd) -n "${REPORT_NAME}" -f "${REPORT_PATH}" -F "${REPORT_FLAGS}"; then | |
break | |
fi | |
n=$((n+1)) | |
sleep 15 | |
done | |
fi | |
- name: Upload Logs | |
if: always() | |
uses: actions/upload-artifact@main | |
with: | |
name: runtests-${{ steps.codecov.outputs.report-name }}.log | |
path: artifacts/runtests-*.log | |
Windows: | |
runs-on: windows-latest | |
needs: Pre-Commit | |
timeout-minutes: 40 | |
strategy: | |
fail-fast: false | |
max-parallel: 5 | |
matrix: | |
python-version: | |
- "3.7" | |
- "3.8" | |
- "3.9" | |
- "3.10" | |
- "3.11" | |
pytest-version: | |
- "~=7.1.0" | |
- "~=7.2.0" | |
- "~=7.3.0" | |
- "~=7.4.0" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Nox | |
run: | | |
python -m pip install --upgrade pip | |
pip install nox 'pytest${{ matrix.pytest-version }}' | |
- name: Install Test Requirements | |
shell: bash | |
env: | |
PYTEST_VERSION_REQUIREMENT: pytest${{ matrix.pytest-version }} | |
run: | | |
export PATH="/C/Program Files (x86)/Windows Kits/10/bin/10.0.18362.0/x64;$PATH" | |
nox --force-color -e tests-3 --install-only | |
- name: Test | |
shell: bash | |
env: | |
SKIP_REQUIREMENTS_INSTALL: YES | |
run: | | |
export PATH="/C/Program Files (x86)/Windows Kits/10/bin/10.0.18362.0/x64;$PATH" | |
nox --force-color -e tests-3 -- -vv tests/ | |
- name: Gather CodeCov Info | |
if: always() | |
id: codecov-info | |
shell: bash | |
run: | | |
echo name=flag-python-version::$(python -c "import sys; print('Py{}{}'.format(*sys.version_info))") >> $GITHUB_OUTPUT | |
echo name=flag-pytest-version::$(python -c "import pytest; print('PyTest{}{}'.format(*pytest.__version__.split('.')))") >> $GITHUB_OUTPUT | |
echo name=flag-runner-os::$(python -c "print('${{ runner.os }}'.replace('-latest', ''))") >> $GITHUB_OUTPUT | |
echo name=uploader-url::$(python -c "print('https://uploader.codecov.io/latest/windows/codecov.exe')") >> $GITHUB_OUTPUT | |
echo name=uploader-name::$(python -c "print('codecov.exe')") >> $GITHUB_OUTPUT | |
- name: Create CodeCov Flags | |
if: always() | |
id: codecov | |
run: | | |
echo name=flags::$(python -c "print(','.join(['${{ steps.codecov-info.outputs.flag-runner-os }}', '${{ steps.codecov-info.outputs.flag-python-version }}', '${{ steps.codecov-info.outputs.flag-pytest-version }}']))") >> $GITHUB_OUTPUT | |
echo name=report-name::$(python -c "print('-'.join(['${{ steps.codecov-info.outputs.flag-runner-os }}', '${{ steps.codecov-info.outputs.flag-python-version }}', '${{ steps.codecov-info.outputs.flag-pytest-version }}']))") >> $GITHUB_OUTPUT | |
- name: Download Code Coverage Tool | |
if: always() | |
shell: powershell | |
run: | | |
If (-not(Test-Path -Path ./${{ steps.codecov-info.outputs.uploader-name }})) { | |
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls, [Net.SecurityProtocolType]::Tls11, [Net.SecurityProtocolType]::Tls12, [Net.SecurityProtocolType]::Ssl3 | |
[Net.ServicePointManager]::SecurityProtocol = "Tls, Tls11, Tls12, Ssl3" | |
$ProgressPreference = 'SilentlyContinue' | |
Invoke-WebRequest -Uri https://keybase.io/codecovsecurity/pgp_keys.asc -OutFile codecov.asc | |
gpg.exe --import codecov.asc | |
Invoke-WebRequest -Uri ${{ steps.codecov-info.outputs.uploader-url }} -Outfile ${{ steps.codecov-info.outputs.uploader-name }} | |
Invoke-WebRequest -Uri ${{ steps.codecov-info.outputs.uploader-url }}.SHA256SUM -Outfile ${{ steps.codecov-info.outputs.uploader-name }}.SHA256SUM | |
Invoke-WebRequest -Uri ${{ steps.codecov-info.outputs.uploader-url }}.SHA256SUM.sig -Outfile ${{ steps.codecov-info.outputs.uploader-name }}.SHA256SUM.sig | |
gpg.exe --verify ${{ steps.codecov-info.outputs.uploader-name }}.SHA256SUM.sig ${{ steps.codecov-info.outputs.uploader-name }}.SHA256SUM | |
If ($(Compare-Object -ReferenceObject $(($(certUtil -hashfile ${{ steps.codecov-info.outputs.uploader-name }} SHA256)[1], "${{ steps.codecov-info.outputs.uploader-name }}") -join " ") -DifferenceObject $(Get-Content ${{ steps.codecov-info.outputs.uploader-name }}.SHA256SUM)).length -eq 0) { | |
echo "SHASUM verified" | |
} Else { | |
exit 0 | |
} | |
} | |
- name: Upload Project Code Coverage | |
if: always() | |
shell: bash | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
REPORT_FLAGS: ${{ steps.codecov-flags.outputs.flags }},src | |
REPORT_NAME: ${{ runner.os }}-Py${{ matrix.python-version }}-src | |
REPORT_PATH: artifacts/coverage-project.xml | |
run: | | |
if [ -x ${{ steps.codecov-info.outputs.uploader-name }} ]; then | |
n=0 | |
until [ "$n" -ge 5 ] | |
do | |
if ./${{ steps.codecov-info.outputs.uploader-name }} -R $(pwd) -n "${REPORT_NAME}" -f "${REPORT_PATH}" -F "${REPORT_FLAGS}"; then | |
break | |
fi | |
n=$((n+1)) | |
sleep 15 | |
done | |
fi | |
- name: Upload Tests Code Coverage | |
if: always() | |
shell: bash | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
REPORT_FLAGS: ${{ steps.codecov-flags.outputs.flags }},tests | |
REPORT_NAME: ${{ runner.os }}-Py${{ matrix.python-version }}-tests | |
REPORT_PATH: artifacts/coverage-tests.xml | |
run: | | |
if [ -x ${{ steps.codecov-info.outputs.uploader-name }} ]; then | |
n=0 | |
until [ "$n" -ge 5 ] | |
do | |
if ./${{ steps.codecov-info.outputs.uploader-name }} -R $(pwd) -n "${REPORT_NAME}" -f "${REPORT_PATH}" -F "${REPORT_FLAGS}"; then | |
break | |
fi | |
n=$((n+1)) | |
sleep 15 | |
done | |
fi | |
- name: Upload Logs | |
if: always() | |
uses: actions/upload-artifact@main | |
with: | |
name: runtests-${{ steps.codecov.outputs.report-name }}.log | |
path: artifacts/runtests-*.log | |
macOS: | |
runs-on: macOS-latest | |
needs: Pre-Commit | |
timeout-minutes: 40 | |
strategy: | |
fail-fast: false | |
max-parallel: 5 | |
matrix: | |
python-version: | |
- "3.7" | |
- "3.8" | |
- "3.9" | |
- "3.10" | |
- "3.11" | |
pytest-version: | |
- "~=7.1.0" | |
- "~=7.2.0" | |
- "~=7.3.0" | |
- "~=7.4.0" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Nox | |
run: | | |
python -m pip install --upgrade pip | |
pip install nox 'pytest${{ matrix.pytest-version }}' | |
- name: Install Test Requirements | |
env: | |
PYTEST_VERSION_REQUIREMENT: pytest${{ matrix.pytest-version }} | |
run: | | |
nox --force-color -e tests-3 --install-only | |
- name: Test | |
env: | |
SKIP_REQUIREMENTS_INSTALL: YES | |
run: | | |
nox --force-color -e tests-3 -- -vv tests/ | |
- name: Gather CodeCov Info | |
if: always() | |
id: codecov-info | |
run: | | |
echo name=flag-python-version::$(python -c "import sys; print('Py{}{}'.format(*sys.version_info))") >> $GITHUB_OUTPUT | |
echo name=flag-pytest-version::$(python -c "import pytest; print('PyTest{}{}'.format(*pytest.__version__.split('.')))") >> $GITHUB_OUTPUT | |
echo name=flag-runner-os::$(python -c "print('${{ runner.os }}'.replace('-latest', ''))") >> $GITHUB_OUTPUT | |
echo name=uploader-url::$(python -c "print('https://uploader.codecov.io/latest/codecov-macos')") >> $GITHUB_OUTPUT | |
echo name=uploader-name::$(python -c "print('codecov-macos')") >> $GITHUB_OUTPUT | |
- name: Create CodeCov Flags | |
if: always() | |
id: codecov | |
run: | | |
echo name=flags::$(python -c "print(','.join(['${{ steps.codecov-info.outputs.flag-runner-os }}', '${{ steps.codecov-info.outputs.flag-python-version }}', '${{ steps.codecov-info.outputs.flag-pytest-version }}']))") >> $GITHUB_OUTPUT | |
echo name=report-name::$(python -c "print('-'.join(['${{ steps.codecov-info.outputs.flag-runner-os }}', '${{ steps.codecov-info.outputs.flag-python-version }}', '${{ steps.codecov-info.outputs.flag-pytest-version }}']))") >> $GITHUB_OUTPUT | |
- name: Download Code Coverage Tool | |
if: always() | |
shell: bash | |
run: | | |
if [ "$(which curl)x" == "x" ]; then | |
echo "Failed to find the 'curl' binary" | |
exit 0 | |
fi | |
if [ "$(which gpg)x" == "x" ]; then | |
echo "Failed to find the 'gpg' binary" | |
exit 0 | |
fi | |
if [ "$(which shasum)x" == "x" ]; then | |
echo "Failed to find the 'shasum' binary" | |
exit 0 | |
fi | |
if [ ! -x codecov-linux ]; then | |
n=0 | |
until [ "$n" -ge 5 ] | |
do | |
if curl --max-time 30 -L ${{ steps.codecov-info.outputs.uploader-url }} --output ${{ steps.codecov-info.outputs.uploader-name }}; then | |
break | |
fi | |
n=$((n+1)) | |
sleep 15 | |
done | |
n=0 | |
until [ "$n" -ge 5 ] | |
do | |
if curl --max-time 30 -L ${{ steps.codecov-info.outputs.uploader-url }}.SHA256SUM --output ${{ steps.codecov-info.outputs.uploader-name }}.SHA256SUM; then | |
break | |
fi | |
n=$((n+1)) | |
sleep 15 | |
done | |
n=0 | |
until [ "$n" -ge 5 ] | |
do | |
if curl --max-time 30 -L ${{ steps.codecov-info.outputs.uploader-url }}.SHA256SUM.sig --output ${{ steps.codecov-info.outputs.uploader-name }}.SHA256SUM.sig; then | |
break | |
fi | |
n=$((n+1)) | |
sleep 15 | |
done | |
n=0 | |
until [ "$n" -ge 5 ] | |
do | |
if curl --max-time 30 -L https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --import; then | |
break | |
fi | |
n=$((n+1)) | |
sleep 15 | |
done | |
gpg --verify ${{ steps.codecov-info.outputs.uploader-name }}.SHA256SUM.sig ${{ steps.codecov-info.outputs.uploader-name }}.SHA256SUM && \ | |
shasum -a 256 -c ${{ steps.codecov-info.outputs.uploader-name }}.SHA256SUM && \ | |
chmod +x ${{ steps.codecov-info.outputs.uploader-name }} || exit 0 | |
fi | |
- name: Upload Project Code Coverage | |
if: always() | |
shell: bash | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
REPORT_FLAGS: ${{ steps.codecov-flags.outputs.flags }},src | |
REPORT_NAME: ${{ runner.os }}-Py${{ matrix.python-version }}-src | |
REPORT_PATH: artifacts/coverage-project.xml | |
run: | | |
if [ -x ${{ steps.codecov-info.outputs.uploader-name }} ]; then | |
n=0 | |
until [ "$n" -ge 5 ] | |
do | |
if ./${{ steps.codecov-info.outputs.uploader-name }} -R $(pwd) -n "${REPORT_NAME}" -f "${REPORT_PATH}" -F "${REPORT_FLAGS}"; then | |
break | |
fi | |
n=$((n+1)) | |
sleep 15 | |
done | |
fi | |
- name: Upload Tests Code Coverage | |
if: always() | |
shell: bash | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
REPORT_FLAGS: ${{ steps.codecov-flags.outputs.flags }},tests | |
REPORT_NAME: ${{ runner.os }}-Py${{ matrix.python-version }}-tests | |
REPORT_PATH: artifacts/coverage-tests.xml | |
run: | | |
if [ -x ${{ steps.codecov-info.outputs.uploader-name }} ]; then | |
n=0 | |
until [ "$n" -ge 5 ] | |
do | |
if ./${{ steps.codecov-info.outputs.uploader-name }} -R $(pwd) -n "${REPORT_NAME}" -f "${REPORT_PATH}" -F "${REPORT_FLAGS}"; then | |
break | |
fi | |
n=$((n+1)) | |
sleep 15 | |
done | |
fi | |
- name: Upload Logs | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: runtests-${{ steps.codecov.outputs.report-name }}.log | |
path: artifacts/runtests-*.log | |
Build: | |
runs-on: ubuntu-latest | |
needs: | |
- Docs | |
- PyLint | |
- Twine-Check | |
- Linux | |
- Windows | |
- macOS | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Install Nox | |
run: | | |
python -m pip install nox | |
- name: Build a binary wheel and a source tarball | |
run: | | |
nox -e build | |
- name: Publish distribution 📦 to Test PyPI | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.TEST_PYPI_TOKEN }} | |
repository_url: https://test.pypi.org/legacy/ | |
print_hash: true |