-
Notifications
You must be signed in to change notification settings - Fork 12
101 lines (91 loc) · 2.6 KB
/
python-publish.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
name: Publish sdist and wheels macos-manylinux
on:
release:
types: [created]
env:
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
MACOSX_DEPLOYMENT_TARGET: '10.13'
CIBW_BUILD_VERBOSITY: 2
# Only build on Python 3.x
CIBW_BUILD: 'cp3?-*'
CIBW_SKIP: 'cp35-* cp310-* *-manylinux_i686'
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-12]
steps:
- uses: actions/checkout@master
with:
submodules: true
- uses: actions/setup-python@master
name: Install Python
with:
python-version: '3.9'
- name: Install cibuildwheel
run: |
python -m pip install cibuildwheel==1.6.4
- name: Build wheels on Linux
if: runner.os == 'Linux'
env:
CIBW_BEFORE_BUILD: |
yum update -y
python -m pip install pybind11
run: |
python -m cibuildwheel --output-dir dist
- name: Build wheels Mac OS
if: runner.os == 'macOS'
env:
CIBW_BEFORE_BUILD: |
brew update
brew unlink gcc@8 gcc@9
brew install cmake
python -m pip install pybind11
run: |
python -m cibuildwheel --output-dir dist
- name: Store wheel as artifact
uses: actions/upload-artifact@master
with:
name: dist
path: dist
build_sdist:
name: Build sdist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
with:
submodules: true
- name: Set up Python 3.9
uses: actions/setup-python@master
with:
python-version: 3.9
- name: Build a source tarball
run: |
python -m pip install pybind11
python setup.py sdist
- name: Store sdist as artifact
uses: actions/upload-artifact@master
with:
name: dist
path: dist
upload_wheels:
runs-on: ubuntu-latest
needs: [build_wheels, build_sdist]
name: Upload wheels to PyPI
steps:
- name: Download artifacts produced during the build_wheels and build_sdist jobs
uses: actions/download-artifact@master
with:
name: dist
path: dist
- name: Display structure of downloaded files
run: ls -R
working-directory: dist
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: ${{ secrets.PYPI_USERNAME }}
password: ${{ secrets.PYPI_PASSWORD }}
packages_dir: dist/