Skip to content

Commit

Permalink
Merge pull request #293 from pllim/tox-tox-tox-toxic
Browse files Browse the repository at this point in the history
TST: Use tox to run CI
  • Loading branch information
pllim authored Jan 6, 2021
2 parents 6346230 + 892cab7 commit 60be4e9
Show file tree
Hide file tree
Showing 5 changed files with 233 additions and 205 deletions.
223 changes: 73 additions & 150 deletions .github/workflows/ci_workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,167 +30,90 @@ jobs:

# The rest only run if above are done

pep_and_audit:
name: PEP and audit
runs-on: ubuntu-16.04
tests:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
needs: cancel_ci
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Fetch tags
run: git fetch --prune --unshallow --tags
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Lint with flake8
run: |
python -m pip install --upgrade pip flake8
flake8 synphot --count
# Make sure that packaging will work
- name: pep517 build
run: |
python -m pip install --upgrade setuptools build "twine>=3.3"
python -m build --sdist .
twine check --strict dist/*
- name: Security audit
run: |
python -m pip install --upgrade bandit
bandit -r . -c .bandit.yaml
strategy:
fail-fast: true
matrix:
include:

initial_tests:
name: Initial CI stage
runs-on: ubuntu-16.04
needs: cancel_ci
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Fetch tags
run: git fetch --prune --unshallow --tags
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.7'
- name: Install and build
run: |
sudo apt-get install libxml2-utils
python -m pip install --upgrade pip setuptools
python -m pip install -e .[test]
- name: Test without optional deps
run: pytest --open-files
- name: Code style checks
os: ubuntu-latest
python: 3.x
toxenv: codestyle

coverage_tests:
name: CI with coverage
runs-on: ubuntu-latest
needs: [pep_and_audit, initial_tests]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Fetch tags
run: git fetch --prune --unshallow --tags
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install and build
run: |
sudo apt-get install libxml2-utils
python -m pip install --upgrade pip setuptools pytest-cov codecov
python -m pip install -e .[test,all]
- name: Test with coverage
run: pytest --cov=./ --cov-report=xml --open-files --remote-data
- name: Coverage report
uses: codecov/codecov-action@f532c3a # v1.0.7
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: PEP 517 build
os: ubuntu-latest
python: 3.x
toxenv: twine

dev_deps_tests:
name: CI with dev dependencies
runs-on: ubuntu-latest
needs: [pep_and_audit, initial_tests]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Fetch tags
run: git fetch --prune --unshallow --tags
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install and build
run: |
sudo apt-get install libxml2-utils
python -m pip install --upgrade pip setuptools
python -m pip install git+https://github.com/astropy/astropy.git@master#egg=astropy
python -m pip install git+https://github.com/astropy/specutils.git@master#egg=specutils
python -m pip install -e .[test]
- name: Test with dev deps
run: pytest --open-files
- name: Security audit
os: ubuntu-latest
python: 3.x
toxenv: bandit

old_deps_tests:
name: CI with old dependencies
runs-on: ubuntu-16.04
needs: [pep_and_audit, initial_tests]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Fetch tags
run: git fetch --prune --unshallow --tags
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.6'
- name: Install and build
run: |
sudo apt-get install libxml2-utils
python -m pip install --upgrade pip setuptools
python -m pip install numpy==1.16.6
python -m pip install scipy==1.1.0
python -m pip install astropy==3.2.2
python -m pip install -e .[test]
- name: Test with old deps
run: pytest --open-files
- name: Link check
os: ubuntu-latest
python: 3.x
toxenv: linkcheck

- name: Test without optional deps
os: ubuntu-latest
python: 3.8
toxenv: py38-test
toxposargs: --open-files

- name: Coverage test with remote data
os: ubuntu-latest
python: 3.9
toxenv: py39-test-alldeps-cov
toxposargs: --open-files --remote-data

- name: Test with dev dependencies
os: ubuntu-latest
python: 3.9
toxenv: py39-test-devdeps
toxposargs: --open-files

- name: Test with old dependencies
os: ubuntu-16.04
python: 3.7
toxenv: py37-test-oldestdeps
toxposargs: --open-files

- name: Test in OSX
os: macos-latest
python: 3.9
toxenv: py39-test-alldeps
toxposargs: --open-files

# NOTE: If TRDS cannot take the hit, disable --remote-data
- name: Test in Windows with remote data
os: windows-latest
python: 3.9
toxenv: py39-test-alldeps
toxposargs: --open-files --remote-data

other_oses:
name: CI in Win and OSX
runs-on: ${{ matrix.os }}
needs: [pep_and_audit, initial_tests]
strategy:
matrix:
os: [windows-latest, macos-latest]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Fetch tags
run: git fetch --prune --unshallow --tags
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install and build
run: |
python -m pip install --upgrade pip setuptools
python -m pip install -e .[test,all]
python-version: ${{ matrix.python }}
- name: Install Linux libs
if: startsWith(matrix.os, 'ubuntu')
run: sudo apt-get install libxml2-utils
- name: Install Python dependencies
run: python -m pip install --upgrade pip tox
- name: Run tests
run: pytest --open-files

link_check:
name: Link check
runs-on: ubuntu-latest
needs: [pep_and_audit, initial_tests]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
run: tox -e ${{ matrix.toxenv }} -- ${{ matrix.toxposargs }}
- name: Upload coverage to codecov
if: ${{ contains(matrix.toxenv,'-cov') }}
uses: codecov/codecov-action@v1
with:
python-version: '3.x'
- name: Install and build
run: |
python -m pip install --upgrade pip setuptools sphinx-astropy
python -m pip install -e .
- name: Docs link check
run: |
cd docs
make linkcheck
shell: bash
file: ./coverage.xml
6 changes: 3 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tool:pytest]
minversion = 3.1
minversion = 5
testpaths = "synphot" "docs"
norecursedirs = build docs/_build synphot/src
astropy_header = true
Expand Down Expand Up @@ -42,8 +42,8 @@ setup_requires =
setuptools_scm
install_requires =
numpy>=1.16
astropy>=3
scipy>=0.14
astropy>=3.2
scipy>=1.1
python_requires = >=3.6
[options.extras_require]
Expand Down
6 changes: 3 additions & 3 deletions synphot/setup_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ def get_extensions():
numpy.get_include(),
os.path.join(LOCALROOT, "include")])
cfg['sources'] = [
str(os.path.join(LOCALROOT, 'src', 'synphot_utils.c')),
str(os.path.join(LOCALROOT, 'src', 'docstrings.c'))]
os.path.join(LOCALROOT, 'src', 'synphot_utils.c'),
os.path.join(LOCALROOT, 'src', 'docstrings.c')]
cfg = dict((str(key), val) for key, val in cfg.items())

return [Extension(str('synphot.synphot_utils'), **cfg)]
return [Extension('synphot.synphot_utils', **cfg)]
Loading

0 comments on commit 60be4e9

Please sign in to comment.