Skip to content

Add Alicia-M v1.2 IK success rate benchmark using C++ backend #23

Add Alicia-M v1.2 IK success rate benchmark using C++ backend

Add Alicia-M v1.2 IK success rate benchmark using C++ backend #23

Workflow file for this run

name: Build And Publish Wheels
on:
push:
branches:
- "**"
tags:
- "v*"
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
build_wheels:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: linux-x86_64
os: ubuntu-latest
archs: "x86_64"
build: "cp311-* cp312-* cp313-*"
- name: linux-aarch64-cp311
os: ubuntu-latest
archs: "aarch64"
build: "cp311-*"
- name: linux-aarch64-cp312
os: ubuntu-latest
archs: "aarch64"
build: "cp312-*"
- name: linux-aarch64-cp313
os: ubuntu-latest
archs: "aarch64"
build: "cp313-*"
- name: macos-arm64
os: macos-14
archs: "arm64"
build: "cp311-* cp312-* cp313-*"
- name: windows-amd64
os: windows-latest
archs: "AMD64"
build: "cp311-* cp312-* cp313-*"
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Enable QEMU for Linux aarch64 wheels
if: runner.os == 'Linux' && matrix.archs == 'aarch64'
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: Download Eigen headers into the repository workspace
shell: bash
run: |
python - <<'PY'
import shutil
import tarfile
import urllib.request
from pathlib import Path
version = "3.4.0"
root = Path(".cibw")
destination = root / f"eigen-{version}"
if destination.exists():
print(f"Eigen already present at {destination}")
raise SystemExit(0)
archive = root / f"eigen-{version}.tar.gz"
root.mkdir(parents=True, exist_ok=True)
url = f"https://gitlab.com/libeigen/eigen/-/archive/{version}/eigen-{version}.tar.gz"
print(f"Downloading {url}")
urllib.request.urlretrieve(url, archive)
with tarfile.open(archive, "r:gz") as tar:
tar.extractall(root)
extracted = root / f"eigen-{version}"
for child in root.iterdir():
if child.is_dir() and child.name.startswith(f"eigen-{version}") and child != extracted:
if extracted.exists():
shutil.rmtree(extracted)
child.rename(extracted)
break
if not (extracted / "Eigen" / "Dense").is_file():
raise SystemExit(f"Eigen headers missing after extraction: {extracted}")
archive.unlink(missing_ok=True)
print(f"Eigen ready at {extracted}")
PY
- name: Build wheels with cibuildwheel
uses: pypa/cibuildwheel@v2.23.3
env:
CIBW_ARCHS: ${{ matrix.archs }}
CIBW_BUILD: ${{ matrix.build }}
CIBW_SKIP: "pp* *-musllinux_*"
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28
CIBW_ENVIRONMENT_LINUX: "EIGEN3_INCLUDE_DIR=/project/.cibw/eigen-3.4.0"
CIBW_ENVIRONMENT_MACOS: "EIGEN3_INCLUDE_DIR=${{ github.workspace }}/.cibw/eigen-3.4.0"
CIBW_ENVIRONMENT_WINDOWS: "EIGEN3_INCLUDE_DIR=${{ github.workspace }}/.cibw/eigen-3.4.0"
CIBW_TEST_SKIP: "*-win32 *-manylinux_i686 *-musllinux_*"
CIBW_TEST_COMMAND: "python -c \"import robocore, robocore.kinematics, robocore.transform, robocore.dynamics, robocore.configs, robocore.benchmark; robocore.set_backend('numpy'); from robocore.transform import rpy_to_matrix; assert rpy_to_matrix(0.0, 0.0, 0.0).shape == (3, 3); print(robocore.__version__)\""
- name: Upload built wheels
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.name }}
path: wheelhouse/*.whl
if-no-files-found: error
build_sdist:
name: sdist
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Build source distribution
run: |
python -m pip install --upgrade build
python -m build --sdist
- name: Upload source distribution
uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz
if-no-files-found: error
benchmark_smoke:
name: benchmark-smoke
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Download Eigen headers into the repository workspace
shell: bash
run: |
python - <<'PY'
import tarfile
import urllib.request
from pathlib import Path
version = "3.4.0"
root = Path(".cibw")
destination = root / f"eigen-{version}"
if destination.exists():
raise SystemExit(0)
archive = root / f"eigen-{version}.tar.gz"
root.mkdir(parents=True, exist_ok=True)
urllib.request.urlretrieve(
f"https://gitlab.com/libeigen/eigen/-/archive/{version}/eigen-{version}.tar.gz",
archive,
)
with tarfile.open(archive, "r:gz") as tar:
tar.extractall(root)
archive.unlink(missing_ok=True)
PY
- name: Install benchmark smoke dependencies
run: |
python -m pip install --upgrade pip
EIGEN3_INCLUDE_DIR="${{ github.workspace }}/.cibw/eigen-3.4.0" python -m pip install -e ".[descriptions]"
- name: Run benchmark smoke
run: |
python -m robocore.benchmark kinematics \
--backends cpp,numpy \
--samples 3 \
--ik-samples 3 \
--repeats 1 \
--inner-single 1 \
--inner-batch 1 \
--output-dir benchmark-results
python -m robocore.benchmark dynamics \
--backends cpp,numpy \
--samples 3 \
--repeats 1 \
--inner-single 1 \
--inner-batch 1 \
--output-dir benchmark-results
publish:
name: Publish To PyPI
runs-on: ubuntu-latest
needs:
- build_wheels
- build_sdist
- benchmark_smoke
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Download wheels
uses: actions/download-artifact@v4
with:
pattern: wheels-*
merge-multiple: true
path: dist
- name: Download source distribution
uses: actions/download-artifact@v4
with:
name: sdist
path: dist
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Verify distributions
run: |
python -m pip install --upgrade twine
python -m twine check dist/*
- name: Upload to PyPI with twine
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: python -m twine upload dist/*