-
Notifications
You must be signed in to change notification settings - Fork 38
179 lines (149 loc) · 5.92 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
167
168
169
170
171
172
173
174
175
176
177
178
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 halotools
# halotools is currently (3/2024) broken on 3.7, 3.8, 3.12
# Just run on the ones we know it works.
if: ((matrix.py == '3.9') || (matrix.py == '3.10') || (matrix.py == '3.11')) && (matrix.os != 'windows-latest')
run: |
pip install -U halotools
- 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 ..