This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | |
# pull_request: | |
# paths: | |
# - 'src_interfaces/python3_interface.cpp' | |
# - 'include_interfaces/inerfaceTemplate.hpp' | |
# - 'include_interfaces/python3_interface.hpp' | |
# - '.github/workflows/pythonPublishTest.yml' | |
jobs: | |
deploy: | |
name: Compile for ubuntu-22.04 using ${{ matrix.python }}-${{ matrix.arch }} and upload on packages manager | |
strategy: | |
fail-fast: false | |
matrix: | |
python: [ '3.10','3.11', 'pypy-3.8', 'pypy-3.9' ] | |
arch: | |
- x64 | |
runs-on: ubuntu-22.04 | |
env: | |
NAME: value | |
steps: | |
- 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 | |
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-11 g++-11 | |
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 11 | |
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 11 | |
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: Build on Linux | |
run: | | |
cd build/python-build | |
STATIC_ZMQ_PATH=${{ env.STATIC_ZMQ_PATH }} python setup.py --setuptools bdist_wheel | |
- name: Correct whl for Linux | |
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: 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 |