From 941a02ced858dc9b7248c46a260b58ca42e07ce0 Mon Sep 17 00:00:00 2001 From: "k.koide" Date: Fri, 29 Mar 2024 14:08:20 +0900 Subject: [PATCH] CI --- .github/workflows/build.yml | 39 +++++++++++++++++++ CMakeLists.txt | 4 +- docker/Dockerfile.gcc | 25 ++++++++++++ docker/Dockerfile.llvm | 35 +++++++++++++++++ .../registration/registration_helper.cpp | 3 ++ 5 files changed, 104 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 docker/Dockerfile.gcc create mode 100644 docker/Dockerfile.llvm diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..f0fa487 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,39 @@ +name: Build + +on: + push: + branches: [ master ] + paths-ignore: '**.md' + pull_request: + branches: [ master ] + paths-ignore: '**.md' + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + TOOLCHAIN: [gcc, llvm] + + steps: + - uses: actions/checkout@v2 + with: + token: ${{ secrets.GH_PAT }} + submodules: recursive + + - name: Docker login + continue-on-error: true + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN }} + + - name: Docker build + uses: docker/build-push-action@v2 + with: + file: ${{github.workspace}}/docker/Dockerfile${{ matrix.TOOLCHAIN }} + context: . + push: false diff --git a/CMakeLists.txt b/CMakeLists.txt index d23f34b..54345b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,7 +63,7 @@ if(BUILD_BENCHMARKS) add_compile_definitions(BUILD_WITH_TBB) endif() if (BUILD_WITH_PCL) - find_package(PCL REQUIRED) + find_package(PCL REQUIRED COMPONENTS registration) add_compile_definitions(BUILD_WITH_PCL) endif() if (BUILD_WITH_IRIDESCENCE) @@ -130,7 +130,7 @@ endif() ########## if(BUILD_TESTS) find_package(fmt REQUIRED) - find_package(PCL REQUIRED) + find_package(PCL REQUIRED COMPONENTS registration) find_package(TBB REQUIRED) include(FetchContent) diff --git a/docker/Dockerfile.gcc b/docker/Dockerfile.gcc new file mode 100644 index 0000000..830b5c5 --- /dev/null +++ b/docker/Dockerfile.gcc @@ -0,0 +1,25 @@ +FROM ubuntu:jammy + +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && apt-get install --no-install-recommends -y \ + && apt-get install --no-install-recommends -y \ + wget nano build-essential git cmake \ + libeigen3-dev libfmt-dev libtbb-dev libomp-dev libpcl-dev \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +COPY . /root/small_gicp +WORKDIR /root/small_gicp/build +RUN rm -rf ./* + +RUN cmake .. -DBUILD_WITH_TBB=ON +RUN cmake --build . -j$(nproc) + +RUN cmake .. -DBUILD_TESTS=ON -DBUILD_WITH_TBB=ON -DBUILD_BENCHMARKS=ON -DBUILD_WITH_PCL=ON +RUN cmake --build . -j$(nproc) +RUN ctest -j$(nproc) + +WORKDIR / + +CMD ["bash"] \ No newline at end of file diff --git a/docker/Dockerfile.llvm b/docker/Dockerfile.llvm new file mode 100644 index 0000000..f3da541 --- /dev/null +++ b/docker/Dockerfile.llvm @@ -0,0 +1,35 @@ +FROM ubuntu:jammy + +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && apt-get install --no-install-recommends -y \ + && apt-get install --no-install-recommends -y \ + wget nano build-essential git cmake \ + libeigen3-dev libfmt-dev libtbb-dev libomp-dev libpcl-dev \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +RUN apt-get update && apt-get install --no-install-recommends -y \ + && apt-get install --no-install-recommends -y \ + clang lld \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +RUN update-alternatives --install /usr/bin/ld ld /usr/bin/ld.lld 50 +ENV CC=clang +ENV CXX=clang++ + +COPY . /root/small_gicp +WORKDIR /root/small_gicp/build +RUN rm -rf ./* + +RUN cmake .. -DBUILD_WITH_TBB=ON +RUN cmake --build . -j$(nproc) + +RUN cmake .. -DBUILD_TESTS=ON -DBUILD_WITH_TBB=ON -DBUILD_BENCHMARKS=ON -DBUILD_WITH_PCL=ON +RUN cmake --build . -j$(nproc) +RUN ctest -j$(nproc) + +WORKDIR / + +CMD ["bash"] \ No newline at end of file diff --git a/src/small_gicp/registration/registration_helper.cpp b/src/small_gicp/registration/registration_helper.cpp index d1565bb..271c521 100644 --- a/src/small_gicp/registration/registration_helper.cpp +++ b/src/small_gicp/registration/registration_helper.cpp @@ -79,6 +79,9 @@ align(const std::vector>&, const std::vector& target_tree, const Eigen::Isometry3d& init_T, const RegistrationSetting& setting) { switch (setting.type) { + default: + std::cerr << "invalid registration type" << std::endl; + abort(); case RegistrationSetting::ICP: { Registration registration; registration.reduction.num_threads = setting.num_threads;