Skip to content

Commit

Permalink
use Tox and OpenAstronomy test workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharyburnett committed Nov 27, 2023
1 parent 9547509 commit 0c40b0d
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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
]
47 changes: 47 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -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 .

0 comments on commit 0c40b0d

Please sign in to comment.