Skip to content

Commit

Permalink
tox
Browse files Browse the repository at this point in the history
  • Loading branch information
profxj committed Oct 21, 2024
1 parent c0aecde commit 438fc56
Show file tree
Hide file tree
Showing 3 changed files with 176 additions and 49 deletions.
85 changes: 85 additions & 0 deletions .github/workflows/ci_orig_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: CI Tests

on:
push:
branches:
- master
tags:
pull_request:

env:
SETUP_XVFB: True # avoid issues if mpl tries to open a GUI window

jobs:
ci-tests:
name: Python-${{ matrix.python }}, deps=${{ matrix.deps }}
runs-on: ${{ matrix.os }}
if: "!(contains(github.event.head_commit.message, '[skip ci]') || contains(github.event.head_commit.message, '[ci skip]'))"

strategy:
matrix:
os: [ubuntu-latest]
python: ['3.11', '3.12']
deps: [current, numpy211, astropydev, numpydev, astropydev-numpydev]

steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Install base dependencies
run: |
python -m pip install --upgrade pip
- name: Test with numpy = 2.1.1
if: "contains(matrix.deps, 'numpy211')"
run: |
python -m pip install numpy==2.1.1
- name: Test with dev version of numpy
if: "contains(matrix.deps, 'numpydev')"
run: |
python -m pip install git+https://github.com/numpy/numpy.git#egg=numpy
- name: Test with dev version astropy
if: "contains(matrix.deps, 'astropydev')"
run: |
python -m pip install git+https://github.com/astropy/astropy.git#egg=astropy
- name: Install frb requirements
run: |
python -m pip install wheel scipy IPython
python -m pip install git+https://github.com/FRBs/ne2001.git#egg=ne2001
python -m pip install git+https://github.com/FRBs/astropath.git#egg=astropath
python -m pip install git+https://github.com/linetools/linetools#egg=linetools
python -m pip install -r frb/requirements.txt
- name: Install numba
run: |
python -m pip install numba
- name: Install astroquery
run: |
python -m pip install astroquery
- name: Print Python, pip, astropy, numpy, and setuptools versions
run: |
python -c "import sys; print(f'Python {sys.version}')"
python -c "import pip; print(f'pip {pip.__version__}')"
python -c "import astropy; print(f'astropy {astropy.__version__}')"
python -c "import numpy; print(f'numpy {numpy.__version__}')"
python -c "import setuptools; print(f'setuptools {setuptools.__version__}')"
- name: Run tests
run: tox -e ${{ matrix.python }}-${{ matrix.toxenv }}

codestyle:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- uses: actions/checkout@v2
- name: Python codestyle check
uses: actions/setup-python@v2
with:
python-version: 3.11
- name: Install base dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pycodestyle
- name: Check for runtime errors using pycodestyle
run: |
pycodestyle frb --count --select=E9
65 changes: 16 additions & 49 deletions .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,82 +4,49 @@ on:
push:
branches:
- master
tags:
pull_request:

env:
SETUP_XVFB: True # avoid issues if mpl tries to open a GUI window
SETUP_XVFB: True # avoid issues if something tries to open a GUI window

jobs:
ci-tests:
name: Python-${{ matrix.python }}, deps=${{ matrix.deps }}
name: Tox env ${{ matrix.python }}-${{ matrix.toxenv }}
runs-on: ${{ matrix.os }}
if: "!(contains(github.event.head_commit.message, '[skip ci]') || contains(github.event.head_commit.message, '[ci skip]'))"

strategy:
matrix:
os: [ubuntu-latest]
python: ['3.11', '3.12']
deps: [current, numpy211, astropydev, numpydev, astropydev-numpydev]

