Skip to content

Commit 56a579f

Browse files
authored
Merge branch 'feat/modernize' into master
2 parents 43ce162 + c8676c1 commit 56a579f

File tree

1 file changed

+118
-0
lines changed

1 file changed

+118
-0
lines changed
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
name: Build sdist and wheel and publish to PyPI and TestPyPI
2+
3+
#on: [push, pull_request]
4+
on:
5+
push:
6+
branches:
7+
- master
8+
pull_request:
9+
branches:
10+
- master
11+
12+
jobs:
13+
build_sdist:
14+
name: Build sdist
15+
runs-on: ubuntu-latest
16+
steps:
17+
18+
- uses: actions/checkout@v3
19+
with:
20+
submodules: true
21+
22+
- name: Install ninja
23+
run: pipx install ninja
24+
25+
- name: Build sdist
26+
run: pipx run build --sdist
27+
28+
- name: Check metadata
29+
run: pipx run twine check --strict dist/*
30+
31+
- uses: actions/upload-artifact@v3
32+
with:
33+
path: dist/*.tar.gz
34+
35+
build_wheels:
36+
name: Build wheels on ${{ matrix.os }}
37+
runs-on: ${{ matrix.os }}
38+
strategy:
39+
matrix:
40+
os: [ubuntu-latest, windows-latest, macos-latest]
41+
steps:
42+
43+
- uses: actions/checkout@v3
44+
with:
45+
submodules: true
46+
47+
# Used to host cibuildwheel
48+
- uses: actions/setup-python@v4
49+
with:
50+
python-version: '3.11'
51+
52+
- name: Build wheels
53+
uses: pypa/[email protected]
54+
# to supply options, put them in 'env', like:
55+
# env:
56+
# CIBW_SOME_OPTION: value
57+
58+
- uses: actions/upload-artifact@v3
59+
with:
60+
path: wheelhouse/*.whl
61+
62+
build_arch_wheels:
63+
name: Build wheels on Linux ${{ matrix.arch }}
64+
runs-on: ubuntu-20.04
65+
strategy:
66+
matrix:
67+
arch: [aarch64]
68+
steps:
69+
70+
- uses: actions/checkout@v3
71+
with:
72+
submodules: true
73+
74+
- uses: docker/setup-qemu-action@v2
75+
with:
76+
platforms: all
77+
78+
- uses: pypa/[email protected]
79+
env:
80+
CIBW_ARCHS: ${{ matrix.arch }}
81+
82+
- name: Verify clean directory
83+
run: git diff --exit-code
84+
shell: bash
85+
86+
- name: Upload wheels
87+
uses: actions/upload-artifact@v3
88+
with:
89+
path: wheelhouse/*.whl
90+
91+
upload_pypi:
92+
needs: [build_arch_wheels, build_wheels, build_sdist]
93+
runs-on: ubuntu-latest
94+
environment: PyPI release
95+
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')
96+
steps:
97+
98+
- uses: actions/download-artifact@v3
99+
with:
100+
# unpacks default artifact into dist/
101+
# if `name: artifact` is omitted, the action will create extra parent dir
102+
name: artifact
103+
path: dist
104+
105+
- name: Publish distribution to Test PyPI
106+
uses: pypa/[email protected]
107+
with:
108+
skip_existing: true
109+
user: __token__
110+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
111+
repository_url: https://test.pypi.org/legacy/
112+
113+
- name: Publish distribution to PyPI
114+
if: startsWith(github.ref, 'refs/tags/v')
115+
uses: pypa/[email protected]
116+
with:
117+
user: __token__
118+
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)