Skip to content

Commit f22970d

Browse files
authored
add release action (#5)
* add commit action * update package info * add license * add security * update readme
1 parent f8b9776 commit f22970d

18 files changed

+484
-140
lines changed

.github/workflows/ci.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
name: ci
1+
name: CI
2+
23
on:
34
pull_request:
45
push:
56
branches:
67
- main
8+
79
jobs:
810
validate:
911
name: "Validate"
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,53 @@
1-
name: release
1+
name: Publish
22

33
on:
4-
pull_request:
5-
push:
6-
branches:
7-
- main
4+
release:
5+
types: [published]
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref }}
9+
cancel-in-progress: true
10+
11+
env:
12+
PACKAGE_NAME: starlite_http_utils
13+
PYTHON_VERSION: "3.8"
14+
815
jobs:
916
macos:
1017
runs-on: macos-latest
1118
steps:
1219
- uses: actions/checkout@v3
1320
- uses: actions/setup-python@v4
1421
with:
15-
python-version: 3.9
22+
python-version: ${{ env.PYTHON_VERSION }}
1623
architecture: x64
17-
- uses: dtolnay/rust-toolchain@nightly
24+
- name: Install Rust toolchain
25+
uses: actions-rs/toolchain@v1
26+
with:
27+
toolchain: stable
28+
profile: minimal
29+
default: true
1830
- name: Build wheels - x86_64
19-
uses: PyO3/maturin-action@v1
31+
uses: messense/maturin-action@v1
2032
with:
2133
target: x86_64
2234
args: --release --out dist --sdist
2335
- name: Install built wheel - x86_64
2436
run: |
25-
pip install starlite_http_utils --no-index --find-links dist --force-reinstall
37+
pip install dist/${{ env.PACKAGE_NAME }}-*.whl --force-reinstall
2638
pip install pytest
27-
cd tests && pytest
39+
pytest -v
2840
- name: Build wheels - universal2
29-
uses: PyO3/maturin-action@v1
41+
uses: messense/maturin-action@v1
3042
with:
3143
args: --release --universal2 --out dist
3244
- name: Install built wheel - universal2
3345
run: |
34-
pip install starlite_http_utils --no-index --find-links dist --force-reinstall
35-
cd tests && pytest
46+
pip install dist/${{ env.PACKAGE_NAME }}-*universal2.whl --force-reinstall
47+
pip install pytest
48+
pytest -v
3649
- name: Upload wheels
37-
uses: actions/upload-artifact@v3
50+
uses: actions/upload-artifact@v2
3851
with:
3952
name: wheels
4053
path: dist
@@ -48,21 +61,27 @@ jobs:
4861
- uses: actions/checkout@v3
4962
- uses: actions/setup-python@v4
5063
with:
51-
python-version: 3.9
64+
python-version: ${{ env.PYTHON_VERSION }}
5265
architecture: ${{ matrix.target }}
53-
- uses: dtolnay/rust-toolchain@nightly
66+
- name: Install Rust toolchain
67+
uses: actions-rs/toolchain@v1
68+
with:
69+
toolchain: stable
70+
profile: minimal
71+
default: true
5472
- name: Build wheels
55-
uses: PyO3/maturin-action@v1
73+
uses: messense/maturin-action@v1
5674
with:
5775
target: ${{ matrix.target }}
5876
args: --release --out dist
5977
- name: Install built wheel
78+
shell: bash
6079
run: |
61-
pip install starlite_http_utils --no-index --find-links dist --force-reinstall
80+
python -m pip install dist/${{ env.PACKAGE_NAME }}-*.whl --force-reinstall
6281
pip install pytest
63-
cd tests && pytest
82+
python -m pytest -v
6483
- name: Upload wheels
65-
uses: actions/upload-artifact@v3
84+
uses: actions/upload-artifact@v2
6685
with:
6786
name: wheels
6887
path: dist
@@ -76,23 +95,22 @@ jobs:
7695
- uses: actions/checkout@v3
7796
- uses: actions/setup-python@v4
7897
with:
79-
python-version: 3.9
98+
python-version: ${{ env.PYTHON_VERSION }}
8099
architecture: x64
81100
- name: Build wheels
82-
uses: PyO3/maturin-action@v1
101+
uses: messense/maturin-action@v1
83102
with:
84-
rust-toolchain: nightly
85103
target: ${{ matrix.target }}
86104
manylinux: auto
87105
args: --release --out dist
88106
- name: Install built wheel
89107
if: matrix.target == 'x86_64'
90108
run: |
91-
pip install starlite_http_utils --no-index --find-links dist --force-reinstall
109+
pip install dist/${{ env.PACKAGE_NAME }}-*.whl --force-reinstall
92110
pip install pytest
93-
cd tests && pytest
111+
pytest -v
94112
- name: Upload wheels
95-
uses: actions/upload-artifact@v3
113+
uses: actions/upload-artifact@v2
96114
with:
97115
name: wheels
98116
path: dist
@@ -106,15 +124,14 @@ jobs:
106124
- uses: actions/checkout@v3
107125
- uses: actions/setup-python@v4
108126
with:
109-
python-version: 3.9
127+
python-version: ${{ env.PYTHON_VERSION }}
110128
- name: Build wheels
111-
uses: PyO3/maturin-action@v1
129+
uses: messense/maturin-action@v1
112130
with:
113-
rust-toolchain: nightly
114131
target: ${{ matrix.target }}
115132
manylinux: auto
116133
args: --release --out dist
117-
- uses: uraimo/run-on-arch-action@v2.3.0
134+
- uses: uraimo/run-on-arch-action@v2.0.5
118135
if: matrix.target != 'ppc64'
119136
name: Install built wheel
120137
with:
@@ -124,12 +141,13 @@ jobs:
124141
install: |
125142
apt-get update
126143
apt-get install -y --no-install-recommends python3 python3-pip
127-
pip3 install -U pip pytest
144+
pip3 install -U pip
128145
run: |
129-
pip3 install starlite_http_utils --no-index --find-links dist/ --force-reinstall
130-
cd tests && pytest
146+
pip3 install ${{ env.PACKAGE_NAME }} --no-index --find-links dist/ --force-reinstall
147+
pip install pytest
148+
pytest -v
131149
- name: Upload wheels
132-
uses: actions/upload-artifact@v3
150+
uses: actions/upload-artifact@v2
133151
with:
134152
name: wheels
135153
path: dist
@@ -145,12 +163,11 @@ jobs:
145163
- uses: actions/checkout@v3
146164
- uses: actions/setup-python@v4
147165
with:
148-
python-version: 3.9
166+
python-version: ${{ env.PYTHON_VERSION }}
149167
architecture: x64
150168
- name: Build wheels
151-
uses: PyO3/maturin-action@v1
169+
uses: messense/maturin-action@v1
152170
with:
153-
rust-toolchain: nightly
154171
target: ${{ matrix.target }}
155172
manylinux: musllinux_1_2
156173
args: --release --out dist
@@ -163,10 +180,10 @@ jobs:
163180
run: |
164181
apk add py3-pip
165182
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
183+
pip3 install ${{ env.PACKAGE_NAME }} --no-index --find-links /io/dist/ --force-reinstall
184+
python3 -m pytest
168185
- name: Upload wheels
169-
uses: actions/upload-artifact@v3
186+
uses: actions/upload-artifact@v2
170187
with:
171188
name: wheels
172189
path: dist
@@ -184,15 +201,14 @@ jobs:
184201
- uses: actions/checkout@v3
185202
- uses: actions/setup-python@v4
186203
with:
187-
python-version: 3.9
204+
python-version: ${{ env.PYTHON_VERSION }}
188205
- name: Build wheels
189-
uses: PyO3/maturin-action@v1
206+
uses: messense/maturin-action@v1
190207
with:
191-
rust-toolchain: nightly
192208
target: ${{ matrix.platform.target }}
193209
manylinux: musllinux_1_2
194210
args: --release --out dist
195-
- uses: uraimo/run-on-arch-action@v2.3.0
211+
- uses: uraimo/run-on-arch-action@master
196212
name: Install built wheel
197213
with:
198214
arch: ${{ matrix.platform.arch }}
@@ -202,26 +218,33 @@ jobs:
202218
apk add py3-pip
203219
pip3 install -U pip pytest
204220
run: |
205-
pip3 install starlite_http_utils --no-index --find-links dist/ --force-reinstall
206-
cd tests && python3 -m pytest
221+
pip3 install ${{ env.PACKAGE_NAME }} --no-index --find-links dist/ --force-reinstall
222+
python3 -m pytest
207223
- name: Upload wheels
208-
uses: actions/upload-artifact@v3
224+
uses: actions/upload-artifact@v2
209225
with:
210226
name: wheels
211227
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 *
228+
publish:
229+
name: Publish
230+
runs-on: ubuntu-latest
231+
needs:
232+
- lint
233+
- macos
234+
- windows
235+
- linux
236+
- linux-cross
237+
- musllinux
238+
- musllinux-cross
239+
steps:
240+
- uses: actions/download-artifact@v2
241+
with:
242+
name: wheels
243+
- uses: actions/setup-python@v4
244+
- name: Publish to PyPi
245+
env:
246+
TWINE_USERNAME: __token__
247+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
248+
run: |
249+
pip install --upgrade twine
250+
twine upload --skip-existing *

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
/target
1+
target/
2+
dist/
23
__pycache__/
34
.pytest_cache/
45
*.iml

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ repos:
2121
- id: pycln
2222
args: [--config=pyproject.toml]
2323
- repo: https://github.com/pycqa/isort
24-
rev: v5.11.3
24+
rev: 5.11.4
2525
hooks:
2626
- id: isort
2727
- repo: https://github.com/psf/black

0 commit comments

Comments
 (0)