-
Notifications
You must be signed in to change notification settings - Fork 2
143 lines (120 loc) · 3.85 KB
/
wheels.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
name: Build
on: [push, pull_request]
jobs:
build_wheels:
name: Build ${{ matrix.label }} wheels
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
label: "linux-target-x86_64"
- os: macos-13
label: "macos-target-x86_64"
env:
MACOSX_DEPLOYMENT_TARGET: "10.15"
CIBW_ARCHS_MACOS: "x86_64"
- os: macos-13
label: "macos-target-arm64"
env:
MACOSX_DEPLOYMENT_TARGET: "11"
CIBW_ARCHS_MACOS: "arm64"
CC: "Clang"
CXX: "Clang++"
env:
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.env.MACOSX_DEPLOYMENT_TARGET }}
CIBW_ARCHS_MACOS: ${{ matrix.env.CIBW_ARCHS_MACOS }}
CC: ${{ matrix.env.CC }}
CXX: ${{ matrix.env.CXX }}
CIBW_CONFIG_SETTINGS: "cmake.verbose=true"
CIBW_BUILD_VERBOSITY: 1
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set OpenMP env for macos x86_64
if: matrix.label == 'macos-target-x86_64'
run: |
brew install libomp
prefix=$(brew --prefix libomp)
echo "LDFLAGS=$LDFLAGS -L$prefix/lib" >> $GITHUB_ENV
echo "CXXFLAGS=$CXXFLAGS -I$prefix/include" >> $GITHUB_ENV
- name: Set OpenMP env for macos arm64
if: matrix.label == 'macos-target-arm64'
run: |
pkg=$(brew fetch --force --bottle-tag=arm64_ventura libomp | grep 'Downloaded to' | cut -d' ' -f3)
brew install $pkg
prefix=$(brew --prefix libomp)
echo "LDFLAGS=$LDFLAGS -L$prefix/lib -lomp" >> $GITHUB_ENV
echo "CXXFLAGS=$CXXFLAGS -I$prefix/include -target arm64-apple-macos11 -Xpreprocessor -fopenmp" >> $GITHUB_ENV
- name: Build wheels
uses: pypa/[email protected]
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.label }}
path: ./wheelhouse/*.whl
# - name: Setup tmate session
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
# with:
# limit-access-to-actor: true
make_sdist:
name: Make SDist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build SDist
run: |
pip install -U build
python -m build --sdist
- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz
test_arm64_wheels:
needs: [build_wheels]
runs-on: macos-14
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/download-artifact@v4
with:
name: cibw-wheels-macos-target-arm64
path: wheelhouse/
- name: Install arm64 wheels
run: |
pip install -U pip
pip install -f wheelhouse/ nifty-ls[test]
# ensure that the previous install didn't resolve to PyPI
pip install --no-index -f wheelhouse/ nifty-ls[test]
- name: Run tests
run: |
pytest --benchmark-skip tests/
upload_all:
needs: [build_wheels, make_sdist, test_arm64_wheels]
environment: pypi
permissions:
id-token: write
runs-on: ubuntu-latest
# TODO: only run on release
# if: github.event_name == 'release' && github.event.action == 'published'
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v4
with:
pattern: cibw-*
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1