toxenv: [test, test-astropydev]
steps:
- name: Check out repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install base dependencies
run: |
python -m pip install --upgrade pip
- name: Test with numpy = 2.1.1
if: "contains(matrix.deps, 'numpy211')"
run: |
python -m pip install numpy==2.1.1
- name: Test with dev version of numpy
if: "contains(matrix.deps, 'numpydev')"
run: |
python -m pip install git+https://github.com/numpy/numpy.git#egg=numpy
- name: Test with dev version astropy
if: "contains(matrix.deps, 'astropydev')"
run: |
python -m pip install git+https://github.com/astropy/astropy.git#egg=astropy
- name: Install frb requirements
run: |
python -m pip install wheel scipy IPython
python -m pip install --upgrade pip tox
python -m pip install git+https://github.com/FRBs/ne2001.git#egg=ne2001
python -m pip install git+https://github.com/FRBs/astropath.git#egg=astropath
python -m pip install git+https://github.com/linetools/linetools#egg=linetools
python -m pip install -r frb/requirements.txt
- name: Install numba
run: |
python -m pip install numba
- name: Install astroquery
run: |
python -m pip install astroquery
- name: Print Python, pip, astropy, numpy, and setuptools versions
- name: Test with tox
run: |
python -c "import sys; print(f'Python {sys.version}')"
python -c "import pip; print(f'pip {pip.__version__}')"
python -c "import astropy; print(f'astropy {astropy.__version__}')"
python -c "import numpy; print(f'numpy {numpy.__version__}')"
python -c "import setuptools; print(f'setuptools {setuptools.__version__}')"
- name: Run tests
run: python setup.py test
tox -e ${{ matrix.python }}-${{ matrix.toxenv }}
codestyle:
conda:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- uses: actions/checkout@v2
- name: Python codestyle check
uses: actions/setup-python@v2
- uses: actions/checkout@v3
- name: Conda environment check
uses: actions/setup-python@v4
with:
python-version: 3.11
python-version: '3.11'
- name: Install base dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pycodestyle
- name: Check for runtime errors using pycodestyle
python -m pip install --upgrade pip tox
- name: Run pypeit tests from environment built with conda
run: |
pycodestyle frb --count --select=E9
tox -e conda
75 changes: 75 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
[tox]
envlist =
{3.10,3.11,3.12}-test{,-alldeps}
{3.10,3.11,3.12}-test-numpy{125,126}
{3.10,3.11,3.12}-test-{numpy,astropy}dev
codestyle
requires =
setuptools >= 50.3.0
pip >= 19.3.1
isolated_build = true

[testenv]
# Suppress display of matplotlib plots generated during docs build
setenv =
MPLBACKEND=agg
numpydev: PIP_EXTRA_INDEX_URL = https://pypi.anaconda.org/scipy-wheels-nightly/simple

# Pass through the following environment variables which may be needed for the CI
passenv = HOME,WINDIR,LC_ALL,LC_CTYPE,CC,CI,PYPEIT_DEV

# Run the tests in a temporary directory to make sure that we don't import
# this package from the source tree
changedir = .tmp/{envname}

# 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
#
description =
run tests
alldeps: with all optional dependencies
devdeps: with the latest developer version of key dependencies
oldestdeps: with the oldest supported version of key dependencies
cov: and test coverage
numpy123: with numpy 1.23.*
numpy124: with numpy 1.24.*
numpy125: with numpy 1.25.*
numpy126: with numpy 1.26.*

# The following provides some specific pinnings for key packages
deps =

cov: coverage
numpy123: numpy==1.23.*
numpy124: numpy==1.24.*
numpy125: numpy==1.25.*
numpy126: numpy==1.26.*

numpydev: numpy>=0.0.dev0
astropydev: git+https://github.com/astropy/astropy.git#egg=astropy

linetoolsdev: git+https://github.com/linetools/linetools.git#egg=linetools

# The following indicates which extras_require from setup.cfg will be installed
extras =
test
alldeps: shapely,specutils,scikit-image
shapely: shapely
specutils: specutils

commands =
pip freeze
!cov: pytest --pyargs pypeit {posargs}
cov: pytest --pyargs pypeit --cov pypeit --cov-config={toxinidir}/setup.cfg {posargs}
cov: coverage xml -o {toxinidir}/coverage.xml

[testenv:conda]
description = run tests in environment created via conda
requires = tox-conda
conda_env = {toxinidir}/environment.yml
commands = pytest --pyargs pypeit {posargs}

0 comments on commit 438fc56

Please sign in to comment.