Skip to content

IO: separate pack and set commands #3267

IO: separate pack and set commands

IO: separate pack and set commands #3267

name: Conda CI
on:
push:
branches:
- main
tags:
- '*'
pull_request:
env:
xspec_channel: "xspec/label/test"
CONDA_BUILD_SYSROOT: ${{ github.workspace }}/10.14SDK/MacOSX10.14.sdk
jobs:
tests:
defaults:
run:
shell: bash
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- name: MacOS Full Build
os: macos-12
python-version: "3.10"
install-type: develop
fits: astropy
test-data: submodule
matplotlib-version: 3
xspec-version: 12.13.1
- name: Linux Minimum Setup (Python 3.9)
os: ubuntu-latest
python-version: "3.9"
numpy-version: "1.21"
install-type: develop
test-data: none
- name: Linux Minimum Setup (Python 3.11)
os: ubuntu-latest
python-version: "3.11"
numpy-version: "1.23"
install-type: develop
test-data: none
- name: Linux Full Build (Python 3.11)
os: ubuntu-latest
python-version: "3.11"
install-type: develop
fits: astropy
test-data: submodule
matplotlib-version: 3
bokeh-version: 3
xspec-version: 12.13.1
- name: Linux Full Build (Python 3.10)
os: ubuntu-latest
python-version: "3.10"
install-type: develop
fits: astropy
test-data: submodule
matplotlib-version: 3
xspec-version: 12.13.0c
- name: Linux Full Build (Python 3.9)
os: ubuntu-latest
python-version: "3.9"
install-type: develop
fits: astropy
test-data: submodule
matplotlib-version: 3
xspec-version: 12.12.0g
- name: Linux Build (w/o Astropy or Xspec)
os: ubuntu-latest
python-version: "3.11"
install-type: install
test-data: package
matplotlib-version: 3
- name: Linux Build (w/o Matplotlib, Xspec, or test data)
os: ubuntu-latest
python-version: "3.9"
numpy-version: "1.21"
install-type: develop
fits: astropy
test-data: none
steps:
- name: Checkout Code
uses: actions/checkout@v4.1.1
with:
submodules: 'True'
# https://stackoverflow.com/questions/63648591/how-to-install-x11-before-testing-with-github-actions-for-macos
- name: Install XQuartz on macOS
if: runner.os == 'macOS'
run: |
brew install --cask xquartz
- name: Conda Setup
env:
PYTHONVER: ${{ matrix.python-version }}
NUMPYVER: ${{ matrix.numpy-version }}
FITSBUILD: ${{ matrix.fits }}
MATPLOTLIBVER: ${{ matrix.matplotlib-version }}
BOKEHVER: ${{ matrix.bokeh-version }}
XSPECVER: ${{ matrix.xspec-version }}
run: |
source .github/scripts/setup_conda.sh
- name: Conda Setup (Xspec and DS9)
if: matrix.xspec-version != ''
env:
XSPECVER: ${{ matrix.xspec-version }}
run: |
source ${CONDA}/etc/profile.d/conda.sh
conda activate build
if [ "$RUNNER_OS" != "macOS" ]; then
source .github/scripts/setup_ds9.sh
fi
source .github/scripts/setup_xspec.sh
- name: Build Sherpa (install)
if: matrix.install-type == 'install'
env:
PYTHON_LDFLAGS: " "
run: |
source ${CONDA}/etc/profile.d/conda.sh
conda activate build
pip install . --verbose
- name: Build Sherpa (develop)
if: matrix.install-type == 'develop'
env:
PYTHON_LDFLAGS: " "
run: |
source ${CONDA}/etc/profile.d/conda.sh
conda activate build
pip install -e . --verbose
- name: Install the test data?
if: matrix.test-data == 'package'
run: |
source ${CONDA}/etc/profile.d/conda.sh
conda activate build
pip install ./sherpa-test-data
pip install pytest-xvfb
- name: Remove submodule
if: matrix.test-data == 'none' || matrix.test-data == 'package'
run: |
git submodule deinit -f .
# run the smoke test first as it's small/quick to do
- name: Smoke Tests
env:
XSPECVER: ${{ matrix.xspec-version }}
FITS: ${{ matrix.fits }}
run: |
if [ -n "${XSPECVER}" ]; then XSPECTEST="-x -d"; fi
if [ -n "${FITS}" ] ; then FITSTEST="-f ${FITS}"; fi
smokevars="${XSPECTEST} ${FITSTEST} -v 3"
# special case the macOS build as we currently do not
# include DS9; as we know the XSPECVER/FITS sittings for
# this it is hard-coded
if [ "$RUNNER_OS" == "macOS" ]; then
smokevars="-x -f ${FITS} -v 3"
fi
echo "** smoke test: ${smokevars}"
source ${CONDA}/etc/profile.d/conda.sh
conda activate build
cd /home
sherpa_smoke ${smokevars}
- name: Internal check
if: matrix.test-data == 'submodule' && matrix.install-type != 'develop'
env:
INSTALLTYPE: ${{ matrix.install-type }}
run: |
# At the moment "Submodule Tests" requires the develop
# install-type, otherwise the "python setup.py test" call will
# lead to the develop build to be re-run, meaning that the
# install option is not tested. When we change to pytest we
# can switch to something like 'cd $HOME; pytest sherpa'
#
echo "ERROR: submodule test can not be run with install-type=${INSTALLTYPE}"
exit 1
- name: Submodule Tests
if: matrix.test-data == 'submodule'
env:
INSTALLTYPE: ${{ matrix.install-type }}
run: |
if [ "$RUNNER_OS" == "macOS" ]; then
# make sure pytext-xvfb can find Xvfb
export PATH="${PATH}:/opt/X11/bin"
fi
source ${CONDA}/etc/profile.d/conda.sh
conda activate build
conda install -yq pytest-cov
python setup.py -q test -a "--cov sherpa --cov-report xml:${{ github.workspace }}/coverage.xml"
- name: sherpa_test Tests
if: matrix.test-data == 'package' || matrix.test-data == 'none'
run: |
source ${CONDA}/etc/profile.d/conda.sh
conda activate build
conda install -yq pytest-cov
cd $HOME
sherpa_test --cov sherpa --cov-report xml:${{ github.workspace }}/coverage.xml
- name: upload coverage
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ${{ github.workspace }}/coverage.xml
verbose: true