.github/workflows/my_github_action.yml
name: my_github_actions
on:
push:
pull_request:
schedule:
- cron: '0 0 * * *' # every day at midnight
jobs:
build:
runs-on: ubuntu-20.04 # Should be ubuntu-latest if not for issue #58
strategy:
fail-fast: false
matrix:
python-version:
# Support for Python 2.7 removed - https://github.com/actions/setup-python/issues/672
# - '2.7'
# - '3.0.1'
# - '3.1.4'
# - '3.2.5'
# - '3.3.7'
# - '3.4.10'
- '3.5'
- '3.6'
- '3.7'
- '3.8'
- '3.9'
- '3.9.0'
- '3.9.1'
- '3.9.2'
- '3.9.3'
- '3.9.4'
- '3.9.5'
- '3.9.6'
- '3.9.7'
- '3.9.8'
- '3.9.9'
- '3.9.10'
- '3.9.11'
- '3.9.12'
- '3.9.13'
- '3.9.14'
- '3.9.15'
- '3.9.16'
- '3.9.17'
- '3.9-dev'
# Disabled because of issue #61
# - '3.10.0-alpha.1'
# - '3.10.0-alpha.2'
# - '3.10.0-alpha.3'
# - '3.10.0-alpha.4'
# - '3.10.0-alpha.5'
# - '3.10.0-alpha.6'
# - '3.10.0-alpha.7'
# Disabled because of issue #66
# - '3.10.0-beta.1'
# - '3.10.0-beta.2'
# - '3.10.0-beta.3'
# - '3.10.0-beta.4'
- '3.10.0-rc.1'
- '3.10.0-rc.2'
- '3.10.0'
- '3.10.1'
- '3.10.2'
- '3.10.3'
- '3.10.4'
- '3.10.5'
- '3.10.6'
- '3.10.7'
- '3.10.8'
- '3.10.9'
- '3.10.10'
- '3.10.11'
- '3.10.12'
- '3.10.13'
- '3.10.14'
- '3.10-dev'
# Disabled because of issue #66
# - '3.11.0-alpha.1'
# - '3.11.0-alpha.2'
# - '3.11.0-alpha.3'
# - '3.11.0-alpha.4'
# - '3.11.0-alpha.5'
# - '3.11.0-alpha.6'
- '3.11.0-alpha.7'
- '3.11.0-beta.1'
- '3.11.0-beta.2'
- '3.11.0-beta.3'
- '3.11.0-beta.4'
- '3.11.0-beta.5'
- '3.11.0-rc.1'
- '3.11.0-rc.2'
- '3.11.0'
- '3.11.1'
- '3.11.2'
- '3.11.3'
- '3.11.4'
- '3.11.5'
- '3.11.6'
- '3.11.7'
- '3.11.8'
- '3.11.9'
- '3.11-dev'
- '3.11'
# Disabled because of issue #62 - https://github.com/nedbat/coveragepy/issues/1634
# - '3.12.0-alpha.1'
# - '3.12.0-alpha.2'
# - '3.12.0-alpha.3'
# - '3.12.0-alpha.4'
# - '3.12.0-alpha.5'
# - '3.12.0-alpha.6'
# - '3.12.0-alpha.7'
- '3.12.0-beta.1'
- '3.12.0-beta.2'
- '3.12.0-beta.3'
- '3.12.0-beta.4'
- '3.12.0-rc.1'
- '3.12.0-rc.2'
- '3.12.0-rc.3'
- '3.12-dev'
- '3.12.0'
- '3.12.1'
- '3.12.2'
- '3.12.3'
- '3.12.4'
- '3.13.0-alpha.1'
- '3.13.0-alpha.2'
- '3.13.0-alpha.3'
- '3.13.0-alpha.4'
- '3.13.0-alpha.5'
- '3.13.0-alpha.6'
- '3.13.0-beta.1'
- '3.13.0-beta.2'
- 'pypy-2.7'
- 'pypy-2.7-nightly'
- 'pypy-3.6' # the latest available version of PyPy that supports Python 3.6
- 'pypy-3.6-nightly'
- 'pypy-3.7' # the latest available version of PyPy that supports Python 3.7
- 'pypy-3.7-v7.3.3' # Python 3.7 and PyPy 7.3.3
- 'pypy-3.7-nightly' # Python 3.7 and nightly PyPy
- 'pypy-3.8-nightly'
- 'pypy-3.9-nightly'
- 'pypy-3.10-nightly'
# TODO: Add nightly somehow
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
env: # Temporary workaround for Python 3.5 failures - May 2024
PIP_TRUSTED_HOST: "pypi.python.org pypi.org files.pythonhosted.org"
- name: Show Python version information
run: |
# Information about Python version
python -VV
python -c "import sys; print(sys.version_info)" || true
python -c "import sys; print(sys._git)" || true
# Information about pip version
pip --version
# Information about Python builtins/keywords
python -c "import sys; import keyword; print({sys.version_info: {'kword': set(keyword.kwlist), 'builtins': set(dir(__builtins__))}})" || true
python -c "import sysconfig; print(dir(sysconfig))" || true
- name: Install dependencies
run: |
pip install --upgrade pip
pip --version
pip install --upgrade pycodestyle
pip install pep257
pip install pydocstyle
pip install --upgrade pyflakes || true
pip install coverage
pip install unittest2
- name: Check codestyle
run: |
# W391, E122 temporarily disabled - https://github.com/PyCQA/pycodestyle/issues/1142
pycodestyle --ignore=W391,E122,E501,E231,W503,E126,E123 *.py */*.py
pycodestyle --select=W391,E122,E501,E231,W503,E126,E123 *.py */*.py || true
pep257 *.py */*.py || true
pydocstyle *.py */*.py || true
pyflakes . || true
- name: Run examples (from unit tests)
run: |
python didyoumean/didyoumean_sugg_tests.py
- name: Run examples (from Readme)
run: |
python didyoumean/readme_examples.py
- name: Run unit-tests without coverage
run: |
python -m unittest discover --start-directory=didyoumean --pattern=*.py
python -m unittest2 discover --start-directory=didyoumean --pattern=*.py || true
- name: Run unit-tests with coverage
run: |
coverage run -m unittest discover --start-directory=didyoumean --pattern=*.py
coverage run -m unittest2 discover --start-directory=didyoumean --pattern=*.py || true
- name: Install locally
run: |
pip install . --use-pep517
- name: Run coverage tools
run: |
coveralls || true