Skip to content

Commit

Permalink
GitHub Action to run tox (#193)
Browse files Browse the repository at this point in the history
Because Travis CI is no longer free to open source projects.
  • Loading branch information
cclauss committed Sep 1, 2023
1 parent b9eb0c7 commit 8de75b5
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 15 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: tox
on: [push, pull_request]
jobs:
tox-jobs:
strategy:
fail-fast: false
matrix:
job: [coverage, pycodestyle, pylint, readme]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.x
cache: 'pip' # Only use if there are requirements.txt files
- run: pip install --upgrade pip
- run: pip install tox
- run: tox -e ${{ matrix.job }}
# TODO: Add coveralls token
#- if: matrix.job == 'coverage'
# run: |
# pip install coveralls
# coveralls

tox:
strategy:
fail-fast: false
# max-parallel: 4
matrix:
os: [ubuntu-latest] # [macos-latest, ubuntu-latest, windows-latest]
python: ['3.8', '3.9', '3.10', '3.11', 'pypy3.10']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
cache: 'pip' # Only use if there are requirements.txt files
- run: python3 --version && python --version
- run: pip install --upgrade pip
- run: pip install tox
- run: tox -e py
11 changes: 5 additions & 6 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

# List of plugins (as comma separated values of python modules names) to load,
# usually to register additional checkers.
#load-plugins=
load-plugins=pylint.extensions.no_self_use



[MESSAGES CONTROL]
Expand All @@ -38,10 +39,8 @@

# C0111 => Missing docstring
# W0108 => unnecessary lambda
# W0142 => Used * or ** magic
# R0921 => Abstract class not referenced
# R0205 => Useless object inheritence: codebase still supports 2.7
disable=I, C0111, W0108, W0142, R0921, R0205
disable=I, C0111, W0108, R0205


[REPORTS]
Expand All @@ -54,7 +53,7 @@ output-format=text
# Put messages in a separate file for each module / package specified on the
# command line instead of printing them on stdout. Reports (if any) will be
# written in a file name "pylint_global.[txt|html]".
files-output=no
# files-output=no

# Tells whether to display a full report or only the messages
reports=no
Expand All @@ -74,7 +73,7 @@ msg-template={module}:{line}:{column}: [{msg_id}({symbol}), {obj}] {msg}
[BASIC]

# List of builtins function names that should not be used, separated by a comma
bad-functions=map,filter,apply,input
# bad-functions=map,filter,apply,input

# Regular expression which should only match correct module names
module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
Expand Down
18 changes: 9 additions & 9 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[tox]
envlist =
py35,
py36,
py37,
py38,
pypy3,
py39,
py310,
py311,
pypy310,
pycodestyle,
pylint,
readme,
Expand All @@ -14,11 +14,11 @@ envlist =
deps = -rrequirements-dev.txt
usedevelop = True
commands =
nosetests --with-flaky --exclude="test_nose_options_example" test/test_nose/
# nosetests --with-flaky --exclude="test_nose_options_example" test/test_nose/
pytest -k 'example and not options' --doctest-modules test/test_pytest/
pytest -k 'example and not options' -n 1 test/test_pytest/
pytest -p no:flaky test/test_pytest/test_flaky_pytest_plugin.py
nosetests --with-flaky --force-flaky --max-runs 2 test/test_nose/test_nose_options_example.py
# nosetests --with-flaky --force-flaky --max-runs 2 test/test_nose/test_nose_options_example.py
pytest --force-flaky --max-runs 2 test/test_pytest/test_pytest_options_example.py

[testenv:pycodestyle]
Expand All @@ -28,13 +28,13 @@ commands =

[testenv:pylint]
commands =
pylint --rcfile=.pylintrc flaky
pylint --rcfile=.pylintrc test -d C0330,W0621,C0411
pylint --rcfile=.pylintrc flaky -d C0209,C0415,W4901
pylint --rcfile=.pylintrc test -d C0209,C0411,C0415,W0240,W0621,W0719

[testenv:coverage]
commands =
python setup.py develop
nosetests --with-flaky --with-coverage --cover-package=flaky --exclude="test_nose_options_example" --no-flaky-report --cover-erase test/test_nose/
# nosetests --with-flaky --with-coverage --cover-package=flaky --exclude="test_nose_options_example" --no-flaky-report --cover-erase test/test_nose/
pytest -k 'example and not options' --doctest-modules --no-flaky-report --cov flaky --cov-report term-missing test/test_pytest/
pytest -p no:flaky --cov flaky --cov-report term-missing test/test_pytest/test_flaky_pytest_plugin.py

Expand Down

0 comments on commit 8de75b5

Please sign in to comment.