-
Notifications
You must be signed in to change notification settings - Fork 214
157 lines (150 loc) · 4.66 KB
/
pypi-build.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
name: Build/upload sdist and wheel Package to PyPI
on:
push:
branches:
- master
- develop
paths-ignore:
- 'example/**'
- 'docs/**'
- 'data/**'
pull_request:
branches:
- master
- develop
paths-ignore:
- 'example/**'
- 'docs/**'
- 'data/**'
release:
types:
- published
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
arch: x86_64
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
architecture: 'x64'
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v1
with:
platforms: arm64
- name: Add tag to version.py file
run: |
git describe --abbrev=7 --dirty --always --tags | \
sed 's/dirty/mod/g' | \
sed 's/-/+/' | \
sed 's/-/./g' | \
sed 's/v//' > ./build/python/vina/version.py
cat ./build/python/vina/version.py
- name: Install Python dependencies
run: python -m pip install cibuildwheel==2.0.1
- name: Build wheels
run: |
cp -R ./build/python/* .
python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_SKIP: pp*
CIBW_ARCHS: auto64
CIBW_ARCHS_LINUX: ${{ matrix.arch }}
CIBW_BEFORE_BUILD: |
pip install --upgrade pip setuptools
CIBW_BEFORE_ALL_MACOS: |
brew install boost swig
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_BEFORE_ALL_LINUX: |
sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo
sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
yum clean all && yum -y update
yum install -y wget python-devel pcre-devel
# Install SWIG
wget https://downloads.sourceforge.net/swig/swig-4.0.2.tar.gz
tar -xvf swig-4*.tar.gz
cd swig-4*
./configure --prefix=/usr --without-maximum-compile-warnings && make
make install && install -v -m755 -d /usr/share/doc/swig-4.0.2 && cp -v -R Doc/* /usr/share/doc/swig-4.0.2
cd ..
# Install Boost
wget https://boostorg.jfrog.io/artifactory/main/release/1.75.0/source/boost_1_75_0.tar.gz
tar -xzf boost_1_*
cd boost_1_*
./bootstrap.sh --prefix=/usr --with-python=python
./b2 install threading=multi link=shared
cd ..
# Clean up
rm -rf boost_1_*
rm -rf swig-4*
- name: Upload artifacts for inspection
uses: actions/upload-artifact@v4
with:
name: wheels
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
architecture: 'x64'
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip setuptools
- name: Install boost-devel and swig
run: |
sudo apt-get install -y libboost-all-dev swig
- name: Build sdist
run: |
cd ./build/python
python setup.py sdist
- name: Upload artifacts for inspection
uses: actions/upload-artifact@v4
with:
name: sdist
path: ./build/python/dist/*.tar.gz
upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
architecture: 'x64'
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip setuptools twine
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: ./dist
- name: Publish sdist and wheel to PyPI
run: |
twine upload dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_FORLILAB }}