From 0c40b0dd371345fe4fb747f751197a502a2ece6b Mon Sep 17 00:00:00 2001 From: zacharyburnett Date: Mon, 27 Nov 2023 10:20:08 -0500 Subject: [PATCH] use Tox and OpenAstronomy test workflow --- .github/workflows/tests.yml | 22 +++++++++++++++++ pyproject.toml | 6 +++++ tox.ini | 47 +++++++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+) create mode 100644 .github/workflows/tests.yml create mode 100644 tox.ini diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..40629c4 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,22 @@ +name: tests + +on: + push: + branches: + - master + - '*x' + tags: + - '*' + pull_request: + +jobs: + test: + uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v1 + with: + envs: | + - linux: py39-xdist + - linux: py310-xdist + - linux: py311-xdist + - macos: py311-xdist + - linux: py311-cov + coverage: codecov diff --git a/pyproject.toml b/pyproject.toml index 3284ad2..23edae9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,9 @@ [build-system] requires = ["setuptools>=42", "setuptools_scm[toml]>=3.4", "wheel"] build-backend = "setuptools.build_meta" + +[tool.ruff] +line-length = 127 +extend-ignore = [ + "E501", # Line too long +] diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..d658500 --- /dev/null +++ b/tox.ini @@ -0,0 +1,47 @@ +[tox] +env_list = + check-{style} + test{,-warnings}{,-cov}-xdist + build-{docs,dist} + +[testenv:check-style] +description = check code style, e.g. with flake8 +skip_install = true +deps = + ruff +commands = + ruff check . {posargs} + +[testenv] +description = + run tests + warnings: treating warnings as errors + cov: with coverage + xdist: using parallel processing +package = editable +deps = + pytest + xdist: pytest-xdist + cov: pytest-cov +commands_pre = + pip freeze +commands = + pytest \ + warnings: -W error \ + cov: --cov=. --cov-config=pyproject.toml --cov-report=term-missing --cov-report=xml \ + xdist: -n auto \ + {posargs} + +[testenv:build-docs] +description = invoke sphinx-build to build the HTML docs +extras = docs +commands = + sphinx-build -b html docs docs/_build/html + +[testenv:build-dist] +description = build wheel and sdist +skip_install = true +deps = + build +commands = + python -m build .