forked from epfl-lasa/control-libraries
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Version 7.1.0 contains behind-the-scenes structural improvements to the build system and the CI as well as a few minor improvements and fixes to state_representation.
- Loading branch information
Showing
29 changed files
with
426 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: Build and Push Multi-Arch Images | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
- main | ||
tags: | ||
- "v*.*.*" | ||
|
||
jobs: | ||
get-tag: | ||
runs-on: ubuntu-latest | ||
name: Get tag | ||
outputs: | ||
tag: ${{ steps.parse-tag.outputs.tag }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: aica-technology/.github/.github/actions/docker-tag-from-git@v0.6.1 | ||
id: parse-tag | ||
|
||
build: | ||
needs: [get-tag] | ||
strategy: | ||
matrix: | ||
arch: [amd64, arm64] | ||
include: | ||
- image: ubuntu-latest | ||
# FIXME: using 4vcpu image because of heavy RAM usage when building pinoccio on arm64 | ||
- image: buildjet-4vcpu-ubuntu-2204-arm | ||
arch: arm64 | ||
|
||
runs-on: ${{ matrix.image }} | ||
name: Build and publish (${{ matrix.arch }}) | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: aica-technology/.github/.github/actions/list-add-suffixes@v0.6.1 | ||
id: merge-tags | ||
with: | ||
list: ${{ needs.get-tag.outputs.tag }} | ||
suffixes: ${{ matrix.arch }} | ||
glue_separator: "-" | ||
|
||
- uses: aica-technology/.github/.github/actions/ghcr-build@v0.6.1 | ||
with: | ||
image_name: aica-technology/control-libraries | ||
image_tags: ${{ steps.merge-tags.outputs.list }} | ||
dockerfile_path: Dockerfile.ci | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
multi-arch: | ||
runs-on: ubuntu-latest | ||
name: Merge into a multi-arch image | ||
needs: [get-tag, build] | ||
steps: | ||
- uses: aica-technology/.github/.github/actions/ghcr-manifest-merge@v0.6.1 | ||
with: | ||
image_name: aica-technology/control-libraries | ||
image_tags: ${{ needs.get-tag.outputs.tag }} | ||
archs: amd64,arm64 | ||
token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
cmake_minimum_required(VERSION 3.15) | ||
project(all_control_libraries) | ||
|
||
add_subdirectory(source) | ||
add_subdirectory(protocol/clproto_cpp) | ||
|
||
if(BUILD_TESTING) | ||
# reexport the test target defined in the subdirectories | ||
enable_testing() | ||
endif() | ||
|
||
# add licenses | ||
install( | ||
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/licenses" | ||
DESTINATION "share/doc/control-libraries/licenses" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
FROM ghcr.io/aica-technology/ros2-ws:humble as base | ||
FROM base as apt-dependencies | ||
COPY apt-packages.tx[t] / | ||
|
||
RUN <<HEREDOC | ||
if [ ! -s /apt-packages.txt ]; then | ||
set +e # FIXME: without this, the script fails because of an issue with `clear_console` | ||
exit 0 | ||
fi | ||
|
||
mkdir -p /tmp/apt | ||
|
||
sudo apt-get update | ||
# We then do a dry-run and parse the output of apt to gather the list of packages to be installed | ||
# Example output: | ||
# ``` | ||
# ######### | ||
# NOTE: This is only a simulation! | ||
# apt-get needs root privileges for real execution. | ||
# Keep also in mind that locking is deactivated, | ||
# so don't depend on the relevance to the real current situation! | ||
# Reading package lists... | ||
# Building dependency tree... | ||
# Reading state information... | ||
# The following additional packages will be installed: | ||
# libavutil56 libblosc1 | ||
# The following NEW packages will be installed: | ||
# libavutil56 libblosc1 | ||
# 0 upgraded, 5 newly installed, 0 to remove and 28 not upgraded. | ||
# Inst libavutil56 (7:4.4.2-0ubuntu0.22.04.1 Ubuntu:22.04/jammy-updates, Ubuntu:22.04/jammy-security [arm64]) | ||
# Inst libblosc1 (1.21.1+ds2-2 Ubuntu:22.04/jammy [arm64]) | ||
# Conf libavutil56 (7:4.4.2-0ubuntu0.22.04.1 Ubuntu:22.04/jammy-updates, Ubuntu:22.04/jammy-security [arm64]) | ||
# Conf libblosc1 (1.21.1+ds2-2 Ubuntu:22.04/jammy [arm64]) | ||
# ``` | ||
# Transformed into: | ||
# ``` | ||
# libavutil56 | ||
# libblosc1 | ||
# ``` | ||
xargs -a /apt-packages.txt apt-get install --dry-run \ | ||
| grep -e '^Inst ' \ | ||
| sed -E 's/^Inst (\S+) .*$/\1/' > /tmp/new-packages.txt | ||
# Then we install apt packages like normal | ||
xargs -a /apt-packages.txt sudo apt-get install -y | ||
# Finally we use dpkg to get all files installed by those packages and copy them to a new root | ||
# - get list of files installed by all the packages | ||
# - remove empty lines | ||
# - sort | ||
# - remove duplicates | ||
# - copy files while keeping file hierarchy and preserving links as-is | ||
# - remove "omitting directory" messages (we don't do recursive copy as we only want specific files) for cleaner output | ||
xargs -a /tmp/new-packages.txt dpkg-query -L \ | ||
| sed '/^$/d' | sort | uniq \ | ||
| xargs -d "\n" cp --parents -dp -t /tmp/apt 2>&1 \ | ||
| grep -v 'omitting directory' | ||
# this root can then be copied to / to install everything globally or use LD_LIBRARY_PATH to use it locally | ||
HEREDOC | ||
|
||
FROM base as dep-pinocchio | ||
COPY --from=apt-dependencies /tmp/apt / | ||
ARG PINOCCHIO_TAG=v2.6.9 | ||
# FIXME: it would be nicer to have it all in the root CMakelists.txt but: | ||
# * `pinocchio` doesn't provide an include directory we can easily plug into `target_include_directories` and thus needs to be installed first | ||
# * `pinocchio` uses hacks relying on undocumented CMake quirks which break if you use `FetchContent` | ||
# FIXME: it needs `CMAKE_INSTALL_PREFIX` and `--prefix` because it doesn't install to the right place otherwise | ||
RUN \ | ||
--mount=type=cache,target=./pinocchio,id=cmake-pinocchio-src-${PINOCCHIO_TAG}-${TARGETPLATFORM},uid=1000 \ | ||
--mount=type=cache,target=./build,id=cmake-pinocchio-${PINOCCHIO_TAG}-${TARGETPLATFORM},uid=1000 \ | ||
if [ ! -f pinocchio/CMakeLists.txt ]; then rm -rf pinocchio/* && git clone --depth 1 -b ${PINOCCHIO_TAG} --recursive https://github.com/stack-of-tasks/pinocchio; fi \ | ||
&& cmake -B build -S pinocchio -DCMAKE_BUILD_TYPE=Release -DBUILD_PYTHON_INTERFACE=OFF -DCMAKE_INSTALL_PREFIX=/tmp/deps \ | ||
&& cmake --build build --target all install | ||
# FIXME: pinocchio produces non-portable paths | ||
RUN find /tmp/deps -type f -exec sed -i 's#/tmp/deps#/usr#g' '{}' \; | ||
|
||
FROM base as dep-osqp | ||
COPY dependencies/osqp.cmake CMakeLists.txt | ||
RUN \ | ||
--mount=type=cache,target=./build,id=cmake-osqp-${TARGETPLATFORM},uid=1000 \ | ||
cmake -B build -DCMAKE_BUILD_TYPE=Release \ | ||
&& cmake --build build \ | ||
&& cmake --install build --prefix /tmp/deps | ||
|
||
FROM base as dependencies | ||
# Needed to build `osqp-eigen` | ||
COPY --from=dep-osqp /tmp/deps /usr | ||
COPY dependencies/dependencies.cmake CMakeLists.txt | ||
RUN \ | ||
--mount=type=cache,target=./build,id=cmake-deps-${TARGETPLATFORM},uid=1000 \ | ||
cmake -B build -DCMAKE_BUILD_TYPE=Release \ | ||
&& cmake --build build \ | ||
&& cmake --install build --prefix /tmp/deps | ||
COPY --from=dep-osqp /tmp/deps /tmp/deps | ||
COPY --from=dep-pinocchio /tmp/deps /tmp/deps | ||
|
||
FROM base as code | ||
WORKDIR /src | ||
COPY --from=apt-dependencies /tmp/apt / | ||
COPY --from=dependencies /tmp/deps /usr | ||
COPY --chown=${USER} . /src | ||
|
||
FROM code as build | ||
RUN \ | ||
--mount=type=cache,target=./build,id=cmake-${TARGETPLATFORM},uid=1000 \ | ||
cmake -B build -DCMAKE_BUILD_TYPE=Release \ | ||
&& cmake --build build | ||
|
||
FROM build as test | ||
RUN \ | ||
--mount=type=cache,target=./build,id=cmake-${TARGETPLATFORM},uid=1000 \ | ||
cmake -B build -DBUILD_TESTING=ON \ | ||
&& CTEST_OUTPUT_ON_FAILURE=1 cmake --build build --target test | ||
|
||
FROM build as install | ||
RUN \ | ||
--mount=type=cache,target=./build,id=cmake-${TARGETPLATFORM},uid=1000 \ | ||
cmake --install build --prefix /tmp/cl | ||
|
||
FROM base as python | ||
COPY --chown=${USER} ./python /python | ||
COPY --from=install /tmp/cl /usr | ||
RUN \ | ||
--mount=type=cache,target=${HOME}/.cache,id=pip-${TARGETPLATFORM},uid=1000 \ | ||
python3 -m pip install --prefix=/tmp/python /python | ||
|
||
FROM scratch | ||
COPY --from=apt-dependencies /tmp/apt / | ||
COPY --from=dependencies /tmp/deps /usr | ||
COPY --from=install /tmp/cl /usr | ||
COPY --from=python /tmp/python/local/lib/python3.10/dist-packages/ /home/ros2/.local/lib/python3.10/site-packages/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
7.0.0 | ||
7.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
libboost-all-dev | ||
liburdfdom-dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# FIXME: it would be nicer to have it all in the root CMakelists.txt but: | ||
# * `OVERRIDE_FIND_PACKAGE` requires CMake 3.24 | ||
# * some `protobuf` includes don't work when using `FetchContent` | ||
cmake_minimum_required(VERSION 3.15) | ||
project(control-libraries-dependencies) | ||
|
||
include(FetchContent) | ||
FetchContent_Declare( | ||
OsqpEigen | ||
GIT_REPOSITORY https://github.com/robotology/osqp-eigen.git | ||
GIT_TAG v0.6.4 | ||
) | ||
|
||
FetchContent_Declare( | ||
protobuf | ||
GIT_REPOSITORY https://github.com/protocolbuffers/protobuf.git | ||
GIT_TAG v3.17.0 | ||
SOURCE_SUBDIR cmake | ||
) | ||
|
||
FetchContent_MakeAvailable(OsqpEigen protobuf) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# FIXME: it would be nicer to have it all in the root CMakelists.txt but: | ||
# * `OVERRIDE_FIND_PACKAGE` requires CMake 3.24 | ||
# * `osqp::osqp` is somehow not working in OSQP-Eigen when built together | ||
cmake_minimum_required(VERSION 3.15) | ||
project(control-libraries-osqp) | ||
|
||
include(FetchContent) | ||
FetchContent_Declare( | ||
osqp | ||
GIT_REPOSITORY https://github.com/oxfordcontrol/osqp | ||
GIT_TAG v0.6.2 | ||
) | ||
|
||
FetchContent_MakeAvailable(osqp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.