Skip to content

Commit

Permalink
refactor toxenvs, use OpenAstronomy workflows, and move MacOS jobs to…
Browse files Browse the repository at this point in the history
… schedule (#197)
  • Loading branch information
zacharyburnett authored Mar 22, 2023
2 parents 2c0ed5f + 4e29121 commit d951488
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 67 deletions.
67 changes: 22 additions & 45 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,48 +13,25 @@ on:
- cron: '0 9 * * 1'

jobs:
tox:
name: ${{ matrix.name }}
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
include:
- name: Python 3.10
runs-on: ubuntu-latest
python-version: "3.10"
toxenv: py310

- name: Python 3.8
runs-on: ubuntu-latest
python-version: 3.8
toxenv: py38

- name: Python 3.9
runs-on: ubuntu-latest
python-version: 3.9
toxenv: py39

- name: Code style checks
runs-on: ubuntu-latest
python-version: 3.8
toxenv: style

- name: macOS
runs-on: macos-latest
python-version: 3.8
toxenv: py38
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install tox
run: |
python -m pip install --upgrade pip
pip install tox
- name: Run tox
run: tox -e ${{ matrix.toxenv }}
check:
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v1
with:
envs: |
- linux: check-style
- linux: build-dist
test:
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v1
with:
envs: |
- linux: test-xdist
python-version: 3.8
- linux: test-xdist
python-version: 3.9
- linux: test-xdist
python-version: 3.10
- linux: test-xdist
python-version: 3.11
- macos: test-xdist
python-version: 3.11
- linux: test-xdist-cov
coverage: codecov
19 changes: 19 additions & 0 deletions .github/workflows/ci_cron.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Weekly cron

on:
schedule:
# Weekly Monday 6AM build
- cron: "0 0 * * 1"
workflow_dispatch:

jobs:
test:
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v1
with:
envs: |
- macos: test-xdist
python-version: 3.8
- macos: test-xdist
python-version: 3.9
- macos: test-xdist
python-version: 3.10
60 changes: 38 additions & 22 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,30 +1,46 @@
[tox]
envlist= py38,style
envlist =
check-{style,build}
test-xdist
build-{docs,dist}

[testenv]
extras= test
commands=
pytest
deps=
py310: git+https://github.com/pytest-dev/pytest

[testenv:egg_info]
deps=
commands=
python setup.py egg_info

[testenv:twine]
deps=
twine

commands=
twine check {distdir}/*

[testenv:style]
skip_install = true
[testenv:check-style]
description = Run all style and file checks with pre-commit
skip_install = true
deps =
pre-commit
commands =
pre-commit install-hooks
pre-commit run {posargs:--color always --all-files --show-diff-on-failure}

[testenv]
description =
run tests
cov: with coverage
xdist: using parallel processing
extras =
test
deps =
xdist: pytest-xdist
cov: pytest-cov
commands_pre =
pip freeze
commands =
pytest \
xdist: -n auto \
cov: --cov --cov-report=term-missing --cov-report=xml \
{posargs}

[testenv:build-docs]
description = invoke sphinx-build to build the HTML docs
extras = docs
commands =
sphinx-build -W docs docs/_build

[testenv:build-dist]
description = build wheel and sdist
skip_install = true
deps =
build
commands =
python -m build

0 comments on commit d951488

Please sign in to comment.