From d0714ebdc51baf31b7952c156569b3563db02cad Mon Sep 17 00:00:00 2001 From: koide3 <31344317+koide3@users.noreply.github.com> Date: Wed, 10 Jul 2024 18:17:27 +0900 Subject: [PATCH] new ci (#13) * new ci * fix url --- .dockerignore | 3 ++ .github/workflows/build.yml | 35 +++++++++++++--- .github/workflows/gendoc.yml | 38 +++++++++++++++++ docker/jammy/Dockerfile | 37 ---------------- docker/jammy_llvm/Dockerfile | 42 ------------------- .../Dockerfile => ubuntu/Dockerfile.gcc} | 14 ++----- docker/ubuntu/Dockerfile.gcc.cuda | 20 +++++++++ .../Dockerfile => ubuntu/Dockerfile.llvm} | 12 +----- docker/ubuntu/Dockerfile.llvm.cuda | 22 ++++++++++ docs/Makefile | 22 ++++++++++ docs/api.md | 5 +-- 11 files changed, 142 insertions(+), 108 deletions(-) create mode 100644 .dockerignore create mode 100644 .github/workflows/gendoc.yml delete mode 100644 docker/jammy/Dockerfile delete mode 100644 docker/jammy_llvm/Dockerfile rename docker/{focal/Dockerfile => ubuntu/Dockerfile.gcc} (69%) create mode 100644 docker/ubuntu/Dockerfile.gcc.cuda rename docker/{focal_llvm/Dockerfile => ubuntu/Dockerfile.llvm} (74%) create mode 100644 docker/ubuntu/Dockerfile.llvm.cuda create mode 100644 docs/Makefile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..8fa4f023 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +.git/* +docs/* +docker/* \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5f915dea..1e460215 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,6 +7,8 @@ on: pull_request: branches: [ master ] paths-ignore: '**.md' + repository_dispatch: + types: [trigger-event] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -16,7 +18,14 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - DISTRO: [focal, focal_llvm, jammy, jammy_llvm] + DISTRO: [ + { "ubuntu": "noble", "suffix": "gcc" }, + { "ubuntu": "noble", "suffix": "llvm" }, + { "ubuntu": "jammy", "suffix": "gcc" }, + { "ubuntu": "jammy", "suffix": "llvm" }, + { "ubuntu": "jammy_cuda12.2", "suffix": "gcc.cuda" }, + { "ubuntu": "jammy_cuda12.2", "suffix": "llvm.cuda" } + ] steps: - uses: actions/checkout@v2 @@ -26,14 +35,30 @@ jobs: - name: Docker login continue-on-error: true - uses: docker/login-action@v1 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_TOKEN }} - name: Docker build - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v6 with: - file: ${{github.workspace}}/docker/${{ matrix.DISTRO }}/Dockerfile + tags: koide3/glim:${{ matrix.DISTRO.ubuntu }} + file: ${{github.workspace}}/docker/ubuntu/Dockerfile.${{ matrix.DISTRO.suffix }} + build-args: | + BASE_IMAGE=koide3/gtsam_points:${{ matrix.DISTRO.ubuntu }} context: . - push: false + + dispatch: + needs: build + strategy: + matrix: + repo: ['koide3/glim_ros1', 'koide3/glim_ros2'] + runs-on: ubuntu-latest + steps: + - name: Repository Dispatch + uses: peter-evans/repository-dispatch@v3 + with: + token: ${{ secrets.GH_PAT }} + repository: ${{ matrix.repo }} + event-type: trigger-event \ No newline at end of file diff --git a/.github/workflows/gendoc.yml b/.github/workflows/gendoc.yml new file mode 100644 index 00000000..21413858 --- /dev/null +++ b/.github/workflows/gendoc.yml @@ -0,0 +1,38 @@ +name: gendoc + +on: + push: + tags: + - '*' + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + gendoc: + name: Generate documentation + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Configure Git Credentials + run: | + git config user.name github-actions[bot] + git config user.email 41898282+github-actions[bot]@users.noreply.github.com + + - name : Install dependencies + run: sudo apt-get install -y git cmake build-essential doxygen graphviz python3-dev + + - name: Install python dependencies + run: python -m pip install mkdocs mkdocs-material + + - name: Generate documentation + run: cd docs && make all + + - uses: actions/upload-artifact@v4 + with: + name: site + path: ./site/* + + - name: Deploy documentation + run: cd docs && make deploy diff --git a/docker/jammy/Dockerfile b/docker/jammy/Dockerfile deleted file mode 100644 index 4e87b34a..00000000 --- a/docker/jammy/Dockerfile +++ /dev/null @@ -1,37 +0,0 @@ -FROM koide3/gtsam_docker:jammy_cuda11.8 - -RUN apt-get update \ - && apt-get install --no-install-recommends -y \ - libfmt-dev libspdlog-dev libopencv-dev \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* - -# without viewer and CUDA -COPY . /root/glim -WORKDIR /root/glim/build -RUN cmake .. \ - -DBUILD_WITH_CUDA=OFF \ - -DBUILD_WITH_VIEWER=OFF \ - -DBUILD_WITH_MARCH_NATIVE=OFF \ - -DCMAKE_BUILD_TYPE=Release -RUN make -j$(nproc) - -# with viewer -WORKDIR /root/glim/build -RUN cmake .. \ - -DBUILD_WITH_CUDA=OFF \ - -DBUILD_WITH_VIEWER=ON \ - -DBUILD_WITH_MARCH_NATIVE=OFF \ - -DCMAKE_BUILD_TYPE=Release -RUN make -j$(nproc) - -# with CUDA -WORKDIR /root/glim/build -RUN cmake .. \ - -DBUILD_WITH_CUDA=ON \ - -DBUILD_WITH_VIEWER=ON \ - -DBUILD_WITH_MARCH_NATIVE=OFF \ - -DCMAKE_BUILD_TYPE=Release -RUN make -j$(nproc) - -CMD ["bash"] diff --git a/docker/jammy_llvm/Dockerfile b/docker/jammy_llvm/Dockerfile deleted file mode 100644 index 338b1ba3..00000000 --- a/docker/jammy_llvm/Dockerfile +++ /dev/null @@ -1,42 +0,0 @@ -FROM koide3/gtsam_docker:jammy_cuda11.8 - -RUN apt-get update \ - && apt-get install --no-install-recommends -y \ - libfmt-dev libspdlog-dev libopencv-dev \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* - -RUN update-alternatives --install /usr/bin/ld ld /usr/bin/ld.lld 50 - -# without viewer and CUDA -COPY . /root/glim -WORKDIR /root/glim/build -RUN CC=clang CXX=clang++ cmake .. \ - -DBUILD_WITH_CUDA=OFF \ - -DBUILD_WITH_VIEWER=OFF \ - -DBUILD_WITH_MARCH_NATIVE=OFF \ - -DCMAKE_BUILD_TYPE=Release -RUN make -j$(nproc) - -# with viewer -WORKDIR /root/glim/build -RUN CC=clang CXX=clang++ cmake .. \ - -DBUILD_WITH_CUDA=OFF \ - -DBUILD_WITH_VIEWER=ON \ - -DBUILD_WITH_MARCH_NATIVE=OFF \ - -DCMAKE_BUILD_TYPE=Release -RUN make -j$(nproc) - -# resolve omp_is_initial_device-related errors -RUN sed -i '496{s/^/\/\//}' /usr/lib/llvm-14/lib/clang/14.0.0/include/omp.h - -# with CUDA -WORKDIR /root/glim/build -RUN CC=clang CXX=clang++ cmake .. \ - -DBUILD_WITH_CUDA=ON \ - -DBUILD_WITH_VIEWER=ON \ - -DBUILD_WITH_MARCH_NATIVE=OFF \ - -DCMAKE_BUILD_TYPE=Release -RUN make -j$(nproc) - -CMD ["bash"] diff --git a/docker/focal/Dockerfile b/docker/ubuntu/Dockerfile.gcc similarity index 69% rename from docker/focal/Dockerfile rename to docker/ubuntu/Dockerfile.gcc index 7c166514..04c53ea6 100644 --- a/docker/focal/Dockerfile +++ b/docker/ubuntu/Dockerfile.gcc @@ -1,4 +1,5 @@ -FROM koide3/gtsam_docker:focal_cuda11.2 +ARG BASE_IMAGE=koide3/gtsam_points:jammy +FROM $BASE_IMAGE RUN apt-get update \ && apt-get install --no-install-recommends -y \ @@ -14,7 +15,7 @@ RUN cmake .. \ -DBUILD_WITH_VIEWER=OFF \ -DBUILD_WITH_MARCH_NATIVE=OFF \ -DCMAKE_BUILD_TYPE=Release -RUN make -j$(nproc) +RUN make -j$(nproc) # with viewer WORKDIR /root/glim/build @@ -25,13 +26,4 @@ RUN cmake .. \ -DCMAKE_BUILD_TYPE=Release RUN make -j$(nproc) -# with CUDA -WORKDIR /root/glim/build -RUN cmake .. \ - -DBUILD_WITH_CUDA=ON \ - -DBUILD_WITH_VIEWER=ON \ - -DBUILD_WITH_MARCH_NATIVE=OFF \ - -DCMAKE_BUILD_TYPE=Release -RUN make -j$(nproc) - CMD ["bash"] diff --git a/docker/ubuntu/Dockerfile.gcc.cuda b/docker/ubuntu/Dockerfile.gcc.cuda new file mode 100644 index 00000000..e1707c68 --- /dev/null +++ b/docker/ubuntu/Dockerfile.gcc.cuda @@ -0,0 +1,20 @@ +ARG BASE_IMAGE=koide3/gtsam_points:jammy_cuda12.2 +FROM $BASE_IMAGE + +RUN apt-get update \ + && apt-get install --no-install-recommends -y \ + libfmt-dev libspdlog-dev libopencv-dev \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +# with CUDA +COPY . /root/glim +WORKDIR /root/glim/build +RUN cmake .. \ + -DBUILD_WITH_CUDA=ON \ + -DBUILD_WITH_VIEWER=ON \ + -DBUILD_WITH_MARCH_NATIVE=OFF \ + -DCMAKE_BUILD_TYPE=Release +RUN make -j$(nproc) + +CMD ["bash"] diff --git a/docker/focal_llvm/Dockerfile b/docker/ubuntu/Dockerfile.llvm similarity index 74% rename from docker/focal_llvm/Dockerfile rename to docker/ubuntu/Dockerfile.llvm index b998dada..7c198c4e 100644 --- a/docker/focal_llvm/Dockerfile +++ b/docker/ubuntu/Dockerfile.llvm @@ -1,4 +1,5 @@ -FROM koide3/gtsam_docker:focal_cuda11.2 +ARG BASE_IMAGE=koide3/gtsam_points:jammy +FROM $BASE_IMAGE RUN apt-get update \ && apt-get install --no-install-recommends -y \ @@ -27,13 +28,4 @@ RUN CC=clang CXX=clang++ cmake .. \ -DCMAKE_BUILD_TYPE=Release RUN make -j$(nproc) -# with CUDA -WORKDIR /root/glim/build -RUN CC=clang CXX=clang++ cmake .. \ - -DBUILD_WITH_CUDA=ON \ - -DBUILD_WITH_VIEWER=ON \ - -DBUILD_WITH_MARCH_NATIVE=OFF \ - -DCMAKE_BUILD_TYPE=Release -RUN make -j$(nproc) - CMD ["bash"] diff --git a/docker/ubuntu/Dockerfile.llvm.cuda b/docker/ubuntu/Dockerfile.llvm.cuda new file mode 100644 index 00000000..2cec9e6d --- /dev/null +++ b/docker/ubuntu/Dockerfile.llvm.cuda @@ -0,0 +1,22 @@ +ARG BASE_IMAGE=koide3/gtsam_points:jammy +FROM $BASE_IMAGE + +RUN apt-get update \ + && apt-get install --no-install-recommends -y \ + libfmt-dev libspdlog-dev libopencv-dev \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +RUN update-alternatives --install /usr/bin/ld ld /usr/bin/ld.lld 50 + +# with CUDA +COPY . /root/glim +WORKDIR /root/glim/build +RUN cmake .. \ + -DBUILD_WITH_CUDA=ON \ + -DBUILD_WITH_VIEWER=ON \ + -DBUILD_WITH_MARCH_NATIVE=OFF \ + -DCMAKE_BUILD_TYPE=Release +RUN make -j$(nproc) + +CMD ["bash"] diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 00000000..32ea0cdd --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,22 @@ +.PHONY: help +help: + @echo "make cpp|all" + +.PHONY: cpp +cpp: + @echo "Building C++ documentation..." + doxygen Doxyfile doc_cpp + +.PHONY: mkdocs +mkdocs: + @echo "Building MkDocs documentation..." + cd .. && mkdocs build + +.PHONY: all +all: cpp mkdocs + @echo "All documentation built." + +.PHONY: deploy +deploy: + @echo "Deploying documentation..." + cd .. && mkdocs gh-deploy --force diff --git a/docs/api.md b/docs/api.md index f56c370b..e757f83c 100644 --- a/docs/api.md +++ b/docs/api.md @@ -2,9 +2,8 @@ ## Doxygen generated API list -* [gtsam_points](https://staff.aist.go.jp/k.koide/projects/doxygen/gtsam_points/): GTSAM factors for range-based SLAM -* [glim](https://staff.aist.go.jp/k.koide/projects/doxygen/glim/): Main LiDAR-IMU SLAM package -* [glim_ext](https://staff.aist.go.jp/k.koide/projects/doxygen/glim_ext/): Example implementations of extension modules +* [gtsam_points](https://koide3.github.io/gtsam_points/doc_cpp/index.html): GTSAM factors for range-based SLAM +* [glim](https://koide3.github.io/glim/doc_cpp/index.html): LiDAR-IMU localization and mapping ## Related Repositories * [gtsam_points (https://github.com/koide3/gtsam_points)](https://github.com/koide3/gtsam_points)