Add pyproject.toml #488
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: Piff CI | |
on: | |
push: | |
branches: | |
- main | |
- runci | |
- releases/* | |
pull_request: | |
branches: | |
- main | |
- runci | |
- releases/* | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
# First all python versions in basic linux | |
os: [ ubuntu-latest ] | |
py: [ 3.8, 3.9, "3.10", 3.11, 3.12 ] | |
CC: [ gcc ] | |
CXX: [ g++ ] | |
FFTW_DIR: [ "/usr/local/lib/" ] | |
# Add some other particular combinations to test | |
include: | |
# A couple in MacOS | |
# I've been getting random seg faults in macos runs lately. | |
# Note sure what the problem is, but for now just disable macos CI. | |
#- os: macos-latest | |
#- os: macos-13 | |
#py: "3.10" | |
#CC: cc | |
#CXX: c++ | |
#FFTW_DIR: "/opt/homebrew/lib/" | |
#FFTW_DIR: "/usr/local/lib" | |
# Check one with clang compiler | |
- os: ubuntu-latest | |
py: 3.11 | |
CC: clang | |
CXX: clang++ | |
FFTW_DIR: "/usr/local/lib/" | |
env: | |
# Need to put this here. export doesn't work. | |
# cf. https://github.com/orgs/community/discussions/26013 | |
FFTW_DIR: ${{ matrix.FFTW_DIR }} | |
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 | |
$HOME/Library/Caches/Homebrew | |
/usr/local/Cellar | |
key: ${{ runner.os }}-${{ matrix.py }}-pip-${{ hashFiles('requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.py }}-pip- | |
${{ runner.os }}- | |
- name: Install libfftw, etc. on linux (needed for GalSim) | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
echo ${{ matrix.os }} | |
sudo -H apt update -y | |
sudo -H apt install -y libfftw3-dev libeigen3-dev | |
ls $FFTW_DIR | |
- name: Install libfftw, etc. on MacOS | |
if: matrix.os == 'macos-13' | |
run: | | |
echo ${{ matrix.os }} | |
brew update || true | |
brew install fftw eigen || true | |
brew link --overwrite fftw eigen || true | |
ls -lF /usr/local | |
ls -lF /usr/local/lib | |
ls -lF /usr/local/Cellar | |
ls $FFTW_DIR | |
- name: Install dependencies with pip | |
run: | | |
python -m pip install -U pip | |
# Do these first to clarify potential conflicts | |
pip install -U numpy | |
pip install -U setuptools | |
pip install -U wheel | |
# The prefix is required for recent MacOS, because of System Integrity Protection. | |
# It's not necessary on Linux, but is harmless enough. | |
FFTW_DIR=$FFTW_DIR pip install -U galsim | |
# Standard dependencies | |
pip install -U -r requirements.txt | |
# Extra packages needed for testing | |
# Note: Pin pillow <10 until this bug is fixed: | |
# https://github.com/python-pillow/Pillow/issues/7259 | |
pip install -U nose coverage "pytest<8" nbval ipykernel "pillow<10" | |
- name: Install Jax | |
if: matrix.py == 3.9 || matrix.py == 3.10 || matrix.py == 3.11 || matrix.py == 3.12 | |
run: | | |
pip install -U jax | |
- name: Install Pixmappy (not on pip) | |
run: | | |
git clone https://github.com/gbernstein/pixmappy.git | |
cd pixmappy | |
pip install -vvv . | |
cd .. | |
- name: List all installed packages for reference | |
run: pip list | |
- name: Enable Agg backend | |
# The .matplotlib file needs to be in $HOME to work right. | |
run: | | |
cp -r tests/.matplotlib $HOME | |
- name: Build Piff | |
run: pip install -vvv . | |
- name: Run unit tests | |
run: | | |
cd tests | |
coverage run -m pytest -v | |
coverage combine || true | |
coverage report | |
coverage xml | |
ls -lsart | |
cd .. # N.B. This seems to happen automatically if omitted. | |
# Less confusing to include it explicitly. | |
- name: Test Tutorial notebook | |
if: matrix.py == 3.9 | |
run: | | |
cd examples | |
pytest --nbval Tutorial.ipynb --sanitize-with sanitize.cfg --current-env | |
cd .. | |
- name: Upload coverage to codecov | |
uses: codecov/codecov-action@v4 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
with: | |
files: tests/coverage.xml | |
fail_ci_if_error: false | |
verbose: true |