Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,44 @@ concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

env:
CARGO_TERM_COLOR: always

jobs:
lint-python:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: astral-sh/setup-uv@v10.0.0
- name: Ruff
run: |
uvx ruff check
uvx ruff format --check

licenses:
# The license texts shipped in wheels must match Cargo.lock.
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: taiki-e/install-action@v2
with:
tool: cargo-about@0.9.3
- name: Regenerate licenses/THIRD_PARTY_RUST.txt
run: cargo about generate --locked -m crates/motion_py/Cargo.toml about.hbs -o licenses/THIRD_PARTY_RUST.txt
- name: Compare with the committed file
run: |
git diff --exit-code licenses/THIRD_PARTY_RUST.txt || {
echo "::error::licenses/THIRD_PARTY_RUST.txt is out of date: run the command in about.toml and commit the result"
exit 1
}

test:
name: test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: docs

# Builds the documentation on pull requests (strict: warnings fail). Releases deploy it,
# see release.yml.

on:
pull_request:
push:
branches: [main]

concurrency:
group: docs-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: compas-dev/compas-actions/docs@v1
with:
extras: docs
26 changes: 26 additions & 0 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: pr-checks

on:
pull_request:
types: [assigned, opened, synchronize, reopened, labeled, unlabeled]
branches:
- main

permissions:
contents: read

jobs:
release:
name: Validate release metadata
runs-on: ubuntu-latest
steps:
- uses: compas-dev/compas-actions/release-check@v1

changelog:
name: Check changelog
runs-on: ubuntu-latest
steps:
- uses: compas-dev/compas-actions/pr-checks@v1
with:
changelog-path: CHANGELOG.md
skip-label: no changelog
29 changes: 29 additions & 0 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: prepare release

# Opens a release pull request: bumps the version (pyproject.toml [tool.bumpversion] lists
# the files) and dates the changelog. Merging it runs release.yml.

on:
workflow_dispatch:
inputs:
release-type:
description: Semantic version component to bump
required: true
type: choice
options:
- patch
- minor
- major

permissions:
contents: write
pull-requests: write

jobs:
release-pr:
runs-on: ubuntu-latest
steps:
- uses: compas-dev/compas-actions/release-pr@v1
with:
release-type: ${{ inputs.release-type }}
github-token: ${{ github.token }}
107 changes: 107 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: release

# Runs on every push to main and does nothing unless the push is a merged release pull
# request (see prepare-release.yml): then it builds and tests the wheels and the source
# distribution, publishes them to PyPI, creates the GitHub release and deploys the docs.

on:
push:
branches: [main]

permissions:
contents: read

jobs:
release:
name: Detect release merge
runs-on: ubuntu-latest
outputs:
is-release: ${{ steps.release.outputs.is-release }}
version: ${{ steps.release.outputs.version }}
tag: ${{ steps.release.outputs.tag }}
steps:
- uses: compas-dev/compas-actions/release-check@v1
id: release

wheels:
needs: release
if: needs.release.outputs.is-release == 'true'
uses: ./.github/workflows/wheels.yml

