-
Notifications
You must be signed in to change notification settings - Fork 59
218 lines (193 loc) · 7.4 KB
/
tests.yml
File metadata and controls
218 lines (193 loc) · 7.4 KB
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
name: Tests
on:
push:
branches:
- main
- "*.x" # for bugfix branches, like v1.10.x
tags:
- "*"
pull_request:
schedule:
- cron: "0 10 * * 1" # Mondays @ 6AM Eastern
jobs:
check_skip_flags:
name: Check skip flags
runs-on: ubuntu-latest
outputs:
head-commit-message:
${{ steps.get_head_commit_message.outputs.HEAD_COMMIT_MESSAGE }}
steps:
- name: Checkout repo
uses: actions/checkout@v6
with:
ref: ${{ env.GITHUB_SHA }}
- name: Get head commit message
id: get_head_commit_message
run: echo "HEAD_COMMIT_MESSAGE=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT"
tests:
name:
Python ${{ matrix.python-version }} on ${{ matrix.os }} with numpy ${{
matrix.numpy-version }}, no gsl ${{ matrix.gala-nogsl }}, deps ${{
matrix.python-extras }}, EXP ${{ matrix.gala-exp }}
runs-on: ${{ matrix.os }}
needs: check_skip_flags
if:
${{ github.event.pull_request.draft == false &&
!contains(github.event.pull_request.labels.*.name, 'skip tests') &&
!contains(needs.check_skip_flags.outputs.head-commit-message, '[skip tests]') }}
env:
# Run tests against a tagged EXP version, unless this is the devel branch or a PR into devel, in which case test against EXP devel
EXP_REF: ${{ (github.ref == 'refs/heads/devel' || (github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'devel')) && 'devel' || 'v7.9.1' }}
MACOSX_DEPLOYMENT_TARGET: "15.0"
strategy:
fail-fast: true
matrix:
python-version: ["3.12", "3.13", "3.14"]
os: ["ubuntu-latest", "macos-latest"]
astropy-version: ["latest"]
numpy-version: ["latest"]
scipy-version: ["latest"]
gala-nogsl: ["0"]
python-extras: ["test"]
gala-exp: ["0"]
include:
- name: Oldest astropy, numpy, and scipy versions supported
os: ubuntu-latest
python-version: "3.11"
astropy-version: "6.0.1"
numpy-version: "1.26"
scipy-version: "1.12"
gala-nogsl: "0"
gala-exp: "0"
python-extras: "test"
- name: Install without GSL
os: ubuntu-latest
python-version: "3.13"
astropy-version: "latest"
numpy-version: "latest"
scipy-version: "latest"
gala-nogsl: "1"
gala-exp: "0"
python-extras: "test"
- name: With optional dependencies
os: ubuntu-latest # note: galpy install failed on macos here
python-version: "3.13"
astropy-version: "latest"
numpy-version: "latest"
scipy-version: "latest"
gala-nogsl: "0"
gala-exp: "0"
python-extras: "test,extra"
- name: With EXP
os: ubuntu-latest
python-version: "3.13"
astropy-version: "latest"
numpy-version: "latest"
scipy-version: "latest"
gala-nogsl: "0"
gala-exp: "1"
python-extras: "test"
- name: With EXP
os: macos-latest
python-version: "3.13"
astropy-version: "latest"
numpy-version: "latest"
scipy-version: "latest"
gala-nogsl: "0"
gala-exp: "1"
python-extras: "test"
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- uses: astral-sh/setup-uv@v7
with:
version: "0.9.0"
# For animation tests
- uses: FedericoCarboni/setup-ffmpeg@v3
if: ${{ !startsWith(matrix.os, 'mac') }}
continue-on-error: true
with:
# Not strictly necessary, but it may prevent rate limit
# errors especially on GitHub-hosted macos machines.
github-token: ${{ secrets.GITHUB_TOKEN }}
ffmpeg-version: "6.1.0"
id: setup-ffmpeg
# Mac:
- name: Setup Mac - GSL
if: startsWith(matrix.os, 'mac')
run: |
brew update
brew install gsl
# Ubuntu:
- name: Setup Linux - GSL
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install gsl-bin libgsl0-dev build-essential
- name: Clone EXP
if: matrix.gala-exp == '1'
uses: actions/checkout@v6
with:
repository: EXP-code/EXP
ref: ${{ env.EXP_REF }}
submodules: recursive
path: EXP
- name: Install EXP dependencies (Linux)
if: runner.os == 'Linux' && matrix.gala-exp == '1'
run: |
sudo apt-get install -y libeigen3-dev libfftw3-dev libopenmpi-dev libomp-dev libhdf5-dev
- name: Install EXP dependencies (Mac)
if: startsWith(matrix.os, 'mac') && matrix.gala-exp == '1'
run: |
brew install eigen@3 fftw open-mpi hdf5 llvm libomp flang
echo CC=mpicc >> $GITHUB_ENV
echo CXX=mpicxx >> $GITHUB_ENV
echo FC=mpifort >> $GITHUB_ENV
echo "$(brew --prefix llvm)/bin" >> $GITHUB_PATH
echo OMPI_CC="$(brew --prefix llvm)/bin/clang" >> $GITHUB_ENV
echo OMPI_CXX="$(brew --prefix llvm)/bin/clang++" >> $GITHUB_ENV
echo OMPI_FC="$(brew --prefix flang)/bin/flang" >> $GITHUB_ENV
echo PKG_CONFIG_PATH="$(brew --prefix eigen@3)/share/pkgconfig:$PKG_CONFIG_PATH" >> $GITHUB_ENV
echo CPPFLAGS="-I$(brew --prefix eigen@3)/include $CPPFLAGS" >> $GITHUB_ENV
echo CMAKE_PREFIX_PATH="$(brew --prefix eigen@3)" >> $GITHUB_ENV
# c++ library path is workaround for clang bug https://github.com/llvm/llvm-project/issues/155531
sdkroot=$(xcrun --show-sdk-path)
echo "CXXFLAGS=-nostdinc++ -isystem $sdkroot/usr/include/c++/v1 -isystem $sdkroot/usr/include" >> $GITHUB_ENV
- name: Build EXP
if: matrix.gala-exp == '1'
uses: ./.github/actions/build-exp
- name: Install package and dependencies
run: |
uv pip install --system -ve .[${{ matrix.python-extras }}]
env:
GALA_NOGSL: ${{ matrix.gala-nogsl }}
- name: Update numpy version if testing min version
if: matrix.numpy-version != 'latest'
run: |
uv pip install --system numpy~=${{ matrix.numpy-version }}
- name: Update scipy version if testing min version
if: matrix.scipy-version != 'latest'
run: |
uv pip install --system scipy~=${{ matrix.scipy-version }}
- name: Update astropy version if testing min version
if: matrix.astropy-version != 'latest'
run: |
uv pip install --system astropy~=${{ matrix.astropy-version }}
- name: Run tests
env:
GALA_FORCE_EXP_TEST: ${{ matrix.gala-exp }}
GALA_FORCE_PYEXP_TEST: ${{ matrix.gala-exp }}
OMP_NUM_THREADS: 1
run: |
if [[ "${{ matrix.gala-exp }}" == "1" ]]; then
uv run pytest tests/potential/potential/test_exp.py -n auto -ra --cov --cov-report=xml --cov-report=term-missing
else
uv run pytest -n auto -ra --cov --cov-report=xml --cov-report=term-missing --durations=20
fi
- name: Upload coverage report
uses: codecov/codecov-action@v5.5.2
with:
token: ${{ secrets.CODECOV_TOKEN }}