Skip to content

Tests

Tests #300

Workflow file for this run

name: Tests
on:
push:
pull_request:
release:
schedule:
# Every Thursday at 1 AM
- cron: '0 1 * * 4'
jobs:
Tests:
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
container: ${{ matrix.container || format('python:{0}', matrix.python-version) }}
name: ${{ (matrix.toxenv && !startsWith(matrix.toxenv, 'py')) && format('{0} ({1})', matrix.toxenv, matrix.python-version) || matrix.python-version }} ${{ matrix.optional && '[OPTIONAL]' }}
continue-on-error: ${{ matrix.optional || false }}
strategy:
fail-fast: false
matrix:
python-version: ['2.7', '3.5', '3.6', '3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
include:
- python-version: '3.14'
toxenv: lint
os-deps:
- enchant-2
- python-version: '3.14'
toxenv: docs
os-deps:
- enchant-2
- python-version: '3.14'
toxenv: coverage
- python-version: '3.15'
container: 'python:3.15-rc'
optional: true
- python-version: pypy-2.7
toxenv: pypy27
container: pypy:2.7
- python-version: pypy-3
toxenv: pypy3
container: pypy:3
steps:
- name: Set TOXENV
# Use toxenv if defined or use the python version with the dot removed
run: |
if [ -n "${{ matrix.toxenv }}" ]; then
echo "TOXENV=${{ matrix.toxenv }}" >> $GITHUB_ENV
else
echo "TOXENV=py$(echo ${{ matrix.python-version }} | tr -d .)" >> $GITHUB_ENV
fi
- name: Install OS Dependencies
run: apt update && apt -y install ${{ join(matrix.os-deps, ' ') }}
if: ${{ matrix.os-deps }}
- uses: actions/checkout@v6
with:
# This is needed so copyright check gets the real commit dates
fetch-depth: ${{ env.TOXENV == 'lint' && '0' || '1' }}
# https://github.com/actions/checkout/issues/1048
- name: Workaround for git ownership issue
run: git config --global --add safe.directory $GITHUB_WORKSPACE
- name: Install tox
run: pip install tox
- name: Run tox
run: tox -- --verbose
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v6
with:
verbose: true
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
if: ${{ matrix.toxenv == 'coverage' }}