forked from scipy/scipy
-
Notifications
You must be signed in to change notification settings - Fork 2
129 lines (111 loc) · 4.15 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
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:
test_meson:
name: Meson build
# If using act to run CI locally the github object does not exist and the usual skipping should not be enforced
if: "github.repository == 'scipy/scipy' || github.repository == ''"
runs-on: macos-latest
strategy:
matrix:
python-version: ["3.11"]
steps:
- uses: actions/checkout@v3
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@v2
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
export SCIPY_USE_PROPACK=1
python dev.py -n test -j2
- name: Ccache statistics
shell: bash -l {0}
run: |
ccache -s