Don't test with halotools on ci, and skip test if numpy 2.0 #456
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: TreeCorr CI | |
on: | |
push: | |
branches: | |
- main | |
- runci | |
- releases/* | |
pull_request: | |
branches: | |
- main | |
- releases/* | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
env: | |
CC: ${{ matrix.CC }} | |
CXX: ${{ matrix.CXX }} | |
strategy: | |
matrix: | |
# First all python versions in basic linux | |
os: [ ubuntu-latest ] | |
py: [ 3.7, 3.8, 3.9, '3.10', 3.11, 3.12, 'pypy-3.10' ] | |
CC: [ gcc ] | |
CXX: [ g++ ] | |
# Add some other particular combinations to test | |
include: | |
# One in MacOS | |
- os: macos-latest | |
py: 3.11 | |
CC: cc | |
CXX: c++ | |
# Check one with clang compiler | |
- os: ubuntu-latest | |
py: 3.11 | |
CC: clang | |
CXX: clang++ | |
# Check one with gcc-11 | |
- os: ubuntu-latest | |
py: 3.11 | |
CC: gcc-11 | |
CXX: g++-11 | |
# Check one on Windows | |
- os: windows-latest | |
py: 3.11 | |
CC: gcc | |
CXX: g++ | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# Helpful for a reliable codecov upload. | |
fetch-depth: 0 | |
- name: Set up Python ${{ matrix.py }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.py }} | |
- name: Cache pip | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-${{ matrix.py }}-pip-${{ hashFiles('requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.py }}-pip- | |
${{ runner.os }}- | |
- name: Install mpi on linux | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
echo ${{ matrix.os }} | |
sudo -H apt-get -qq update | |
sudo -H apt-get install -y openmpi-bin libopenmpi-dev | |
- name: Install gcc-11 | |
if: matrix.CC == 'gcc-11' | |
run: | | |
echo ${{ matrix.CC }} | |
sudo -H apt-get -qq update | |
sudo -H apt-get install -y gcc-11 g++-11 | |
- name: Install mpi on MacOS | |
if: matrix.os == 'macos-latest' | |
# brew sometimes exits with 1 if things are already installed. | |
# continue-on-error means that this still counds as success for this step. | |
continue-on-error: true | |
run: | | |
echo ${{ matrix.os }} | |
brew update-reset | |
brew install openmpi | |
- name: Install basic dependencies | |
run: | | |
python -m pip install -U pip | |
# Do this first to clarify potential conflicts | |
pip install -U numpy | |
# Standard dependencies | |
pip install -U -r requirements.txt | |
# Extra packages needed for testing | |
pip install -U coverage mockmpi pytest | |
# Note: I'd rather include h5py here, but I can't get it to install properly | |
# on GHA for pypy3. So only do that for regular py3. | |
- name: Install py3.x dependencies | |
# They are slow to install on pypy, where some are installed from scratch. | |
if: matrix.py > 3.0 | |
run: | | |
pip install -U matplotlib nbval ipykernel scipy pandas guppy3 h5py pyarrow mpi4py | |
- name: Install fitsio everywhere but Windows | |
if: matrix.os != 'windows-latest' | |
run: | | |
pip install -U fitsio | |
- name: List all installed packages for reference | |
run: pip list | |
- name: Build TreeCorr | |
run: pip install -vvv . | |
- name: Run unit tests | |
run: | | |
cd tests | |
coverage run -m pytest -v | |
coverage combine | |
coverage xml | |
cd .. # N.B. This seems to happen automatically if omitted. | |
# Less confusing to include it explicitly. | |
- name: Upload coverage to codecov | |
if: matrix.os != 'windows-latest' | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: tests/coverage.xml | |
fail_ci_if_error: false | |
verbose: true | |
- name: Test MPI | |
# The code is already mostly checked in the main tests with mock_mpi. | |
# These just check that the code works when run in a real mpi session. | |
# Skip windows and pypy for this. | |
if: (matrix.os != 'windows-latest') && (matrix.py > 3.0) | |
run: | | |
cd tests | |
which -a mpiexec | |
which -a mpirun | |
mpiexec -n 2 --oversubscribe python -u mpi_test.py #>& mpi2.out | |
mpiexec -n 1 python -u mpi_test.py #>& mpi1.out | |
cd .. | |
- name: Test Tutorial notebook | |
if: matrix.py == '3.10' | |
run: | | |
cd tests | |
pytest --nbval Tutorial.ipynb --sanitize-with sanitize.cfg --current-env | |
cd .. | |