From ff4e0040f5043eb6fbd036251335711332e8b921 Mon Sep 17 00:00:00 2001 From: Robert Haschke Date: Sun, 29 Oct 2023 10:33:32 +0100 Subject: [PATCH] CI update: Jammy ROS One, clang-format-12 --- .github/workflows/Dockerfile | 36 +++++++++++++++++++++++++++++++++++ .github/workflows/ci.yaml | 7 +++---- .github/workflows/format.yaml | 4 ++-- .pre-commit-config.yaml | 2 +- 4 files changed, 42 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/Dockerfile diff --git a/.github/workflows/Dockerfile b/.github/workflows/Dockerfile new file mode 100644 index 0000000000..5097b1c465 --- /dev/null +++ b/.github/workflows/Dockerfile @@ -0,0 +1,36 @@ +# rhaschke/ici:rviz-noetic-ros +# Image used for GHA CI builds +# build with: +# - DOCKER_BUILDKIT=1 docker build --tag rhaschke/ici:rviz-noetic-ros - < .github/workflows/Dockerfile +# - DOCKER_BUILDKIT=1 docker build --tag rhaschke/ici:rviz-jammy-ros --build-arg="BASE=ubiagni/ros:jammy-ros-base" --build-arg="ROS_DISTRO=one" - < .github/workflows/Dockerfile + +ARG ROS_DISTRO=noetic +ARG BASE=ros:noetic-ros-base +FROM ${BASE} + +ENV TERM xterm + +# Commands are combined in single RUN statement with "apt/lists" folder removal to reduce image size +# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#minimize-the-number-of-layers +RUN --mount=type=bind,target=/tmp/rviz \ + # Update apt package list as previous containers clear the cache + apt-get -q update && \ + apt-get -q -y dist-upgrade && \ + # + # Install some base dependencies + apt-get -q install --no-install-recommends -y \ + # Some basic requirements + wget git sudo \ + # Preferred build tools + clang clang-format-12 clang-tidy clang-tools ccache && \ + # + # Download all dependencies for rviz + rosdep update $(test "${ROS_DISTRO}" = "melodic" && echo "--include-eol-distros") && \ + DEBIAN_FRONTEND=noninteractive \ + rosdep install -y --from-paths /tmp/rviz --ignore-src --rosdistro ${ROS_DISTRO} --as-root=apt:false && \ + # + # Clear apt-cache to reduce image size + rm -rf /var/lib/apt/lists/* && \ + # Globally disable git security + # https://github.blog/2022-04-12-git-security-vulnerability-announced + git config --global --add safe.directory "*" diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index fdc06d515d..b649be74f0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - distro: [noetic] + distro: [noetic, jammy] ogre: ["1.9", "1.12"] include: - distro: noetic @@ -23,12 +23,12 @@ jobs: env: CXXFLAGS: "-DRVIZ_DEPRECATE_QT4_SLOTS -Werror -Wall -Wextra -Wwrite-strings -Wunreachable-code -Wpointer-arith -Wredundant-decls -Wno-strict-aliasing -Wno-sign-compare" - UPSTREAM_WORKSPACE: github:rhaschke/python_qt_binding#silent-external-warnings + UPSTREAM_WORKSPACE: ${{ matrix.distro != 'jammy' && 'github:rhaschke/python_qt_binding#silent-external-warnings' || '' }} AFTER_INSTALL_TARGET_DEPENDENCIES: apt install -qq -y libogre-${{ matrix.ogre }}-dev CATKIN_LINT: true CCACHE_DIR: ${{ github.workspace }}/.ccache BASEDIR: /home/runner/work - DOCKER_IMAGE: rhaschke/ici:rviz-${{ matrix.distro }}-${{ matrix.repo || 'ros' }} + DOCKER_IMAGE: rhaschke/ici:rviz-${{ matrix.distro }}-ros CACHE_PREFIX: ${{ matrix.distro }} # perform full clang-tidy check only on manual trigger (workflow_dispatch), PRs do check changed files, otherwise nothing CLANG_TIDY_BASE_REF: ${{ github.event_name != 'workflow_dispatch' && (github.base_ref || github.ref) || '' }} @@ -51,7 +51,6 @@ jobs: - name: industrial_ci uses: rhaschke/industrial_ci@master - env: ${{ matrix.env || env }} - name: Upload test artifacts (on failure) uses: actions/upload-artifact@v3 diff --git a/.github/workflows/format.yaml b/.github/workflows/format.yaml index 4cdbaef691..a8b29c14e2 100644 --- a/.github/workflows/format.yaml +++ b/.github/workflows/format.yaml @@ -14,8 +14,8 @@ jobs: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v3 - - name: Install clang-format-10 - run: sudo apt-get install clang-format-10 + - name: Install clang-format-12 + run: sudo apt-get install clang-format-12 - uses: rhaschke/install-catkin_lint-action@v1.0 with: distro: noetic diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 238aa32ef8..e0d80756c8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -41,7 +41,7 @@ repos: - id: clang-format name: clang-format description: Format files with ClangFormat. - entry: clang-format-10 + entry: clang-format-12 language: system files: \.(c|cc|cxx|cpp|h|hpp|hxx|ih|ispc|ipp)$ args: ["-fallback-style=none", "-i"]