collect:
name: Collect distributions
needs: [release, wheels]
if: needs.release.outputs.is-release == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v5
with:
pattern: wheel-*
path: dist
merge-multiple: true
- uses: actions/download-artifact@v5
with:
name: sdist
path: dist
- name: Check versions and metadata
env:
VERSION: ${{ needs.release.outputs.version }}
run: |
ls -l dist
for f in dist/*; do
case "$(basename "$f")" in
compas_fab_native-"$VERSION"-*.whl|compas_fab_native-"$VERSION".tar.gz) ;;
*) echo "::error::$f is not version $VERSION"; exit 1 ;;
esac
done
test "$(ls dist/*.whl | wc -l)" -eq 3
pipx run twine check --strict dist/*
- uses: actions/upload-artifact@v5
with:
name: python-package-distributions
path: dist/

publish:
needs: [release, collect]
if: needs.release.outputs.is-release == 'true'
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/compas_fab_native
permissions:
contents: read
id-token: write
steps:
- uses: actions/download-artifact@v5
with:
name: python-package-distributions
path: dist
- name: Publish to PyPI (trusted publishing)
uses: pypa/gh-action-pypi-publish@v1.14.2

create-release:
needs: [release, publish]
if: needs.release.outputs.is-release == 'true'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: compas-dev/compas-actions/github-release@v1
with:
github-token: ${{ github.token }}
tag-name: ${{ needs.release.outputs.tag }}
target: ${{ github.sha }}
release-name-prefix: COMPAS FAB Native

docs:
needs: [release, create-release]
if: needs.release.outputs.is-release == 'true'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: compas-dev/compas-actions/docs@v1
with:
deploy: true
version: ${{ needs.release.outputs.version }}
extras: docs
72 changes: 62 additions & 10 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
name: wheels

# Builds the compas_fab_native extension as release wheels (abi3: one wheel per platform
# for every Python >= 3.9) and tests each wheel on the oldest and newest Python we support.
# Python 3.9 is what Rhino 8 ships. Nothing is published: the wheels are uploaded as
# artifacts (native-wheel-<platform>).
# Builds the compas_fab_native extension as wheels (abi3: one wheel per platform for every
# Python >= 3.9) and a source distribution, and tests each wheel on the oldest and newest
# Python we support (3.9 is what Rhino 8 ships) and the source distribution built from
# scratch. Artifacts: wheel-<platform>, sdist.
#
# release.yml calls this workflow to build what it publishes.

on:
push:
branches: [main]
pull_request:
workflow_dispatch:
workflow_call:

concurrency:
group: wheels-${{ github.ref }}
# github.workflow is the caller's name when called, so a release never cancels (or is
# cancelled by) the regular run on the same commit.
group: ${{ github.workflow }}-wheels-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
build:
name: build (${{ matrix.platform }})
Expand All @@ -37,6 +45,8 @@ jobs:
manylinux: ""
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Build the wheel
uses: PyO3/maturin-action@v1
with:
Expand All @@ -45,9 +55,25 @@ jobs:
args: --release --out dist
- uses: actions/upload-artifact@v5
with:
name: native-wheel-${{ matrix.platform }}
name: wheel-${{ matrix.platform }}
path: dist/*.whl

sdist:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Build the source distribution
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
- uses: actions/upload-artifact@v5
with:
name: sdist
path: dist/*.tar.gz

test:
name: test (${{ matrix.platform }}, py${{ matrix.python }})
needs: build
Expand All @@ -66,18 +92,44 @@ jobs:
os: windows-2022
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- uses: actions/download-artifact@v5
with:
name: native-wheel-${{ matrix.platform }}
name: wheel-${{ matrix.platform }}
path: dist
- name: Install the wheel
shell: bash
run: |
python -m pip install --upgrade pip
python -m pip install dist/*.whl pytest
python -c "import compas_fab_native, sys; print(sys.version, compas_fab_native.__file__)"
- name: Native tests on the installed wheel
run: python -m pytest tests -q
python -c "import compas_fab_native, sys; print(sys.version, compas_fab_native.__version__, compas_fab_native.__file__)"
- name: Tests on the installed wheel
# Not from the checkout's src/: the tests must import the installed wheel.
run: python -m pytest tests -q -p no:cacheprovider

test-sdist:
name: test (sdist, py3.12)
needs: sdist
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- uses: actions/download-artifact@v5
with:
name: sdist
path: dist
- name: Build and install from the source distribution
shell: bash
run: |
python -m pip install --upgrade pip
python -m pip install dist/*.tar.gz pytest
- name: Tests on the installed package
run: python -m pytest tests -q -p no:cacheprovider
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

### Added

* `NativePlanner` and `NativeClient`: a compas_fab planning backend on a compiled (Rust) core, moved here from the `compas_fab` spike branch with its history.
* Forward kinematics, and inverse kinematics for frame and point-axis targets: closed form for UR arms and spherical-wrist arms (derived from the robot model), numerical and collision-aware for any other serial robot.
* `check_collision` on the sphere model or on the exact meshes, including tools and workpieces the robot carries.
* `plan_cartesian_motion` for frame and point-axis waypoints in robot, tool and workpiece mode, with free rotation about the tool axis.
* `plan_motion` to configuration, frame and point-axis targets, timed under joint velocity and acceleration limits.
* Mesh obstacles as signed distance fields (`NativePlanner(obstacles="esdf")`), which keep holes and concave shapes open.
* Release workflow on `compas-dev/compas-actions`: wheels for Linux (x86_64), macOS (universal2) and Windows (x64), each tested on Python 3.9 and 3.13, a source distribution, and publishing to PyPI.
* License texts of the Rust crates compiled into the extension, in `licenses/THIRD_PARTY_RUST.txt`.
* Documentation site.

### Changed

* Collision spheres are fitted in the core instead of in Python with trimesh: about 20 times faster (0.08 s instead of 1.7 s to set up a UR5), and trimesh and rtree are no longer dependencies.

### Removed
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,6 @@ follow the third-party works listed below. Their licenses are in `licenses/`.
differentiates JAX code automatically, numik.rs writes the Jacobians out).


Rust crates and Python packages used as dependencies keep their own licenses; see
`Cargo.lock` (`cargo metadata`) and `pyproject.toml`. Wheels built for distribution must
bundle their license texts (to do before the first release, e.g. with cargo-about).
Rust crates compiled into the Python extension keep their own licenses; their texts are in
`licenses/THIRD_PARTY_RUST.txt` (generated with cargo-about, see `about.toml`), which wheels
ship. Python packages installed as dependencies (`pyproject.toml`) keep theirs.
Loading
Loading