Skip to content

Commit 43855b6

Browse files
authored
Builder for wheels (#179)
* labeled builder for wheels * fix
1 parent aff493f commit 43855b6

File tree

3 files changed

+133
-93
lines changed

3 files changed

+133
-93
lines changed
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: Wheel builder
2+
3+
on:
4+
5+
workflow_call:
6+
7+
inputs:
8+
release:
9+
required: false
10+
type: boolean
11+
default: false
12+
13+
14+
permissions:
15+
contents: read # to fetch code (actions/checkout)
16+
17+
jobs:
18+
19+
build_wheels:
20+
name: Build wheels on ${{ matrix.os }}
21+
runs-on: ${{ matrix.os }}
22+
strategy:
23+
matrix:
24+
os: [ubuntu-20.04, windows-2019, macos-latest]
25+
env:
26+
CIBW_ARCHS_MACOS: "x86_64 universal2 arm64"
27+
MACOSX_DEPLOYMENT_TARGET: "10.15"
28+
steps:
29+
- uses: actions/checkout@v4
30+
with:
31+
submodules: recursive
32+
33+
- name: Set up QEMU
34+
if: runner.os == 'Linux'
35+
uses: docker/setup-qemu-action@v2
36+
with:
37+
platforms: all
38+
39+
- name: Build wheels
40+
uses: pypa/[email protected]
41+
env:
42+
# configure cibuildwheel to build native archs ('auto'), and some
43+
# emulated ones
44+
CIBW_ARCHS_LINUX: auto aarch64 ppc64le s390x
45+
46+
- uses: actions/upload-artifact@v3
47+
with:
48+
name: ${{matrix.os}}-wheels
49+
path: ./wheelhouse/*.whl
50+
51+
build_sdist:
52+
name: Build source dist
53+
runs-on: ubuntu-20.04
54+
steps:
55+
- uses: actions/setup-python@v4
56+
with:
57+
python-version: '3.10'
58+
- uses: actions/checkout@v3
59+
with:
60+
submodules: recursive
61+
- name: Build sdist
62+
run: |
63+
python3 setup.py sdist
64+
- uses: actions/upload-artifact@v3
65+
with:
66+
name: source-dist
67+
path: ./dist/*.tar.gz
68+
69+
publish:
70+
name: Pypi publish
71+
if: ${{inputs.release == true}}
72+
# needs: ['build_wheels', 'build_sdist']
73+
needs: ['build_wheels', 'build_sdist']
74+
runs-on: ubuntu-latest
75+
steps:
76+
- uses: actions/setup-python@v4
77+
with:
78+
python-version: 3.9
79+
- name: Install tools
80+
run: |
81+
pip install twine wheel
82+
- uses: actions/download-artifact@v3
83+
with:
84+
name: ubuntu-20.04-wheels
85+
path: artifacts/linux
86+
- uses: actions/download-artifact@v3
87+
with:
88+
name: windows-2019-wheels
89+
path: artifacts/windows
90+
- uses: actions/download-artifact@v3
91+
with:
92+
name: macos-10.15-wheels
93+
path: artifacts/macos
94+
- uses: actions/download-artifact@v3
95+
with:
96+
name: source-dist
97+
path: artifacts/sdist
98+
- name: unify wheel structure
99+
run: |
100+
mkdir dist
101+
cp -R artifacts/windows/* dist
102+
cp -R artifacts/linux/* dist
103+
cp -R artifacts/macos/* dist
104+
cp -R artifacts/sdist/* dist
105+
- name: Publish to Pypi
106+
uses: pypa/gh-action-pypi-publish@release/v1
107+
with:
108+
user: __token__
109+
password: ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/pypi-publish.yaml

Lines changed: 6 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,104 +1,17 @@
11
name: Publish tag to Pypi
2-
32
on:
43
workflow_dispatch:
5-
64
push:
75
tags:
86
- 'v[0-9]+.[0-9]+.[0-9]+'
9-
107
permissions:
118
contents: read # to fetch code (actions/checkout)
129

13-
jobs:
14-
15-
build_wheels:
16-
name: Build wheels on ${{ matrix.os }}
17-
runs-on: ${{ matrix.os }}
18-
strategy:
19-
matrix:
20-
os: [ubuntu-20.04, windows-2019, macos-10.15]
21-
env:
22-
CIBW_ARCHS_MACOS: "x86_64 universal2 arm64"
23-
MACOSX_DEPLOYMENT_TARGET: "10.12"
24-
steps:
25-
- uses: actions/checkout@v3
26-
with:
27-
submodules: recursive
2810

29-
- name: Set up QEMU
30-
if: runner.os == 'Linux'
31-
uses: docker/setup-qemu-action@v2
32-
with:
33-
platforms: all
34-
35-
- name: Build wheels
36-
uses: pypa/[email protected]
37-
env:
38-
# configure cibuildwheel to build native archs ('auto'), and some
39-
# emulated ones
40-
CIBW_ARCHS_LINUX: auto aarch64 ppc64le s390x
41-
42-
- uses: actions/upload-artifact@v3
43-
with:
44-
name: ${{matrix.os}}-wheels
45-
path: ./wheelhouse/*.whl
46-
47-
build_sdist:
48-
name: Build source dist
49-
runs-on: ubuntu-20.04
50-
steps:
51-
- uses: actions/setup-python@v4
52-
with:
53-
python-version: '3.10'
54-
- uses: actions/checkout@v3
55-
with:
56-
submodules: recursive
57-
- name: Build sdist
58-
run: |
59-
python3 setup.py sdist
60-
- uses: actions/upload-artifact@v3
61-
with:
62-
name: source-dist
63-
path: ./dist/*.tar.gz
64-
65-
publish:
66-
name: Pypi publish
67-
needs: ['build_wheels', 'build_sdist']
68-
runs-on: ubuntu-latest
69-
steps:
70-
- uses: actions/setup-python@v4
71-
with:
72-
python-version: 3.9
73-
- name: Install tools
74-
run: |
75-
pip install twine wheel
76-
- uses: actions/download-artifact@v3
77-
with:
78-
name: ubuntu-20.04-wheels
79-
path: artifacts/linux
80-
- uses: actions/download-artifact@v3
81-
with:
82-
name: windows-2019-wheels
83-
path: artifacts/windows
84-
- uses: actions/download-artifact@v3
85-
with:
86-
name: macos-10.15-wheels
87-
path: artifacts/macos
88-
- uses: actions/download-artifact@v3
89-
with:
90-
name: source-dist
91-
path: artifacts/sdist
92-
- name: unify wheel structure
93-
run: |
94-
mkdir dist
95-
cp -R artifacts/windows/* dist
96-
cp -R artifacts/linux/* dist
97-
cp -R artifacts/macos/* dist
98-
cp -R artifacts/sdist/* dist
11+
jobs:
9912

100-
- name: Publish to Pypi
101-
uses: pypa/gh-action-pypi-publish@release/v1
102-
with:
103-
user: __token__
104-
password: ${{ secrets.PYPI_API_TOKEN }}
13+
release:
14+
uses: ./.github/workflows/REUSABLE-wheeler.yaml
15+
with:
16+
release: true
17+
secrets: inherit
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Wheel builder
2+
3+
on:
4+
pull_request:
5+
types:
6+
- labeled
7+
8+
permissions:
9+
contents: read # to fetch code (actions/checkout)
10+
11+
jobs:
12+
13+
wheelbuilder:
14+
uses: ./.github/workflows/REUSABLE-wheeler.yaml
15+
if: github.event.label.name == 'test-wheels'
16+
with:
17+
release: false
18+
secrets: inherit

0 commit comments

Comments
 (0)