Skip to content

Commit

Permalink
ci: sophus_pyo3 wheels
Browse files Browse the repository at this point in the history
  • Loading branch information
strasdat committed Mar 24, 2024
1 parent 7de5bdd commit 35c3d86
Show file tree
Hide file tree
Showing 4 changed files with 141 additions and 14 deletions.
17 changes: 11 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,26 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: "recursive"
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- name: Run sccache stat for check before
shell: bash
run: ${SCCACHE_PATH} --show-stats
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: cargo
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
run: |
sudo apt-get update -y
sudo apt-get install -y nasm
cargo doc --no-deps
cargo fmt --check
cargo test --release
- uses: PyO3/maturin-action@v1
with:
command: build
args: --release
working-directory: crates/sophus_pyo3

- name: Run sccache stat for check after
shell: bash
run: ${SCCACHE_PATH} --show-stats


122 changes: 122 additions & 0 deletions .github/workflows/py_wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# This file is autogenerated by maturin v1.5.0
# To update, run
#
# maturin generate-ci github
#
name: py_wheels

on:
push:
branches:
- main
- master
tags:
- '*'
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
linux:
runs-on: ubuntu-latest
strategy:
matrix:
target: [x86_64, x86, aarch64, armv7]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist
working-directory: crates/sophus_pyo3
sccache: 'true'
manylinux: auto
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.target }}
path: crates/sophus_pyo3/dist

windows:
runs-on: windows-latest
strategy:
matrix:
target: [x64, x86]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
architecture: ${{ matrix.target }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist
working-directory: crates/sophus_pyo3
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-windows-${{ matrix.target }}
path: crates/sophus_pyo3/dist

macos:
runs-on: macos-latest
strategy:
matrix:
target: [x86_64, aarch64]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist
working-directory: crates/sophus_pyo3
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-macos-${{ matrix.target }}
path: crates/sophus_pyo3/dist

sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
working-directory: crates/sophus_pyo3
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: wheels-sdist
path: crates/sophus_pyo3/dist

release:
name: Release
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs: [linux, windows, macos, sdist]
steps:
- uses: actions/download-artifact@v4
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
with:
command: upload
args: --non-interactive --skip-existing wheels-*/*
14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ repository = "https://github.com/farm-ng/sophus-rs/"
version = "0.4.0"

[workspace.dependencies]
sophus = {path = "crates/sophus"}
sophus_calculus = {path = "crates/sophus_calculus"}
sophus_image = {path = "crates/sophus_image"}
sophus_lie = {path = "crates/sophus_lie"}
sophus_opt = {path = "crates/sophus_opt"}
sophus_sensor = {path = "crates/sophus_sensor"}
sophus_tensor = {path = "crates/sophus_tensor"}
sophus = {path = "crates/sophus", version = "0.4.0"}
sophus_calculus = {path = "crates/sophus_calculus", version = "0.4.0"}
sophus_image = {path = "crates/sophus_image", version = "0.4.0"}
sophus_lie = {path = "crates/sophus_lie", version = "0.4.0"}
sophus_opt = {path = "crates/sophus_opt", version = "0.4.0"}
sophus_sensor = {path = "crates/sophus_sensor", version = "0.4.0"}
sophus_tensor = {path = "crates/sophus_tensor", version = "0.4.0"}

approx = {version = "0.5.1"}
as-any = "0.3.1"
Expand Down
2 changes: 1 addition & 1 deletion crates/sophus_pyo3/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use numpy::pyo3::prelude::*;
/// the `lib.name` setting in the `Cargo.toml`, else Python will not be able to
/// import the module.
#[pymodule]
fn sophus(_py: Python, m: &PyModule) -> PyResult<()> {
fn sophus_pyo3(_py: Python, m: &PyModule) -> PyResult<()> {
m.add_class::<PyRotation2>()?;
m.add_class::<PyIsometry2>()?;
m.add_class::<PyRotation3>()?;
Expand Down

0 comments on commit 35c3d86

Please sign in to comment.