forked from libcsp/libcsp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
999bcf1
commit 445911e
Showing
6 changed files
with
123 additions
and
41 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
name: Build and test python | ||
on: [push, pull_request] | ||
jobs: | ||
build-test-python: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- ubuntu-24.04 | ||
arch: | ||
- posix | ||
buildsystem: | ||
- cmake | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Setup packages on Linux | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install libzmq3-dev libsocketcan-dev | ||
- name: Setup build system packages on Linux | ||
run: | | ||
sudo apt-get install ninja-build cmake | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build libcsp examples | ||
run: python3 examples/buildall.py ${{ matrix.arch }} --build-system=${{ matrix.buildsystem }} | ||
|
||
- name: Build libcsp with python binding | ||
run: | | ||
cmake -GNinja -B buildBinding -DCSP_ENABLE_PYTHON3_BINDINGS=1 -DCSP_USE_RTABLE=1 -DCMAKE_POSITION_INDEPENDENT_CODE=ON && ninja -C buildBinding | ||
ls -l | ||
ls -l build/ | ||
- name: Run ZMQ Python binding Test | ||
run: | | ||
build/examples/zmqproxy & | ||
LD_LIBRARY_PATH=buildBinding PYTHONPATH=buildBinding python3 examples/python_bindings_example_server.py & | ||
LD_LIBRARY_PATH=buildBinding PYTHONPATH=buildBinding python3 examples/python_bindings_example_client.py -z localhost -s 27 -a 2 | ||
pkill zmqproxy | ||
- name: Prepare Python binding for packaging | ||
run: | | ||
mkdir -p libcsp_py3/ | ||
cp buildBinding/libcsp_py3*.so libcsp_py3/libcsp_py3-${{ matrix.os }}.so | ||
ls -l libcsp_py3 | ||
ls -l | ||
- name: Set up Python environment | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Create and activate virtual environment | ||
run: | | ||
python -m venv venv | ||
source venv/bin/activate | ||
python -m pip install --upgrade pip | ||
python -m pip install setuptools wheel build | ||
- name: Build the Python package | ||
run: | | ||
source venv/bin/activate | ||
python3 -m build | ||
- name: Publish to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
repository_url: https://test.pypi.org/legacy/ | ||
#if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') | ||
|
||
# Install the package from PyPI and run tests again | ||
- name: Install package from PyPI | ||
run: | | ||
source venv/bin/activate | ||
pip install -i https://test.pypi.org/simple/ csp-moonlight | ||
# Checkout again to test the uploaded package | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build libcsp examples | ||
run: python3 examples/buildall.py ${{ matrix.arch }} --build-system=${{ matrix.buildsystem }} | ||
|
||
- name: Run ZMQ Python binding test with PyPI package | ||
run: | | ||
build/examples/zmqproxy & | ||
python3 examples/python_bindings_example_server.py & | ||
python3 examples/python_bindings_example_client.py -z localhost -s 27 -a 2 | ||
pkill zmqproxy |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .libcsp_py3 import * |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
include README.md | ||
include LICENSE |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[build-system] | ||
requires = ["setuptools>=42", "wheel"] | ||
build-backend = "setuptools.build_meta" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from setuptools import setup, find_packages | ||
from setuptools.extension import Extension | ||
|
||
setup( | ||
name='csp_moonlight', | ||
version='2.0.0', | ||
description='CSP Python bindings', | ||
long_description=open('README.md').read(), | ||
long_description_content_type='text/markdown', | ||
license_text=open('LICENSE').read(), | ||
license_text_content_type='text/markdown', | ||
author='moonlight83340', | ||
author_email='[email protected]', | ||
url='https://github.com/moonlight83340/libcsp', | ||
packages=find_packages('libcsp_py3'), | ||
package_dir={'': 'libcsp_py3'}, | ||
package_data={'libcsp_py3': ['libcsp_py3*.so']}, | ||
classifiers=[ | ||
'Programming Language :: Python :: 3', | ||
'License :: OSI Approved :: MIT License', | ||
'Operating System :: POSIX :: Linux', | ||
], | ||
python_requires='>=3.5', | ||
) | ||
|