-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
222 lines (187 loc) · 6.91 KB
/
macos_meson.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
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
219
220
221
222
name: macOS tests (meson)
on:
push:
branches:
- maintenance/**
pull_request:
branches:
- main
- maintenance/**
permissions:
contents: read # to fetch code (actions/checkout)
env:
INSTALLDIR: "build-install"
CCACHE_DIR: "${{ github.workspace }}/.ccache"
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
get_commit_message:
name: Get commit message
uses: ./.github/workflows/commit_message.yml
test_meson:
name: Meson build
needs: get_commit_message
# If using act to run CI locally the github object does not exist and
# the usual skipping should not be enforced
if: >
needs.get_commit_message.outputs.message == 1
&& (github.repository == 'scipy/scipy' || github.repository == '')
runs-on: macos-latest
strategy:
matrix:
python-version: ["3.11"]
steps:
- uses: actions/checkout@v4.1.1
with:
submodules: recursive
- name: Install Ccache
run: |
brew install ccache
- name: Prepare compiler cache
id: prep-ccache
shell: bash -l {0}
run: |
mkdir -p "${CCACHE_DIR}"
echo "dir=$CCACHE_DIR" >> $GITHUB_OUTPUT
NOW=$(date -u +"%F-%T")
echo "timestamp=${NOW}" >> $GITHUB_OUTPUT
- name: Setup compiler cache
uses: actions/cache@v3
id: cache-ccache
# Reference: https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows#matching-a-cache-key
# NOTE: The caching strategy is modeled in a way that it will always have
# a unique cache key for each workflow run (even if the same workflow is
# run multiple times). The restore keys are not unique and for a partial
# match, they will return the most recently created cache entry,
# according to the GitHub Action Docs.
with:
path: ${{ steps.prep-ccache.outputs.dir }}
key: ${{ github.workflow }}-${{ matrix.python-version }}-ccache-macos-${{ steps.prep-ccache.outputs.timestamp }}
# This evaluates to `macOS Tests-3.10-ccache-macos-` which is not
# unique. As the CI matrix is expanded, this will need to be updated to
# be unique so that the cache is not restored from a different job altogether.
restore-keys: |
${{ github.workflow }}-${{ matrix.python-version }}-ccache-macos-
- name: Setup Conda
uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python-version }}
channels: conda-forge
channel-priority: true
activate-environment: scipy-dev
use-only-tar-bz2: false
miniforge-variant: Mambaforge
miniforge-version: latest
use-mamba: true
- name: Get Date
id: get-date
run: echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
shell: bash
- name: Cache conda
uses: actions/cache@v3
env:
# Increase this value to reset cache if environment.yml has not changed
CACHE_NUMBER: 1
with:
path: ${{ env.CONDA }}/envs/scipy-dev
key:
${{ runner.os }}--${{ steps.get-date.outputs.today }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment.yml') }}
id: envcache
- name: Update Conda Environment
run: mamba env update -n scipy-dev -f environment.yml
if: steps.envcache.outputs.cache-hit != 'true'
- name: Build and Install SciPy
shell: bash -l {0}
run: |
conda activate scipy-dev
# optional test dependencies
mamba install scikit-umfpack scikit-sparse
# Python.org installers still use 10.9, so let's use that too. Note
# that scikit-learn already changed to 10.13 in Jan 2021, so increasing
# this number in the future (if needed) should not be a problem.
# Conda-forge is still at 10.9, see:
# https://conda-forge.org/docs/maintainer/knowledge_base.html#requiring-newer-macos-sdks
export MACOSX_DEPLOYMENT_TARGET=10.9
export MACOSX_SDK_VERSION=10.9
CC="ccache $CC" python dev.py build
- name: Test SciPy
shell: bash -l {0}
run: |
conda activate scipy-dev
export OMP_NUM_THREADS=2
python dev.py -n test -j2
- name: Ccache statistics
shell: bash -l {0}
run: |
ccache -s
test_scipy_openblas:
name: M1 test - openblas
needs: get_commit_message
# If using act to run CI locally the github object does not exist and
# the usual skipping should not be enforced
if: >
needs.get_commit_message.outputs.message == 1
&& (github.repository == 'scipy/scipy' || github.repository == '')
runs-on: macos-14
strategy:
matrix:
python-version: ["3.11"]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Build and Install SciPy
run: |
sudo xcode-select -s /Applications/Xcode_15.2.app
git submodule update --init
# for some reason gfortran is not on the path
GFORTRAN_LOC=$(brew --prefix gfortran)/bin/gfortran
ln -s $GFORTRAN_LOC gfortran
export PATH=$PWD:$PATH
# make sure we have openblas
bash tools/wheels/cibw_before_build_macos.sh $PWD
export DYLD_LIBRARY_PATH=/usr/local/gfortran/lib:/opt/arm64-builds/lib
export PKG_CONFIG_PATH=/opt/arm64-builds/lib/pkgconfig
pip install click doit pydevtool rich_click meson cython pythran pybind11 ninja numpy
python dev.py build
pip install pooch pytest hypothesis
python dev.py -n test
test_meson_accelerate:
name: Meson build (Accelerate)
needs: get_commit_message
# If using act to run CI locally the github object does not exist and
# the usual skipping should not be enforced
if: >
needs.get_commit_message.outputs.message == 1
&& (github.repository == 'scipy/scipy' || github.repository == '')
runs-on: macos-14
strategy:
matrix:
python-version: ["3.11"]
steps:
- uses: actions/checkout@v4.1.1
with:
submodules: recursive
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Build and Install SciPy
run: |
sudo xcode-select -s /Applications/Xcode_15.2.app
git submodule update --init
# for some reason gfortran is not on the path
GFORTRAN_LOC=$(brew --prefix gfortran)/bin/gfortran
ln -s $GFORTRAN_LOC gfortran
export PATH=$PWD:$PATH
pip install click doit pydevtool rich_click meson cython pythran pybind11 ninja numpy
python dev.py build -C-Dblas=accelerate
pip install pooch pytest hypothesis
python dev.py -n test