Merge #2188 (DougBurke) - TEST: address numpy 2 changes to output for… #131
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Conda CI | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- '*' | |
pull_request: | |
#Reduces GH Action duplication: | |
# Cancels the previous pipeline for this ref it is still running | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
xspec_channel: "https://cxc.cfa.harvard.edu/conda/xspec" | |
CONDA_BUILD_SYSROOT: ${{ github.workspace }}/11.0SDK/MacOSX11.0.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.14.0i | |
- name: Linux Minimum Setup (Python 3.10) | |
os: ubuntu-latest | |
python-version: "3.10" | |
numpy-version: "1.24" | |
install-type: develop | |
test-data: none | |
- name: Linux Minimum Setup (Python 3.11) | |
os: ubuntu-latest | |
python-version: "3.11" | |
numpy-version: "1.24" | |
install-type: develop | |
test-data: none | |
- name: Linux Full Build (Python 3.12) | |
os: ubuntu-latest | |
python-version: "3.12" | |
install-type: develop | |
fits: astropy | |
test-data: submodule | |
matplotlib-version: 3 | |
bokeh-version: 3 | |
xspec-version: 12.14.0i | |
- 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.14.0i | |
- 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.1 | |
- 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.12" | |
numpy-version: "1.26" | |
install-type: develop | |
fits: astropy | |
test-data: none | |
steps: | |
- name: Checkout Code | |
uses: actions/[email protected] | |
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 | |
# We need xvfb to run the tests so ensure it's installed | |
pip install pytest-xvfb | |
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 .[test] --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 .[test] --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 | |
- 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: | | |
# This may not be relevant any more but left in as a | |
# warning note. We could change this to say something | |
# like the following, but with a way of pointing to | |
# the test-data directory | |
# | |
# cd $HOME | |
# pytest --pyargs sherpa --cov sherpa --cov-report xml:${{ github.workspace }}/coverage.xml | |
# | |
# but is it worth it? | |
# | |
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 | |
# Note that it looks like macOS does not install DS9 at the | |
# moment, but leave this in | |
export PATH="${PATH}:/opt/X11/bin" | |
fi | |
source ${CONDA}/etc/profile.d/conda.sh | |
conda activate build | |
conda install -yq pytest-cov | |
pytest --pyargs sherpa --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 | |