-
Notifications
You must be signed in to change notification settings - Fork 7
157 lines (135 loc) · 4.85 KB
/
cibuildwheel.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
# adapted from:
# - https://github.com/matplotlib/matplotlib/blob/master/.github/workflows/cibuildwheel.yml
# - https://github.com/scikit-image/scikit-image/blob/master/.github/workflows/cibuildwheel.yml
# - https://github.com/pypa/cibuildwheel/blob/main/examples/github-deploy.yml
# - https://github.com/stardist/stardist/blob/master/.github/workflows/cibuildwheel.yml
name: tests
on:
push:
branches:
- main
- wheels
release:
types:
- published
pull_request:
branches: [ "main" ]
jobs:
test:
name: Test on ${{ matrix.os }} with Python ${{ matrix.py }}
runs-on: ${{ matrix.os }}
if: github.event_name == 'push' && contains(github.ref, 'main')
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
py: [cp311, cp312]
steps:
- uses: actions/checkout@v4
name: Checkout repository
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.x'
- name: Install cibuildwheel
run: python -m pip install cibuildwheel
- name: Build wheels for CPython (Linux)
run: |
python -m cibuildwheel --output-dir dist
env:
# only build for specific platforms
CIBW_BUILD: "${{ matrix.py }}-*{x86_64,win_amd64}"
CIBW_SKIP: "*musllinux*"
CIBW_BUILD_VERBOSITY: 1
CIBW_TEST_REQUIRES: pytest pytest-cov
CIBW_TEST_COMMAND: pytest -v --cov=spotiflow {project}
build_wheels:
name: Build ${{ matrix.py }} wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
if: (github.event_name == 'release' && github.event.action == 'published') || (github.event_name == 'push' && contains(github.ref, 'wheels')) || github.event_name == 'pull_request'
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, windows-2019, macos-13]
py: [cp39, cp310, cp311, cp312]
steps:
- uses: actions/checkout@v4
name: Checkout repository
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.x'
- name: Install cibuildwheel
run: python -m pip install cibuildwheel
# https://scikit-learn.org/stable/developers/advanced_installation.html#macos
- name: Setup OpenMP (macOS)
if: startsWith(matrix.os, 'macos')
shell: bash
run: |
brew config
brew install libomp
eval `brew shellenv`
tee -a $GITHUB_ENV << END
CC=/usr/bin/clang
CXX=/usr/bin/clang++
CFLAGS=${CFLAGS} -I${HOMEBREW_PREFIX}/opt/libomp/include
CXXFLAGS=${CXXFLAGS} -I${HOMEBREW_PREFIX}/opt/libomp/include
LDFLAGS=${LDFLAGS} -Wl,-rpath,${HOMEBREW_PREFIX}/opt/libomp/lib -L${HOMEBREW_PREFIX}/opt/libomp/lib -lomp
END
- name: Build wheels for CPython (macOS)
if: startsWith(matrix.os, 'macos')
run: |
python -m cibuildwheel --output-dir dist
env:
CIBW_BUILD: "${{ matrix.py }}-*"
CIBW_ARCHS_MACOS: arm64
CIBW_BUILD_VERBOSITY: 1
CIBW_TEST_REQUIRES: pytest pytest-cov
CIBW_TEST_COMMAND: pytest -v --cov=spotiflow {project}
- name: Build wheels for CPython (Linux and Windows)
if: startsWith(matrix.os, 'macos') == false
run: |
python -m cibuildwheel --output-dir dist
env:
# only build for specific platforms
CIBW_BUILD: "${{ matrix.py }}-*{x86_64,win_amd64}"
CIBW_SKIP: "*musllinux*"
CIBW_BUILD_VERBOSITY: 1
CIBW_TEST_REQUIRES: pytest pytest-cov
CIBW_TEST_COMMAND: pytest -v --cov=spotiflow {project}
- uses: actions/upload-artifact@v3
name: Upload wheels
with:
name: dist
path: ./dist/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
if: (github.event_name == 'release' && github.event.action == 'published') || (github.event_name == 'push' && contains(github.ref, 'wheels'))
steps:
- uses: actions/checkout@v4
name: Checkout repository
- name: Build sdist
run: pipx run build --sdist
- uses: actions/upload-artifact@v3
name: Upload sdist
with:
name: dist
path: dist/*.tar.gz
upload_pypi:
name: Upload to PyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
if: (github.event_name == 'release' && github.event.action == 'published') || (github.event_name == 'push' && contains(github.ref, 'wheels'))
steps:
- uses: actions/download-artifact@v3
name: Download wheels and sdist
with:
name: dist
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
name: Publish to PyPI
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
verbose: true