Skip to content

PythonBinding

PythonBinding #40

Workflow file for this run

name: PythonBinding
on:
workflow_run:
workflows: [Windows]
types: [completed]
jobs:
build:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
container: ubuntu:latest
steps:
- uses: actions/checkout@v4
- name: Install python
run: |
apt-get update
export DEBIAN_FRONTEND=noninteractive
apt-get install -y python3.12 python3.12-venv python3-pip cython3
mkdir venv
python3.12 -m venv venv/
. venv/bin/activate
python3.12 -m pip install --upgrade pip
python3.12 -m pip install setuptools build cython twine
- name: Download Linux artifact
id: download-artifact-linux
uses: dawidd6/action-download-artifact@v7
with:
workflow: linux.yml
workflow_conclusion: success
if_no_artifact_found: fail
path: linux-artifact
- name: Download macOS artifact
id: download-artifact-macos
uses: dawidd6/action-download-artifact@v7
with:
workflow: macOS.yml
workflow_conclusion: success
if_no_artifact_found: fail
path: macOS-artifact
- name: Download Windows artifact
id: download-artifact-windows
uses: dawidd6/action-download-artifact@v7
with:
workflow: windows.yml
workflow_conclusion: success
if_no_artifact_found: fail
path: windows-artifact
- name: Copy files from artifacts
run: |
mkdir -p libraries/Linux
mkdir -p libraries/macOS
mkdir -p libraries/Windows
cp -r linux-artifact/libpointing/pointing/libpointing.a libraries/Linux/
cp -r macOS-artifact/artifact/pointing/libpointing.a libraries/macOS/
cp -r windows-artifact/artifact/pointing/release/pointing.lib libraries/Windows/
cp -r linux-artifact/libpointing/bindings/Python/cython/libpointing/*.so bindings/Python/cython/libpointing/
cp -r macOS-artifact/artifact/bindings/Python/cython/libpointing/*.so bindings/Python/cython/libpointing/
cp -r windows-artifact/artifact/bindings/Python/cython/libpointing/*.pyd bindings/Python/cython/libpointing/
- name: compile Python binding
run: |
. venv/bin/activate
cd bindings/Python/cython/
ls -la libpointing/
python3 -m build
ls -la dist/
cd ../../..
mkdir python
cp -r bindings/Python/cython/dist/*.whl python/
- name: Save the compiled libraries
uses: actions/upload-artifact@v4
with:
path: |
libraries/
python/
- name: Publish Python 🐍 distribution 📦 to PyPI
# if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
env:
TWINE_USERNAME: "__token__"
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run : |
. venv/bin/activate
python3 -m twine upload python/*