-
Notifications
You must be signed in to change notification settings - Fork 5
197 lines (162 loc) · 5.75 KB
/
publish.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
name: Publish Python packages
on:
push:
tags:
push:
pull_request:
workflow_dispatch:
jobs:
check-version:
name: Check the tag corresponds to the crate version
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Check Cargo.toml version vs Git tag
if: startsWith(github.ref, 'refs/tags/v')
working-directory: ./light-curve
run: |
cargo read-manifest | jq -r '.version' > /tmp/.crate_version
echo '${{ github.ref_name }}' | sed 's/^v//' > /tmp/.tag
diff /tmp/.crate_version /tmp/.tag
cibuildwheel:
name: Build ${{ matrix.cibw_build }}
runs-on: ${{ matrix.os }}
needs: check-version
defaults:
run:
working-directory: ./light-curve
strategy:
fail-fast: false
matrix:
# CIBW_BUILD identifiers from https://cibuildwheel.readthedocs.io/en/stable/options/#build-skip
# We use the same order as in the table
# * For Windows we support amd64 only
# * For Linux we support ARM64, PPC64le, and x86_64
# * We build wheels for CPython only, one per platform, compatible with ABI3.9
# * We skip PPC64le MUSL Linux, because there is no Rust toolchain for it
# * macos-13 runner is x86_64, macos-14 runner is arm64
include:
# CPython 3.9
- os: macos-13
cibw_build: cp39-macosx_x86_64
- os: macos-14
cibw_build: cp39-macosx_arm64
- os: windows-2019
cibw_build: cp39-win_amd64
- os: ubuntu-20.04
cibw_build: cp39-manylinux_x86_64
- os: ubuntu-20.04
cibw_build: cp39-musllinux_x86_64
- os: ubuntu-20.04
cibw_build: cp39-manylinux_aarch64
- os: ubuntu-20.04
cibw_build: cp39-manylinux_ppc64le
- os: ubuntu-20.04
cibw_build: cp39-musllinux_aarch64
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up QEMU on Linux
if: ${{ runner.os == 'Linux' }}
uses: docker/setup-qemu-action@v3
with:
platforms: all
# ARM macOS runner misses some peaces
- name: Set up Homebrew paths on ARM macOS
if: ${{ matrix.os == 'macos-14' }}
run: |
echo "CPATH=$(brew --prefix)/include:$(brew --prefix)/include/eigen3:${CPATH}" >> $GITHUB_ENV
echo "LIBRARY_PATH=$(brew --prefix)/lib:$(brew --prefix)/lib64:${LIBRARY_PATH}" >> $GITHUB_ENV
- name: Set MACOSX_DEPLOYMENT_TARGET to the current macOS version
if: ${{ runner.os == 'macOS' }}
run: |
export MACOSX_DEPLOYMENT_TARGET=$(sw_vers -productVersion | awk -F '.' '{print $1"."0}')
echo "MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET}" >> $GITHUB_ENV
# We only support AMD64 architecture for Windows, so we hard-code it here.
- name: Set CIBW envs on Windows
if: ${{ runner.os == 'Windows' }}
run: |
"CIBW_BUILD=${{ matrix.cibw_build }}" >> $env:GITHUB_ENV
"CIBW_ARCHS=AMD64" >> $env:GITHUB_ENV
- name: Set CIBW envs on Linux or macOS
if: ${{ runner.os != 'Windows' }}
run: |
echo "CIBW_BUILD=${{ matrix.cibw_build }}" >> $GITHUB_ENV
CIBW_ARCHS=$(echo ${{ matrix.cibw_build }} | cut -d'_' -f2,3)
echo "CIBW_ARCHS=${CIBW_ARCHS}" >> $GITHUB_ENV
- name: Build wheels
uses: pypa/[email protected]
with:
package-dir: ./light-curve
env:
CIBW_BUILD_VERBOSITY: "3"
- name: Upload wheels as artifacts
uses: actions/upload-artifact@v4
with:
path: ./wheelhouse/*.whl
if-no-files-found: error
name: artifact_${{ matrix.cibw_build }}
sdist:
name: Build source distribution
runs-on: ubuntu-20.04
defaults:
run:
working-directory: ./light-curve
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install maturin
run: pip install 'maturin>=1.0,<2.0'
- name: Build sdist
run: maturin sdist
- name: Upload sdist as an artifact
uses: actions/upload-artifact@v4
with:
path: ./light-curve/target/wheels/*.tar.gz
if-no-files-found: error
name: artifact_sdist
publish:
needs: [ cibuildwheel, sdist ]
name: Publish light-curve
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
pattern: artifact_*
merge-multiple: true
path: artifact
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install twine
run: pip install twine
- name: Publish light-curve for a new version tag
if: startsWith(github.ref, 'refs/tags/v')
working-directory: artifact
run: twine upload *whl *tar.gz -u __token__ -p ${{ secrets.PYPI_TOKEN_LIGHT_CURVE }} --verbose
publish-light-curve-python:
needs: publish
name: Publish light-curve-python
runs-on: ubuntu-20.04
defaults:
run:
working-directory: light-curve-python
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install deps
run: python3 -mpip install setuptools toml twine
- name: Publish light-curve-python for a new version tag
if: startsWith(github.ref, 'refs/tags/v')
run: |
python3 setup.py sdist
twine check --strict dist/*
twine upload dist/* -u __token__ -p ${{ secrets.PYPI_TOKEN_LIGHT_CURVE_PYTHON }} --verbose