Skip to content

Commit

Permalink
use tox
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharyburnett committed Jan 24, 2024
1 parent b5646b2 commit 97f077e
Showing 1 changed file with 79 additions and 19 deletions.
98 changes: 79 additions & 19 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,8 @@ jobs:
runs-on: [ ubuntu-latest, macos-latest ]
python-version: [ '3.9', '3.10', '3.11' ]
include:
- package: acstools
extras: [ test ]
- package: asdf
extras: [ tests ]
- package: ccdproc
extras: [ test ]
- package: costools
#- package: pysynphot
# extras: [ test ]
- package: reftools
extras: [ test ]
- package: synphot
extras: [ test ]
- package: wfpc2tools
exclude:
- runs-on: macos-latest
Expand Down Expand Up @@ -87,8 +76,6 @@ jobs:
runs-on: [ ubuntu-latest, macos-latest ]
python-version: [ '3.9', '3.10', '3.11' ]
include:
- package: calcos
repository: spacetelescope/calcos
#- package: crds
# repository: spacetelescope/crds
# extras: [ test ]
Expand All @@ -104,12 +91,6 @@ jobs:
test_directory: tests
env:
CRDS_SERVER_URL: https://hst-crds.stsci.edu
- package: jwst
repository: spacetelescope/jwst
extras: [ test ]
pytest_args: '--slow -k "not test_cmdline_status"'
env:
CRDS_SERVER_URL: https://jwst-crds.stsci.edu
#- package: stistools
# repository: spacetelescope/stistools
# - package: stsynphot
Expand Down Expand Up @@ -166,6 +147,85 @@ jobs:
env:
CRDS_SERVER_URL: ${{ matrix.env.CRDS_SERVER_URL }}
working-directory: ${{ matrix.package }}
unit_tests_via_tox:
name: ${{ matrix.package }} (py${{ matrix.python-version }}, ${{ matrix.runs-on }})
needs: [ build ]
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
package: [ acstool, jwst ]
runs-on: [ ubuntu-latest, macos-latest ]
python-factor: [ 'py39', 'py310', 'py311' ]
include:
- package: acstools
repository: spacetelescope/acstools
default_factors: test-alldeps
pytest_args: --remote-data -v
- package: asdf
repository: asdf-format/asdf
default_factors: parallel
- package: calcos
repository: spacetelescope/calcos
default_factors: xdist
- package: ccdproc
repository: astropy/ccdproc
default_factors: alldeps
- package: costools
repository: spacetelescope/costools
default_factors: xdist
- package: synphot
repository: spacetelescope/reftools
default_factors: test
pytest_args: --remote-data
- package: jwst
repository: spacetelescope/jwst
default_factors: xdist
pytest_args: --slow -k "not test_cmdline_status"
exclude:
- runs-on: macos-latest
python-factor: py39
- runs-on: macos-latest
python-factor: py310
steps:
- uses: actions/checkout@v4
with:
path: stenv
- uses: mamba-org/setup-micromamba@v1
with:
environment-name: stenv-${{ runner.os }}-py${{ matrix.python-version }}
environment-file: stenv/environment.yaml
create-args: >-
python=${{ matrix.python-version }}
conda
cache-downloads: true
cache-downloads-key: downloads-${{ needs.build.outputs.date }}
cache-environment: true
cache-environment-key: environment-${{ needs.build.outputs.date }}
init-shell: none
generate-run-shell: true
- run: echo "version=$(conda list | awk '$1 == "${{ matrix.package }}" {print $2}')" >> $GITHUB_OUTPUT
id: package_version
# TODO: figure out a better way to use package version when checking out a Git ref
- uses: actions/checkout@v4
with:
path: ${{ matrix.package }}
repository: ${{ matrix.repository }}
ref: ${{ steps.package_version.outputs.version }}
- run: micromamba install tox
- run: conda env export --no-build | grep -v "name:" | grep -v "prefix:"
- if: matrix.env.CRDS_SERVER_URL != ''
run: echo "context=$(crds list --operational-context)" >> $GITHUB_OUTPUT
id: crds-context
env:
CRDS_SERVER_URL: ${{ matrix.env.CRDS_SERVER_URL }}
- if: steps.crds-context.outputs.context != ''
uses: actions/cache@v4
with:
path: ${{ env.CRDS_PATH }}
key: crds-${{ matrix.package }}-${{ steps.crds-context.outputs.context }}
- run: tox -e ${{ matrix.python-factor }}${{ matrix.default_factors != '' || '-' }}${{ matrix.default_factors }}${{ matrix.pytest_args != '' || ' -- ' }}${{ matrix.pytest_args }}
working-directory: ${{ matrix.package }}
smoke_tests:
name: ${{ matrix.package }} (py${{ matrix.python-version }}, ${{ matrix.runs-on }})
needs: [ build ]
Expand Down

0 comments on commit 97f077e

Please sign in to comment.