-
Notifications
You must be signed in to change notification settings - Fork 14
138 lines (116 loc) · 4.57 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
name: Piff CI
on:
push:
branches:
- main
- releases/*
pull_request:
branches:
- main
- releases/*
jobs:
build:
runs-on: ${{ matrix.os }}
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 ]
CC: [ gcc ]
CXX: [ g++ ]
# Add some other particular combinations to test
include:
# A couple in MacOS
- os: macos-latest
py: "3.10"
CC: cc
CXX: c++
# Check one with clang compiler
- os: ubuntu-latest
py: 3.11
CC: clang
CXX: clang++
steps:
- uses: actions/checkout@v3
with:
# Helpful for a reliable codecov upload.
fetch-depth: 0
- name: Set up Python ${{ matrix.py }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.py }}
- name: Cache pip
uses: actions/cache@v3
with:
path: ~/.cache/pip
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-get -qq update
sudo -H apt-get install -y libfftw3-dev libeigen3-dev
- name: Install libfftw, etc. on MacOS
if: matrix.os == 'macos-latest'
run: |
echo ${{ matrix.os }}
brew update || true
brew install fftw eigen || true
brew link --overwrite fftw eigen || true
brew unlink fftw && brew link fftw || true
brew unlink eigen && brew link eigen || true
ls /opt/homebrew/Cellar/fftw/3.3.10_1/
ls /opt/homebrew/Cellar/fftw/3.3.10_1/*
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist
sleep 5m
locate libfftw3.dylib
- name: Install dependencies with pip
run: |
python -m pip install -U pip
# Do these first to clarify potential conflicts
pip install -U setuptools numpy
# 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 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
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@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: tests/coverage.xml
fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)