-
Notifications
You must be signed in to change notification settings - Fork 32
177 lines (146 loc) · 5.07 KB
/
build.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
name: Build
on: [push, pull_request]
jobs:
test-linux:
name: "Run tests on Linux"
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.12", "3.11", "3.10", "3.9"]
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python }}
- name: Run Tests (Linux)
run: |
python -m pip install --upgrade pip setuptools wheel meson ninja meson-python cython numpy
python -m pip install --no-build-isolation --editable '.[test]'
pytest --cov --cov-report html --cov-report xml --cov-report annotate -s
- uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
verbose: true # optional (default = false)
test-macos:
name: "Run tests on MacOS"
runs-on: macos-12
env:
# LDFLAGS: "-ld64" # For MacOS 13 and above (XCode CLT 15 and above.)
CC: gcc-12
CXX: gcc-12
FC: gfortran-12
DUCC0_NUM_THREADS: 2
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
with:
python-version: "3.10"
- name: Install Dependencies (MacOS)
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install numpy "Cython<3.0.4"
- name: Install Package (MacOS)
# The built-in fortran compiler does not link to gfortran (just numbered versions)
# and build_ext does not play nicely with that. So we link gfortran-X to gfortran.
run: |
ln -s $FC $(dirname $(which $FC))/gfortran
echo "Using FC=$FC CXX=$CXX CC=$CC"
python -m pip install .
- name: Run Tests (MacOS)
run: |
pytest -s
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
# macos-13 is an intel runner, macos-14 is apple silicon
os: [ubuntu-latest, macos-13]
steps:
- uses: actions/checkout@v4
- name: Build wheels
uses: pypa/[email protected]
env:
FC: gfortran-12
CC: gcc-12
MACOSX_DEPLOYMENT_TARGET: "13.0"
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
build_wheels_macos_arm:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
# macos-13 is an intel runner, macos-14 is apple silicon
os: [macos-14]
steps:
- uses: actions/checkout@v4
- name: Build wheels
uses: pypa/[email protected]
env:
FC: gfortran-12
CC: gcc-12
MACOSX_DEPLOYMENT_TARGET: "14.0"
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: '3.10'
- name: Build sdist
run: |
python -m pip install -U pip
python -m pip install -U setuptools
python -m pip install --upgrade pip setuptools wheel
python -m pip install "Cython<3.0.4"
python -m pip install numpy
python -m pip install build
python -m build . --sdist
- uses: actions/upload-artifact@v2
with:
path: dist/*.tar.gz
upload_pypi:
needs: [build_wheels, build_sdist, build_wheels_macos_arm]
runs-on: ubuntu-latest
# upload to PyPI on every tag starting with 'v'
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
# alternatively, to publish when a GitHub Release is created, use the following rule:
# if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v2
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
# To test: repository_url: https://test.pypi.org/legacy/
# Automatically upload builds to PyPI test when all tests pass.
# Requires some thought about versioning before activating.
# upload_pypi_test:
# needs: [build_wheels_linux, build_wheels_macos, build_sdist]
# runs-on: ubuntu-latest
# environment:
# name: testpypi
# url: https://test.pypi.org/p/pixell
# # Upload to pypi testing on every successful test run and build generation
# steps:
# - uses: actions/download-artifact@v2
# with:
# name: artifact
# path: dist
# - uses: pypa/gh-action-pypi-publish@release/v1
# with:
# repository-url: https://test.pypi.org/legacy/
# user: __token__
# password: ${{ secrets.PYPI_TEST_TOKEN }}