diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..7a165cc --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,65 @@ +name: Tests + +on: + push: + pull_request: + release: + schedule: + # Every Thursday at 1 AM + - cron: '0 1 * * 4' + +jobs: + + Tests: + runs-on: ${{ matrix.os || 'windows-latest' }} + name: ${{ startsWith(matrix.toxenv, 'py') && format('{0}-{1}', matrix.python-version, matrix.python-arch) || format('{0} ({1}-{2})', matrix.toxenv, matrix.python-version, matrix.python-arch) }} ${{ 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'] + python-arch: ['x86', 'x64'] + toxenv: [pywin] + + + include: + + - toxenv: lint + python-version: 3.x + python-arch: x64 + os: ubuntu-latest + + - toxenv: codecov + python-version: 3.x + python-arch: x64 + + - python-version: '3.12-dev' + optional: true + python-arch: x86 + toxenv: pywin + + - python-version: '3.12-dev' + optional: true + python-arch: x64 + toxenv: pywin + + env: + TOXENV: ${{ matrix.toxenv }} + TOXPYTHON: python${{ matrix.toxpython || matrix.python-version }} + + steps: + - uses: actions/checkout@v3 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + architecture: ${{ matrix.python-arch }} + + - name: Install tox + run: pip install tox + + - name: Run tox + run: tox -- --verbose diff --git a/tox.ini b/tox.ini index 29b414a..4b3c774 100644 --- a/tox.ini +++ b/tox.ini @@ -1,16 +1,15 @@ [tox] -ignore_basepython_conflict = True +ignore_basepython_conflict = False envlist = lint [testenv] -basepython = python3.9 commands = {envpython} -m unittest discover -s {toxinidir}/tests {posargs} [testenv:pywin] -basepython = {env:PYTHON}\python.exe +basepython = {env:pythonLocation:{env:PYTHON:}}\python.exe commands = {envpython} -c "import sys, struct; print(sys.version); print(str(struct.calcsize('P') * 8) + '-bit')" {[testenv]commands} @@ -21,12 +20,16 @@ deps = coverage commands = - {envpython} -m coverage run -m unittest discover -s {toxinidir}/tests {posargs} - {envpython} -m coverage report + coverage run -m unittest discover -s {toxinidir}/tests {posargs} + coverage report [testenv:codecov] -passenv = CI TRAVIS TRAVIS_* APPVEYOR APPVEYOR_* COVERALLS_REPO_TOKEN +passenv = + CI + APPVEYOR + APPVEYOR_* + COVERALLS_REPO_TOKEN deps = {[testenv:coverage]deps} # codecov @@ -34,8 +37,8 @@ deps = commands = {[testenv:coverage]commands} - # {envpython} -m codecov - {envpython} -m coveralls + # codecov + coveralls [testenv:flake8] @@ -44,7 +47,7 @@ deps = flake8 commands = - {envpython} -m flake8 + flake8 [testenv:pylint] @@ -55,7 +58,7 @@ deps = pyenchant commands = - {envpython} -m pylint ansicon tests setup.py + pylint ansicon tests setup.py [testenv:lint]