-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
47 additions
and
41 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
name: CI | ||
|
||
on: [pull_request] | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
tests: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: themattrix/tox | ||
image: python:3.10 | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
- name: Tests | ||
run: | | ||
- name: Packages | ||
run: pip install tox | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Tox | ||
run: | | ||
git config --global --add safe.directory "${GITHUB_WORKSPACE}" | ||
tox -v |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,55 @@ | ||
[tox] | ||
minversion = 1.6 | ||
skipsdist = True | ||
envlist = examples,pep8,autopep8,docs | ||
envlist = docs,examples,doc8,pep8,autopep8 | ||
|
||
[testenv] | ||
basepython = python3 | ||
usedevelop = True | ||
install_command = pip install {opts} {packages} | ||
|
||
[testenv:autopep8] | ||
description = Print autopep8 suggestions. | ||
envdir = {toxworkdir}/linters | ||
deps = -r test-requirements.txt | ||
commands = autopep8 --recursive --aggressive --diff --exit-code . | ||
|
||
[testenv:doc8] | ||
description = Style guide enforcement with doc8. | ||
envdir = {toxworkdir}/linters | ||
deps = -r test-requirements.txt | ||
commands = doc8 {posargs} | ||
|
||
[testenv:docs] | ||
description = Build project documentation. | ||
envdir = {toxworkdir}/sphinx | ||
deps = -r docs/requirements.txt | ||
allowlist_externals = rm | ||
commands = | ||
rm -rf docs/_build | ||
sphinx-build -W -b html docs docs/_build | ||
|
||
[testenv:examples] | ||
description = | ||
Run all python scripts from examples directory - physics check. | ||
# Env variable MPLBACKEND=Agg prevents display of windows during tests | ||
description = Run all python scripts from examples directory - physics check. | ||
envdir = {toxworkdir}/build | ||
deps = -r requirements.txt | ||
setenv = | ||
MPLBACKEND=Agg | ||
commands = | ||
bash -ex -c 'for FILE in examples/*.py; do python $FILE; done' | ||
# Env variable MPLBACKEND=Agg prevents display of windows during tests | ||
setenv = MPLBACKEND=Agg | ||
allowlist_externals = bash | ||
commands = bash -ex -c 'for FILE in examples/*.py; do python $FILE; done' | ||
|
||
[testenv:pep8] | ||
description = | ||
Style guide enforcement with flake8 and doc8. | ||
deps = | ||
-r test-requirements.txt | ||
commands = | ||
flake8 | ||
doc8 | ||
|
||
[testenv:autopep8] | ||
description = | ||
Check autopep8 suggestions. | ||
deps = | ||
-r test-requirements.txt | ||
commands = | ||
python -m autopep8 --recursive --aggressive --diff --exit-code . | ||
description = Style guide enforcement with flake8. | ||
envdir = {toxworkdir}/linters | ||
deps = -r test-requirements.txt | ||
commands = flake8 {posargs} | ||
|
||
[doc8] | ||
# D000 - invalid rst format | ||
# D002 - no trailing whitespace | ||
# D004 - no carriage returns (use unix newlines) | ||
ignore = D000,D002,D004 | ||
ignore-path = .venv,.git,.tox,gnlse.egg*,docs/_build | ||
ignore-path = .git,.tox,.venv,docs/_build,*.egg-info | ||
|
||
[flake8] | ||
exclude = .venv,.git,.tox,docs,*egg,build | ||
|
||
[testenv:docs] | ||
description = | ||
Build main documentation: html and pdf file. | ||
deps = | ||
-r docs/requirements.txt | ||
commands = | ||
rm -rf docs/_build | ||
sphinx-build -W -b html docs docs/_build | ||
exclude = .git,.tox,.venv,build,docs,*.egg-info |