-
Notifications
You must be signed in to change notification settings - Fork 3
229 lines (217 loc) · 11 KB
/
deploy_pypi.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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# The starting point of this script are the links provided on the maturing doc:
# * https://github.com/nanoporetech/fast-ctc-decode/blob/b226ea0f2b2f4f474eff47349703d57d2ea4801b/.github/workflows/publish.yml
# * https://github.com/konstin/complex-manylinux-maturin-docker/blob/main/.github/workflows/build.yml
name: publish-cdshealpix-wheels
# Exec only if a tag starting by 'v' is pushed
# see: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
on:
push:
tags:
- v*
# Allows to run this workflow manually from the Actions tab
workflow_dispatch:
# Jobs run in parallel, see https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobs
# Github hosted runner are: see https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
jobs:
# Linux is specifi because of manylinux, we have to use a docker file
build-linux64-wheels:
# Containers run in Linux
runs-on: ubuntu-latest
# Docker Hub image that 'build-linux-wheels' executes in.
# See https://github.com/pypa/manylinux for this particular container:
# * CPython 3.8, 3.9, ... installed in /opt/python/<python tag>-<abi tag>
container: quay.io/pypa/manylinux2014_x86_64
# We are now in CentOS 7 64 bits
steps:
- name: "Checkout the full project"
uses: actions/checkout@v4
# We need to install rust in the docker image (else, cargo is already available in github action)
- name: "Install Rust"
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
# Build wheels for all pre-installed python version (in /opt/python/, see docker image comment)
# installing first maturin and using maturin: https://github.com/PyO3/maturin#pypy
# For secrets, see https://docs.github.com/en/actions/reference/encrypted-secrets
- name: "Build and publish wheels"
shell: bash
env:
MATURIN_USERNAME: ${{ secrets.PYPI_USERNAME_FXP }}
MATURIN_PASSWORD: ${{ secrets.PYPI_PASSWORD_FXP }}
run: |
source $HOME/.cargo/env
for PYBIN in /opt/python/cp3{8,9,10,11,12}-*/bin; do
"${PYBIN}/pip" install --upgrade pip
"${PYBIN}/pip" install maturin
"${PYBIN}/maturin" -V
rustc -vV
echo "${PYBIN}/python"
"${PYBIN}/maturin" publish -i "${PYBIN}/python" --no-sdist --skip-existing --compatibility manylinux2014 --username "$MATURIN_USERNAME"
"${PYBIN}/maturin" publish -i "${PYBIN}/python" --no-sdist --skip-existing --compatibility musllinux_1_2 --username "$MATURIN_USERNAME"
done
# Linux is specifi because of manylinux, we have to use a docker file
# Replace because last version was generating x86_64 wheels :o/
#build-linux32-wheels:
# # Containers run in Linux
# runs-on: ubuntu-latest
# # Docker Hub image that 'build-linux-wheels' executes in.
# # See https://github.com/pypa/manylinux for this particular container:
# # * CPython 3.8, 3.9, ... installed in /opt/python/<python tag>-<abi tag>
# container: quay.io/pypa/manylinux2014_i686
# # We are now in CentOS 7 32 bits
# steps:
# # Checkout the project
# - name: "Checkout the full project"
# uses: actions/checkout@v1
# # We need to install rust in the docker image (else, cargo is already available in github action)
# - name: "Install Rust"
# run: |
# curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-host i686-unknown-linux-gnu -y
# # Build wheels for all pre-installed python version (in /opt/python/, see docker image comment)
# # installing first maturin and using maturin: https://github.com/PyO3/maturin#pypy
# # For secrets, see https://docs.github.com/en/actions/reference/encrypted-secrets
# - name: "Build and publish wheels"
# shell: bash
# env:
# MATURIN_USERNAME: ${{ secrets.PYPI_USERNAME_FXP }}
# MATURIN_PASSWORD: ${{ secrets.PYPI_PASSWORD_FXP }}
# run: |
# source $HOME/.cargo/env
# for PYBIN in /opt/python/cp3[78910]*/bin; do
# "${PYBIN}/pip" install --upgrade pip
# "${PYBIN}/pip" install maturin
# "${PYBIN}/maturin" -V
# rustc -vV
# echo "${PYBIN}/python"
# echo "CARGO_BUILD_TARGET: ${CARGO_BUILD_TARGET}"
# "${PYBIN}/maturin" publish -i "${PYBIN}/python" --no-sdist --skip-existing --compatibility manylinux2014 --username "$MATURIN_USERNAME" --target i686-unknown-linux-gnu
# done
# Comming in large parts from @odidev in MOCPy pull request
build-linux32-wheels:
runs-on: ubuntu-latest
env:
MATURIN_USERNAME: ${{ secrets.PYPI_USERNAME_FXP }}
MATURIN_PASSWORD: ${{ secrets.PYPI_PASSWORD_FXP }}
img: quay.io/pypa/manylinux2014_i686
steps:
- name: Checkout
uses: actions/checkout@v4
- name: "Set up QEMU"
id: qemu
uses: docker/setup-qemu-action@v1
- name: Install dependencies
run: |
docker run --rm -v ${{ github.workspace }}:/ws:rw --workdir=/ws \
-e MATURIN_USERNAME=${{ env.MATURIN_USERNAME }} \
-e MATURIN_PASSWORD=${{ env.MATURIN_PASSWORD}} \
${{ env.img }} \
bash -exc 'curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \
source $HOME/.cargo/env && \
for PYBIN in /opt/python/cp3{8,9,10,11,12}-*/bin; do
echo "Loop on PYBIN: $PYBIN"
"${PYBIN}/pip" install --upgrade pip
"${PYBIN}/pip" install maturin
"${PYBIN}/maturin" -V
rustc -vV
echo "${PYBIN}/python"
"${PYBIN}/maturin" publish -i "${PYBIN}/python" -v --no-sdist --skip-existing --compatibility manylinux2014 --username "$MATURIN_USERNAME"
"${PYBIN}/maturin" publish -i "${PYBIN}/python" -v --no-sdist --skip-existing --compatibility musllinux_1_2 --username "$MATURIN_USERNAME"
done'
# Comming in large parts from @odidev in MOCPy pull request
build-aarch64-wheels:
runs-on: ubuntu-latest
env:
MATURIN_USERNAME: ${{ secrets.PYPI_USERNAME_FXP }}
MATURIN_PASSWORD: ${{ secrets.PYPI_PASSWORD_FXP }}
img: quay.io/pypa/manylinux2014_aarch64
steps:
- name: Checkout
uses: actions/checkout@v4
- name: "Set up QEMU"
id: qemu
uses: docker/setup-qemu-action@v1
- name: Install dependencies
run: |
docker run --rm -v ${{ github.workspace }}:/ws:rw --workdir=/ws \
-e MATURIN_USERNAME=${{ env.MATURIN_USERNAME }} \
-e MATURIN_PASSWORD=${{ env.MATURIN_PASSWORD}} \
${{ env.img }} \
bash -exc 'curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-host aarch64-unknown-linux-gnu -y && \
source $HOME/.cargo/env && \
for PYBIN in /opt/python/cp3{8,9,10,11,12}-*/bin; do
echo "Loop on PYBIN: $PYBIN"
"${PYBIN}/pip" install maturin
"${PYBIN}/maturin" -V
rustc -vV
echo "${PYBIN}/python"
"${PYBIN}/maturin" publish -i "${PYBIN}/python" -v --skip-existing --compatibility manylinux2014 --username "$MATURIN_USERNAME" --target aarch64-unknown-linux-gnu --config "net.git-fetch-with-cli = true"
"${PYBIN}/maturin" publish -i "${PYBIN}/python" -v --skip-existing --compatibility musllinux_1_2 --username "$MATURIN_USERNAME" --target aarch64-unknown-linux-gnu --config "net.git-fetch-with-cli = true"
done'
build-windows-wheels:
runs-on: ${{ matrix.os }}
strategy:
# See https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstrategyfail-fast
# run all matrix jobs even if on is failling (default behaviour is to stop all jobs)
fail-fast: false
matrix:
os: [windows-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
steps:
# Checkout the project
- uses: actions/checkout@v4
# Set up python, see https://docs.github.com/en/actions/guides/building-and-testing-python
- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# For secrets, see https://docs.github.com/en/actions/reference/encrypted-secrets
- name: Build and publish wheel for Python ${{ matrix.python-version }} on ${{ matrix.os }}
# We do not use environement variable for user, because it seems that the way of providing it in the command
# line is not the same for macos and for windows. We should create 2 different actions (see
# https://docs.github.com/en/actions/reference/encrypted-secrets )
env:
MATURIN_USERNAME: ${{ secrets.PYPI_USERNAME_FXP }}
MATURIN_PASSWORD: ${{ secrets.PYPI_PASSWORD_FXP }}
run: |
#python3 -m pip install maturin
pip install --upgrade pip
pip install maturin
#maturin build --release --no-sdist
#maturin publish --no-sdist --skip-existing --username fxpineau
maturin -V
rustc -vV
maturin publish --interpreter python${{matrix.python_version}} --no-sdist --skip-existing --username fxpineau
build-macos-wheels:
runs-on: ${{ matrix.os }}
strategy:
# See https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstrategyfail-fast
# run all matrix jobs even if on is failling (default behaviour is to stop all jobs)
fail-fast: false
matrix:
os: [macOS-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
steps:
# Checkout the project
- uses: actions/checkout@v4
# Set up python, see https://docs.github.com/en/actions/guides/building-and-testing-python
- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# For secrets, see https://docs.github.com/en/actions/reference/encrypted-secrets
- name: Build and publish wheel for Python ${{ matrix.python-version }} on ${{ matrix.os }}
# We do not use environement variable for user, because it seems that the way of providing it in the command
# line is not the same for macos and for windows. We should create 2 different actions (see
# https://docs.github.com/en/actions/reference/encrypted-secrets )
env:
MATURIN_USERNAME: ${{ secrets.PYPI_USERNAME_FXP }}
MATURIN_PASSWORD: ${{ secrets.PYPI_PASSWORD_FXP }}
run: |
#python3 -m pip install maturin
rustup target add aarch64-apple-darwin
pip install --upgrade pip
pip install maturin
maturin -V
rustc -vV
echo "${PYBIN}/python"
maturin publish --interpreter python${{matrix.python_version}} --no-sdist --universal2 --skip-existing --username "$MATURIN_USERNAME"
maturin publish --interpreter python${{matrix.python_version}} --no-sdist --skip-existing --username "$MATURIN_USERNAME"