Skip to content

Commit f8b9776

Browse files
committed
(feat): add release workflow
1 parent 6502b59 commit f8b9776

File tree

1 file changed

+227
-0
lines changed

1 file changed

+227
-0
lines changed

.github/workflows/release.yaml

Lines changed: 227 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
1+
name: release
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
jobs:
9+
macos:
10+
runs-on: macos-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
- uses: actions/setup-python@v4
14+
with:
15+
python-version: 3.9
16+
architecture: x64
17+
- uses: dtolnay/rust-toolchain@nightly
18+
- name: Build wheels - x86_64
19+
uses: PyO3/maturin-action@v1
20+
with:
21+
target: x86_64
22+
args: --release --out dist --sdist
23+
- name: Install built wheel - x86_64
24+
run: |
25+
pip install starlite_http_utils --no-index --find-links dist --force-reinstall
26+
pip install pytest
27+
cd tests && pytest
28+
- name: Build wheels - universal2
29+
uses: PyO3/maturin-action@v1
30+
with:
31+
args: --release --universal2 --out dist
32+
- name: Install built wheel - universal2
33+
run: |
34+
pip install starlite_http_utils --no-index --find-links dist --force-reinstall
35+
cd tests && pytest
36+
- name: Upload wheels
37+
uses: actions/upload-artifact@v3
38+
with:
39+
name: wheels
40+
path: dist
41+
42+
windows:
43+
runs-on: windows-latest
44+
strategy:
45+
matrix:
46+
target: [x64, x86]
47+
steps:
48+
- uses: actions/checkout@v3
49+
- uses: actions/setup-python@v4
50+
with:
51+
python-version: 3.9
52+
architecture: ${{ matrix.target }}
53+
- uses: dtolnay/rust-toolchain@nightly
54+
- name: Build wheels
55+
uses: PyO3/maturin-action@v1
56+
with:
57+
target: ${{ matrix.target }}
58+
args: --release --out dist
59+
- name: Install built wheel
60+
run: |
61+
pip install starlite_http_utils --no-index --find-links dist --force-reinstall
62+
pip install pytest
63+
cd tests && pytest
64+
- name: Upload wheels
65+
uses: actions/upload-artifact@v3
66+
with:
67+
name: wheels
68+
path: dist
69+
70+
linux:
71+
runs-on: ubuntu-latest
72+
strategy:
73+
matrix:
74+
target: [x86_64, i686]
75+
steps:
76+
- uses: actions/checkout@v3
77+
- uses: actions/setup-python@v4
78+
with:
79+
python-version: 3.9
80+
architecture: x64
81+
- name: Build wheels
82+
uses: PyO3/maturin-action@v1
83+
with:
84+
rust-toolchain: nightly
85+
target: ${{ matrix.target }}
86+
manylinux: auto
87+
args: --release --out dist
88+
- name: Install built wheel
89+
if: matrix.target == 'x86_64'
90+
run: |
91+
pip install starlite_http_utils --no-index --find-links dist --force-reinstall
92+
pip install pytest
93+
cd tests && pytest
94+
- name: Upload wheels
95+
uses: actions/upload-artifact@v3
96+
with:
97+
name: wheels
98+
path: dist
99+
100+
linux-cross:
101+
runs-on: ubuntu-latest
102+
strategy:
103+
matrix:
104+
target: [aarch64, armv7, s390x, ppc64le, ppc64]
105+
steps:
106+
- uses: actions/checkout@v3
107+
- uses: actions/setup-python@v4
108+
with:
109+
python-version: 3.9
110+
- name: Build wheels
111+
uses: PyO3/maturin-action@v1
112+
with:
113+
rust-toolchain: nightly
114+
target: ${{ matrix.target }}
115+
manylinux: auto
116+
args: --release --out dist
117+
- uses: uraimo/run-on-arch-action@v2.3.0
118+
if: matrix.target != 'ppc64'
119+
name: Install built wheel
120+
with:
121+
arch: ${{ matrix.target }}
122+
distro: ubuntu20.04
123+
githubToken: ${{ github.token }}
124+
install: |
125+
apt-get update
126+
apt-get install -y --no-install-recommends python3 python3-pip
127+
pip3 install -U pip pytest
128+
run: |
129+
pip3 install starlite_http_utils --no-index --find-links dist/ --force-reinstall
130+
cd tests && pytest
131+
- name: Upload wheels
132+
uses: actions/upload-artifact@v3
133+
with:
134+
name: wheels
135+
path: dist
136+
137+
musllinux:
138+
runs-on: ubuntu-latest
139+
strategy:
140+
matrix:
141+
target:
142+
- x86_64-unknown-linux-musl
143+
- i686-unknown-linux-musl
144+
steps:
145+
- uses: actions/checkout@v3
146+
- uses: actions/setup-python@v4
147+
with:
148+
python-version: 3.9
149+
architecture: x64
150+
- name: Build wheels
151+
uses: PyO3/maturin-action@v1
152+
with:
153+
rust-toolchain: nightly
154+
target: ${{ matrix.target }}
155+
manylinux: musllinux_1_2
156+
args: --release --out dist
157+
- name: Install built wheel
158+
if: matrix.target == 'x86_64-unknown-linux-musl'
159+
uses: addnab/docker-run-action@v3
160+
with:
161+
image: alpine:latest
162+
options: -v ${{ github.workspace }}:/io -w /io
163+
run: |
164+
apk add py3-pip
165+
pip3 install -U pip pytest
166+
pip3 install starlite_http_utils --no-index --find-links /io/dist/ --force-reinstall
167+
cd tests && python3 -m pytest
168+
- name: Upload wheels
169+
uses: actions/upload-artifact@v3
170+
with:
171+
name: wheels
172+
path: dist
173+
174+
musllinux-cross:
175+
runs-on: ubuntu-latest
176+
strategy:
177+
matrix:
178+
platform:
179+
- target: aarch64-unknown-linux-musl
180+
arch: aarch64
181+
- target: armv7-unknown-linux-musleabihf
182+
arch: armv7
183+
steps:
184+
- uses: actions/checkout@v3
185+
- uses: actions/setup-python@v4
186+
with:
187+
python-version: 3.9
188+
- name: Build wheels
189+
uses: PyO3/maturin-action@v1
190+
with:
191+
rust-toolchain: nightly
192+
target: ${{ matrix.platform.target }}
193+
manylinux: musllinux_1_2
194+
args: --release --out dist
195+
- uses: uraimo/run-on-arch-action@v2.3.0
196+
name: Install built wheel
197+
with:
198+
arch: ${{ matrix.platform.arch }}
199+
distro: alpine_latest
200+
githubToken: ${{ github.token }}
201+
install: |
202+
apk add py3-pip
203+
pip3 install -U pip pytest
204+
run: |
205+
pip3 install starlite_http_utils --no-index --find-links dist/ --force-reinstall
206+
cd tests && python3 -m pytest
207+
- name: Upload wheels
208+
uses: actions/upload-artifact@v3
209+
with:
210+
name: wheels
211+
path: dist
212+
# release:
213+
# name: Release
214+
# runs-on: ubuntu-latest
215+
# if: "startsWith(github.ref, 'refs/tags/')"
216+
# needs: [ macos, windows, linux, linux-cross, musllinux, musllinux-cross ]
217+
# steps:
218+
# - uses: actions/download-artifact@v3
219+
# with:
220+
# name: wheels
221+
# - name: Publish to PyPI
222+
# env:
223+
# MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_PASSWORD }}
224+
# uses: PyO3/maturin-action@v1
225+
# with:
226+
# command: upload
227+
# args: --skip-existing *

0 commit comments

Comments
 (0)