Skip to content

Commit

Permalink
Merge pull request #192 from mcara/switch-to-ci
Browse files Browse the repository at this point in the history
Switch to CI
  • Loading branch information
mcara authored Dec 4, 2023
2 parents 7d621a8 + fc3251f commit 40f8cd7
Show file tree
Hide file tree
Showing 9 changed files with 174 additions and 151 deletions.
2 changes: 2 additions & 0 deletions .bandit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
exclude_dirs:
- tweakwcs/tests
4 changes: 3 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ exclude_lines =
pragma: no cover
raise NotImplementedError
if __name__ == .__main__.:
@(abc\\.)?abstractmethod
raise AssertionError
raise NotImplementedError
ignore_errors = True
omit =
conftest.py
setup.py
tests/*
tweakwcs/tests/*
68 changes: 68 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: CI

on:
push:
branches:
- master
- '*.x'
tags:
- "*"
pull_request:
schedule:
- cron: '0 6 * * 1'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
check:
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v1
with:
envs: |
- linux: check-style
- linux: check-security
- linux: check-build
test:
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v1
with:
envs: |
- linux: test-xdist
python-version: 3.8
- macos: test-xdist
python-version: 3.8
- windows: test-xdist
python-version: 3.8
- linux: test-numpy121-xdist
python-version: 3.9
- linux: test-numpy123-xdist
python-version: 3.9
- linux: test-numpy125-xdist
python-version: 3.9
- macos: test-numpy121-xdist
python-version: 3.10
- linux: test-numpy125-xdist
python-version: 3.10
- linux: test-xdist
python-version: 3.11
pytest-results-summary: true
- macos: test-xdist
python-version: 3.11
pytest-results-summary: true
- windows: test-xdist
python-version: 3.11
pytest-results-summary: true
- linux: test-pyargs-xdist
python-version: 3.11
- linux: test-cov-xdist
python-version: 3.12
coverage: codecov
pytest-results-summary: true
- macos: test-xdist
python-version: 3.12
pytest-results-summary: true
- windows: test-xdist
python-version: 3.12
pytest-results-summary: true
- linux: test-dev-xdist
python-version: 3.12
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ tweakwcs/_version.py
htmlcov
.coverage
MANIFEST
coveragerc

# Sphinx
docs/api
Expand Down Expand Up @@ -45,6 +46,7 @@ docs/_build/
# Packages/installer info
*.egg
*.egg-info
.tox
dist/
build/
eggs
Expand All @@ -61,6 +63,7 @@ pip-wheel-metadata
# codecov
.coverage
*.coverage.*
**/coverage.xml

# Other
*~
Expand Down
58 changes: 0 additions & 58 deletions azure-pipelines.yml

This file was deleted.

75 changes: 0 additions & 75 deletions azure-templates.yml

This file was deleted.

7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ Documentation = "http://spacetelescope.github.io/tweakwcs/"
test = [
"pytest",
"pytest-cov",
"coverage",
"scipy",
]
docs = [
Expand All @@ -72,18 +71,18 @@ include-package-data = true
license-files = ["LICENSE.rst"]

[tool.setuptools.packages.find]
namespaces = false
namespaces = true

[tool.setuptools.package-data]
"*" = [
'tweakwcs/tests/data/*',
'notebooks/*',
'notebooks/*.ipynb',
]
"tweakwcs" = [
'README.rst',
'LICENSE.txt',
'CHANGELOG.rst',
]
"tweakwcs.tests.data" = ["tweakwcs/tests/data/*"]

[tool.setuptools_scm]
write_to = "tweakwcs/_version.py"
Expand Down
95 changes: 95 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
[tox]
envlist =
check-{style,security,build}
test{,-dev}{,-pyargs,-cov}
test-numpy{120,122,125}
build-{docs,dist}

# tox environments are constructed with so-called 'factors' (or terms)
# separated by hyphens, e.g. test-devdeps-cov. Lines below starting with factor:
# will only take effect if that factor is included in the environment name. To
# see a list of example environments that can be run, along with a description,
# run:
#
# tox -l -v
#

[testenv:check-style]
description = check code style, e.g. with flake8
skip_install = true
deps =
flake8
commands =
flake8 . {posargs}

[testenv:check-security]
description = run bandit to check security compliance
skip_install = true
deps =
bandit>=1.7
commands =
bandit -r -ll -c .bandit.yaml tweakwcs

[testenv:check-build]
description = check build sdist/wheel and a strict twine check for metadata
skip_install = true
deps =
twine>=3.3
build
commands =
python -m build .
twine check --strict dist/*

[testenv]
description =
run tests
dev: with the latest developer version of key dependencies
pyargs: with --pyargs on installed package
warnings: treating warnings as errors
cov: with coverage
xdist: using parallel processing
passenv =
HOME
GITHUB_*
TOXENV
CI
CODECOV_*
DISPLAY
set_env =
dev: PIP_EXTRA_INDEX_URL = https://pypi.anaconda.org/astropy/simple https://pypi.anaconda.org/liberfa/simple https://pypi.anaconda.org/scientific-python-nightly-wheels/simple

args_are_paths = false
change_dir = pyargs: {env:HOME}
extras =
test
alldeps: all
deps =
xdist: pytest-xdist
cov: pytest-cov
numpy121: numpy==1.21.*
numpy123: numpy==1.23.*
numpy125: numpy==1.25.*
commands_pre =
dev: pip install -r requirements-dev.txt -U --upgrade-strategy eager
pip freeze
commands =
pytest \
warnings: -W error \
xdist: -n auto \
pyargs: {toxinidir}/docs --pyargs tweakwcs \
cov: --cov=. --cov-config=pyproject.toml --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 .
13 changes: 0 additions & 13 deletions tweakwcs/tests/coveragerc

This file was deleted.

0 comments on commit 40f8cd7

Please sign in to comment.