Skip to content

Commit bca301a

Browse files
Feature/pypi releases (#70)
* add extra steps to release * fix syntax * fix list syntax * initial action trigger * fix missing header for windows * switch to c++20 for numbers header * try and fix ci warnings * bump version number * drop invalid selector * skip 32 bit windows * turn off feature branch
1 parent 82847c1 commit bca301a

File tree

6 files changed

+66
-28
lines changed

6 files changed

+66
-28
lines changed

.github/workflows/wheels.yaml

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
---
22
# Adapted from:
33
# https://github.com/pypa/cibuildwheel?tab=readme-ov-file#example-setup
4+
# https://github.com/pypa/cibuildwheel/blob/main/examples/github-deploy.yml
45
name: Spark-DSG Wheels
5-
on: {release: {types: [published]}}
6+
on:
7+
workflow_dispatch: {}
8+
push: {branches: [main]}
9+
release: {types: [published]}
610
jobs:
711
build_wheels:
812
name: Build wheels on ${{ matrix.os }}
@@ -11,13 +15,38 @@ jobs:
1115
matrix:
1216
os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-latest]
1317
steps:
14-
- uses: actions/checkout@v4
15-
- uses: actions/setup-python@v5
16-
- name: Install cibuildwheel
17-
run: python -m pip install cibuildwheel
18+
- uses: actions/checkout@v5
1819
- name: Build wheels
19-
run: python -m cibuildwheel --output-dir wheelhouse
20+
uses: pypa/[email protected]
21+
env:
22+
CIBW_PLATFORM: ${{ matrix.platform || 'auto' }}
23+
CIBW_ARCHS: ${{ matrix.archs || 'auto' }}
2024
- uses: actions/upload-artifact@v4
2125
with:
2226
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
2327
path: ./wheelhouse/*.whl
28+
build_sdist:
29+
name: Build source distribution
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v5
33+
- name: Build sdist
34+
run: pipx run build --sdist
35+
- uses: actions/upload-artifact@v4
36+
with:
37+
name: cibw-sdist
38+
path: dist/*.tar.gz
39+
upload_pypi:
40+
needs: [build_wheels, build_sdist]
41+
runs-on: ubuntu-latest
42+
if: github.event_name == 'release' && github.event.action == 'published'
43+
environment: pypi
44+
permissions:
45+
id-token: write
46+
steps:
47+
- uses: actions/download-artifact@v5
48+
with:
49+
pattern: cibw-*
50+
path: dist
51+
merge-multiple: true
52+
- uses: pypa/gh-action-pypi-publish@release/v1

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
cmake_minimum_required(VERSION 3.16)
1+
cmake_minimum_required(VERSION 3.22)
22
project(spark_dsg VERSION 1.1.2)
33

4-
set(CMAKE_CXX_STANDARD 17)
4+
set(CMAKE_CXX_STANDARD 20)
55
set(CMAKE_CXX_STANDARD_REQUIRED ON)
66
set(CMAKE_CXX_EXTENSIONS OFF)
77

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "scikit_build_core.build"
44

55
[project]
66
name = "spark_dsg"
7-
version = "1.1.1"
7+
version = "1.1.2"
88
description = "Library for representing 3D scene graphs"
99
readme = "README.md"
1010
license = "BSD-3-Clause"
@@ -53,5 +53,5 @@ BUILD_SHARED_LIBS = "OFF"
5353
split-on-trailing-comma = true
5454

5555
[tool.cibuildwheel]
56-
skip = ["pp*", "*musl*"]
56+
skip = ["*musl*", "*win32*"]
5757
archs = ["native"]

src/traversability_boundary.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#include "spark_dsg/traversability_boundary.h"
22

3+
#include <cmath>
4+
#include <numbers>
5+
36
namespace spark_dsg {
47

58
bool isTraversable(TraversabilityState state, bool optimistic) {
@@ -334,7 +337,7 @@ Side Boundary::lineIntersectsSide(const Eigen::Vector2d& source) const {
334337
if (std::abs(theta_q) <= theta_0) {
335338
return Side::RIGHT;
336339
}
337-
if (std::abs(theta_q) >= M_PI - theta_0) {
340+
if (std::abs(theta_q) >= std::numbers::pi - theta_0) {
338341
return Side::LEFT;
339342
}
340343
if (theta_q > 0) {

tests/utest_bounding_box.cpp

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include <spark_dsg/bounding_box.h>
3737

3838
#include <Eigen/Geometry>
39+
#include <numbers>
3940

4041
namespace spark_dsg {
4142

@@ -143,10 +144,12 @@ TEST(BoundingBoxTests, BasicOBBVolumeChecksCorrect) {
143144

144145
TEST(BoundingBoxTests, RotatedOBBVolumeChecksCorrect) {
145146
// positive pi / 6 rotation around z
146-
BoundingBox box(
147-
Eigen::Vector3f(2.0, 3.0, 4.0),
148-
Eigen::Vector3f(5.0, 5.5, 6.0),
149-
Eigen::Quaternionf(std::cos(M_PI / 12.0), 0.0, 0.0, std::sin(M_PI / 12.0)));
147+
BoundingBox box(Eigen::Vector3f(2.0, 3.0, 4.0),
148+
Eigen::Vector3f(5.0, 5.5, 6.0),
149+
Eigen::Quaternionf(std::cos(std::numbers::pi / 12.0),
150+
0.0,
151+
0.0,
152+
std::sin(std::numbers::pi / 12.0)));
150153
EXPECT_NEAR(24.0f, box.volume(), 1.0e-8f);
151154

152155
{ // previously inside, but now outside
@@ -244,8 +247,9 @@ TEST(BoundingBoxTests, RAABBVolumeChecksNonZeroOrigin) {
244247

245248
TEST(BoundingBoxTests, RAABBVolumeChecksCorrectWithRotation) {
246249
// positive pi / 12 rotation around z
247-
BoundingBox box(
248-
Eigen::Vector3f(1.0, 2.0, 3.0), Eigen::Vector3f(0.5, 1.0, 1.5), M_PI / 12.0);
250+
BoundingBox box(Eigen::Vector3f(1.0, 2.0, 3.0),
251+
Eigen::Vector3f(0.5, 1.0, 1.5),
252+
std::numbers::pi / 12.0);
249253
EXPECT_NEAR(6.0f, box.volume(), 1.0e-8f);
250254

251255
{ // inside (at center)
@@ -341,18 +345,18 @@ TEST(BoundingBoxTests, computeOrientedIoU) {
341345
Eigen::Vector3f pos(0.0, 0.0, 0.0);
342346
// 90-degree rotations -> IoU of 1
343347
BoundingBox box(size, pos, 0.0f);
344-
BoundingBox box2(size, pos, M_PI / 2.0f);
348+
BoundingBox box2(size, pos, std::numbers::pi / 2.0f);
345349

346350
EXPECT_EQ(box.computeIoU(box2), 1.0f);
347351

348-
box2 = BoundingBox(size, pos, M_PI / 4.0f);
352+
box2 = BoundingBox(size, pos, std::numbers::pi / 4.0f);
349353
EXPECT_NEAR(box.computeIoU(box2), 1.0f / std::sqrt(2.0f), 1.0e-3f);
350354
}
351355

352356
TEST(BoundingBoxTests, Corners) {
353357
Eigen::Vector3f size(1.0, 2.0, 3.0);
354358
Eigen::Vector3f pos(0.5, 1.0, 1.5);
355-
const float yaw = M_PI / 6;
359+
const float yaw = std::numbers::pi / 6;
356360
const BoundingBox box(size, pos, yaw);
357361
const auto corners = box.corners();
358362

@@ -370,7 +374,7 @@ TEST(BoundingBoxTests, Corners) {
370374
TEST(BoundingBoxTests, frameConversions) {
371375
const Eigen::Vector3f size(1.0, 2.0, 3.0);
372376
const Eigen::Vector3f pos(0.5, 1.0, 1.5);
373-
const float yaw = M_PI / 6;
377+
const float yaw = std::numbers::pi / 6;
374378
const BoundingBox box(size, pos, yaw);
375379

376380
// Center.
@@ -412,17 +416,18 @@ TEST(BoundingBoxTests, merge) {
412416
EXPECT_EQ(Eigen::Vector3f(0, 0, 0), box1.world_P_center);
413417

414418
// General Box (RAABB).
415-
box1 =
416-
BoundingBox(Eigen::Vector3f(1, 2, 3), Eigen::Vector3f(0.5, 1.0, 1.5), M_PI / 6);
417-
box2 = BoundingBox(
418-
Eigen::Vector3f(1.5, 1.5, 1.5), Eigen::Vector3f(0.5, 1.0, 1.5), M_PI / 6);
419+
box1 = BoundingBox(
420+
Eigen::Vector3f(1, 2, 3), Eigen::Vector3f(0.5, 1.0, 1.5), std::numbers::pi / 6);
421+
box2 = BoundingBox(Eigen::Vector3f(1.5, 1.5, 1.5),
422+
Eigen::Vector3f(0.5, 1.0, 1.5),
423+
std::numbers::pi / 6);
419424
box1.merge(box2);
420425
const float yaw = box1.world_R_center.eulerAngles(0, 1, 2)[2];
421426
// The solution finds the 90deg rotated box, i.e. y=x and yaw=-60deg from 30 deg.
422427
EXPECT_NEAR(2, box1.dimensions(0), 1.0e-6f);
423428
EXPECT_NEAR(1.5, box1.dimensions(1), 1.0e-6f);
424429
EXPECT_NEAR(3, box1.dimensions(2), 1.0e-6f);
425-
EXPECT_NEAR(-M_PI / 3, yaw, 1.0e-6f);
430+
EXPECT_NEAR(-std::numbers::pi / 3, yaw, 1.0e-6f);
426431
}
427432

428433
} // namespace spark_dsg

tests/utest_bounding_box_extraction.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include <spark_dsg/bounding_box_extraction.h>
3737

3838
#include <Eigen/Geometry>
39+
#include <numbers>
3940

4041
namespace spark_dsg {
4142

@@ -44,7 +45,7 @@ inline float getRotationError(const Eigen::Quaternionf& rotation,
4445
const BoundingBox& box) {
4546
// we only care up to 180 degrees orientation
4647
return std::fmod(rotation.angularDistance(Eigen::Quaternionf(box.world_R_center)),
47-
M_PI);
48+
std::numbers::pi);
4849
}
4950

5051
struct TestAdaptor : public bounding_box::PointAdaptor {
@@ -158,7 +159,7 @@ TEST(BoundingBoxExtractionTests, RAABBFromPoints) {
158159
TEST(BoundingBoxExtractionTests, RAABBFromPointsNonTrivial) {
159160
TestAdaptor adaptor;
160161
const size_t num_steps = 2;
161-
const float angle = M_PI / 6.0f;
162+
const float angle = std::numbers::pi / 6.0f;
162163
const float length = 5.0;
163164
const float width = 2.0;
164165
const float height = 0.4;

0 commit comments

Comments
 (0)