Skip to content

Commit 648bfab

Browse files
Fix Python wheels auto versioning (#29)
* Catch2 tests moved under the flag BUILD_TESTING and are OFF be default * fix: setup.py manually enable versioneer * fix: add sort_by option to versioneer * fix: git add safe directory for linux build * fix: checkout v1 * fix: rename publish wheel step --------- Co-authored-by: Aleksei Panchenko <nosmokingsurfer@gmail.com> Co-authored-by: Arthur_Ch <56088401+ArthurChains@users.noreply.github.com>
1 parent 0a9a285 commit 648bfab

File tree

9 files changed

+37
-40
lines changed

9 files changed

+37
-40
lines changed

.github/workflows/wheels.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ jobs:
2727
cmake -S $PWD -B $PWD/build \
2828
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=$PWD/bin \
2929
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=$PWD/lib \
30+
-DBUILD_TESTING=TRUE \
3031
&& cmake --build build -j $(nproc)
3132
3233
- name: C++ unit tests
@@ -55,6 +56,9 @@ jobs:
5556
run: |
5657
env pybin=$(LANG=C ls -d1r /opt/python/cp3*/bin | head -n 1) bash -c '$pybin/python -m pip install cmake && mkdir -p /usr/local/bin && ln -svf $pybin/cmake /usr/local/bin/cmake'
5758
cmake --version
59+
60+
- name: Add git safe directory
61+
run: git config --global --add safe.directory /__w/mrob/mrob
5862

5963
- name: Build Python wheel
6064
run: scripts/build-wheel-linux.sh
@@ -202,7 +206,7 @@ jobs:
202206
203207
204208
publish_pypi:
205-
name: Publish macOS wheel to PyPI
209+
name: Publish wheels to PyPI
206210
needs: test_wheel
207211
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
208212
runs-on: ubuntu-latest
@@ -219,7 +223,7 @@ jobs:
219223

220224

221225
publish-github-release:
222-
name: Publish macOS wheel to GitHub Releases
226+
name: Publish wheels to GitHub Releases
223227
needs: test_wheel
224228
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
225229
runs-on: ubuntu-latest

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,5 @@ __pycache__
2727

2828
dist/
2929
mrob.egg-info/
30+
mrob/
31+
wheelhouse/

CMakeLists.txt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,19 @@ ELSEIF(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
2828
ELSE()
2929
ENDIF(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
3030

31+
# BUILD_TESTING option handling. By default tests are turned off but the value is cached and can be changed in Cmake-GUI
32+
set(BUILD_TESTING false CACHE BOOL "Build unit tests for MROB modules")
33+
34+
MESSAGE(STATUS "Build Tests: ${BUILD_TESTING}")
35+
3136
IF(ANDROID)
32-
SET(BUILD_TESTING OFF)
37+
SET(BUILD_TESTING false)
3338
ELSE(ANDROID)
34-
SET(BUILD_TESTING ON)
35-
enable_testing()
39+
IF(BUILD_TESTING)
40+
enable_testing()
41+
ENDIF(BUILD_TESTING)
3642
ENDIF(ANDROID)
3743

38-
MESSAGE(STATUS "Build Tests: ${BUILD_TESTING}")
3944

4045
# ===================================================================
4146
INCLUDE_DIRECTORIES(SYSTEM ./external/Eigen)

setup.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def finalize_options(self):
3737

3838
def get_tag(self):
3939
python, abi, plat = _bdist_wheel.get_tag(self)
40+
print(f"BDIST PY,ABI,PLAT: {python}, {abi}, {plat}")
4041
if platform.system() == "Darwin":
4142
python, abi = 'py3', 'none'
4243
name = plat[:plat.find("_")]
@@ -56,6 +57,10 @@ def get_tag(self):
5657
bdist_wheel = None
5758

5859
setuptools.setup(
59-
setup_requires=['setuptools-git-versioning'],
60+
setuptools_git_versioning={
61+
"enabled": True,
62+
"sort_by": "creatordate",
63+
},
64+
setup_requires=['setuptools-git-versioning<2'],
6065
cmdclass={'bdist_wheel': bdist_wheel}
6166
)

src/geometry/CMakeLists.txt

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# locate the additional necessary dependencies, if any
22

3-
43
# extra source files
54
SET(sources
65
SO3.cpp
@@ -16,25 +15,9 @@ SET(headers
1615
)
1716

1817
# create the shared library
19-
ADD_LIBRARY(SE3 SHARED ${sources})
20-
#TARGET_LINK_LIBRARIES( .. )
21-
#target_link_libraries(${PROJECT_NAME} ${position_3d_LIBRARY})
22-
23-
24-
#install
25-
#INSTALL(TARGETS people_prediction
26-
# RUNTIME DESTINATION bin
27-
# LIBRARY DESTINATION lib/SE3
28-
# ARCHIVE DESTINATION lib/SE3)
29-
30-
#INSTALL(FILES ${headers} DESTINATION include/iridrivers/people_prediction)
31-
#INSTALL(FILES ${headers_random} DESTINATION include/iridrivers/people_prediction/random)
32-
#INSTALL(FILES ${headers_scene_elements} DESTINATION include/iridrivers/people_prediction/scene_elements)
33-
#INSTALL(FILES ${headers_nav} DESTINATION include/iridrivers/people_prediction/nav)
34-
35-
36-
#INSTALL(FILES ../Findpeople_prediction.cmake DESTINATION ${CMAKE_ROOT}/Modules/)
37-
18+
ADD_LIBRARY(SE3 SHARED ${sources})
3819

39-
ADD_SUBDIRECTORY(examples)
40-
#ADD_SUBDIRECTORY(test)
20+
# build tests if enabled
21+
IF(BUILD_TESTING)
22+
ADD_SUBDIRECTORY(tests)
23+
ENDIF(BUILD_TESTING)

src/geometry/examples/CMakeLists.txt

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/geometry/tests/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/external/Catch2/single_include/)
2+
3+
ADD_EXECUTABLE(test_SE3 test_SE3.cpp)
4+
TARGET_LINK_LIBRARIES(test_SE3 SE3)
5+
ADD_TEST(NAME test_SE3 COMMAND $<TARGET_FILE:test_SE3>)
6+
7+
ADD_EXECUTABLE(test_SE3cov test_SE3cov.cpp)
8+
TARGET_LINK_LIBRARIES(test_SE3cov SE3)
9+
ADD_TEST(NAME test_SE3cov COMMAND $<TARGET_FILE:test_SE3cov>)
File renamed without changes.

0 commit comments

Comments
 (0)