Skip to content

Commit 72d363f

Browse files
use tox to build test environments and OpenAstronomy reusable workflow
1 parent c32158f commit 72d363f

File tree

2 files changed

+78
-55
lines changed

2 files changed

+78
-55
lines changed

.github/workflows/ci.yml

Lines changed: 27 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -3,59 +3,31 @@ name: CI
33
on: [push, pull_request]
44

55
jobs:
6+
check:
7+
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v1
8+
with:
9+
envs: |
10+
- linux: check-style
11+
- linux: build-dist
12+
- linux: build-docs
613
test:
7-
name: test
8-
runs-on: ${{ matrix.os }}
9-
strategy:
10-
fail-fast: false
11-
matrix:
12-
os: ["ubuntu-latest"]
13-
python-version: ["3.7", "3.10", "pypy-3.7", "pypy-3.8"]
14-
timeout-minutes: 30
15-
steps:
16-
- uses: actions/checkout@v3
17-
with:
18-
fetch-depth: 0
19-
20-
# We need Python 3.7 to always be installed, so tests with
21-
# multiple environments can run.
22-
- name: Set up Python 3.7
23-
uses: actions/setup-python@v4
24-
with:
25-
python-version: 3.7
26-
27-
- name: Set up Python ${{ matrix.python-version }}
28-
uses: actions/setup-python@v4
29-
with:
30-
python-version: ${{ matrix.python-version }}
31-
cache: pip
32-
cache-dependency-path: pyproject.toml
33-
34-
- name: Install dependencies
35-
run: python -m pip install -r requirements-dev.txt
36-
37-
- name: Install asv
38-
run: pip install .
39-
40-
- name: Run tests
41-
run: python -m pytest -v --timeout=300 --durations=100 test
42-
43-
docs:
44-
runs-on: ubuntu-latest
45-
steps:
46-
- uses: actions/checkout@v3
47-
48-
- uses: actions/setup-python@v4
49-
with:
50-
python-version: '3.x'
51-
cache: pip
52-
cache-dependency-path: pyproject.toml
53-
54-
- name: Install dependencies
55-
run: python -m pip install -r requirements-dev.txt
56-
57-
- name: Install asv
58-
run: pip install ".[doc]"
59-
60-
- name: Build docs
61-
run: sphinx-build -W docs/source html
14+
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main
15+
with:
16+
envs: |
17+
- linux: test-mindeps-xdist
18+
python-version: "3.7"
19+
- linux: test-xdist
20+
python-version: "3.7"
21+
- linux: test-xdist
22+
python-version: "pypy3.7"
23+
- linux: test-xdist
24+
python-version: "pypy3.8"
25+
- linux: test-xdist
26+
python-version: "3.10"
27+
- linux: test-xdist
28+
python-version: "3.11"
29+
- macos: test-xdist
30+
python-version: "3.11"
31+
- linux: test-devdeps-xdist
32+
- linux: test-xdist-cov
33+
coverage: codecov

tox.ini

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
[tox]
2+
env_list =
3+
check-{style}
4+
test{,-mindeps}{,-warnings,-cov}-xdist
5+
build-{docs,dist}
6+
7+
[testenv:check-style]
8+
description = check code style
9+
skip_install = true
10+
deps =
11+
ruff
12+
commands =
13+
ruff . {posargs}
14+
15+
[testenv]
16+
description =
17+
run tests
18+
mindeps: with the minimum supported versions of key dependencies
19+
warnings: treating warnings as errors
20+
cov: with coverage
21+
xdist: using parallel processing
22+
extras =
23+
test
24+
deps =
25+
xdist: pytest-xdist
26+
mindeps: minimum_dependencies
27+
devdeps: -rrequirements-dev.txt
28+
commands_pre =
29+
mindeps: minimum_dependencies asv --filename requirements-min.txt
30+
mindeps: pip install -r requirements-min.txt
31+
pip freeze
32+
commands =
33+
pytest -v --timeout 300 --durations 100 \
34+
cov: --cov . --cov-report xml \
35+
warnings: -W error \
36+
xdist: -n auto \
37+
{posargs}
38+
39+
[testenv:build-docs]
40+
description = invoke sphinx-build to build the HTML docs
41+
extras = docs
42+
commands =
43+
sphinx-build -W docs/source html
44+
45+
[testenv:build-dist]
46+
description = package source and build wheel
47+
skip_install = true
48+
deps =
49+
build
50+
commands =
51+
python -m build .

0 commit comments

Comments
 (0)