-
Notifications
You must be signed in to change notification settings - Fork 10
138 lines (130 loc) · 4.7 KB
/
pythonPublishTest.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
name: Upload Python Package on test server
on:
workflow_dispatch:
push:
paths:
- 'src_interfaces/python3_interface.cpp'
- 'include_interfaces/inerfaceTemplate.hpp'
- 'include_interfaces/python3_interface.hpp'
- '.github/workflows/pythonPublishTest.yml'
jobs:
deploy:
name: Compile for ${{ matrix.os }} using ${{ matrix.python }}-${{ matrix.arch }} and upload on packages manager
strategy:
matrix:
os: [ubuntu-20.04, windows-latest]
python: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13', 'pypy-3.9', 'pypy-3.10']
arch: [x64]
include:
- os: ubuntu-20.04
python: '3.6'
arch: x64
- os: macOS-latest
python: '3.11'
arch: arm64
- os: macOS-latest
python: '3.12'
arch: arm64
- os: macOS-latest
python: '3.13'
arch: arm64
- os: macOS-13
python: '3.11'
arch: x64
- os: macOS-13
python: '3.12'
arch: x64
- os: macOS-13
python: '3.13'
arch: x64
fail-fast: false
runs-on: ${{ matrix.os }}
env:
NAME: value
steps:
- name: gettext macOS dependencies ifx
if : contains( matrix.OS, 'macOS' )
run: |
rm -rf /usr/local/opt/gettext
brew install gettext
brew link --force gettext
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
architecture: ${{ matrix.arch }}
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Install dependencies
run: |
pip install oldest-supported-numpy
pip install setuptools wheel twine packaging
- name: Install Ubuntu dependencies
if : contains( matrix.os, 'ubuntu' )
run: |
sudo add-apt-repository 'deb [arch=amd64] http://archive.ubuntu.com/ubuntu focal main universe'
sudo apt update;
sudo apt install build-essential libzmq3-dev patchelf libtool
sudo apt -y install gcc-7 g++-7
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 7
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 7
wget "https://raw.githubusercontent.com/zeromq/cppzmq/master/zmq.hpp" -O include/zmq.hpp
wget 'https://codeload.github.com/open-source-parsers/jsoncpp/zip/master' -O jsoncpp.zip
unzip jsoncpp.zip
cd jsoncpp-master
python amalgamate.py
cd ..
git clone https://github.com/zeromq/libzmq.git
cd libzmq
export CFLAGS="-fPIC"
export CXXFLAGS="-fPIC"
bash ./autogen.sh
./configure --prefix=/tmp/zeromq
make -j
make install
echo "STATIC_ZMQ_PATH=/tmp/zeromq/lib/libzmq.a" >> $GITHUB_ENV
- name: Install macOS dependencies
if : contains( matrix.os, 'macOS' )
brew install zeromq jsoncpp cppzmq gettext
echo "STATIC_ZMQ_PATH=$(brew --prefix)/lib/libzmq.a" >> $GITHUB_ENV
- name: Add msbuild to PATH
if : contains( matrix.os, 'windows' )
uses: microsoft/[email protected]
- name: Install Windows dependencies
if : contains( matrix.os, 'windows' )
run: |
cd build/python-build
cmd.exe /c setup_Win_compile_all.bat
- name: Build on Linux or macOS
if: runner.os != 'Windows'
run: |
cd build/python-build
STATIC_ZMQ_PATH=${{ env.STATIC_ZMQ_PATH }} python setup.py --setuptools bdist_wheel
- name: Build on Windows
if: runner.os == 'Windows'
run: |
cd build\python-build
python setup.py --setuptools bdist_wheel
- name: Correct whl for Linux
if : contains( matrix.os, 'ubuntu' )
run: |
cd build/python-build/dist
# pip install auditwheel
# auditwheel repair *.whl
# for wheel in $(find . -iname "*.whl") ; do unzip -o $wheel; patchelf --clear-symbol-version stat --clear-symbol-version _ZSt28__throw_bad_array_new_lengthv g2s/*.so; zip -u $wheel g2s/*.so; done
for wheel in $(find . -iname "*.whl") ; do mv $wheel $(echo $wheel | sed 's/-linux_/-manylinux1_/'); done
- name: Correct whl for macOS
if : contains( matrix.os, 'macOS' )
run: |
cd build/python-build
pip install delocate
delocate-wheel -v dist/*.whl
- name: Publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }}
run: |
cd build/python-build
twine upload dist/*.whl --repository-url https://test.pypi.org/legacy/ --verbose --skip-existing
# --skip-existing