-
Notifications
You must be signed in to change notification settings - Fork 13
166 lines (141 loc) · 5.54 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
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