diff --git a/.github/scripts/ccache_with_fix.sh b/.github/scripts/ccache_with_fix.sh new file mode 100755 index 000000000..7235cc4d7 --- /dev/null +++ b/.github/scripts/ccache_with_fix.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +BASEDIR=$(ls -d /__w/beluga/beluga/ros_ws/src/??????????? | head -n 1) + +echo "Using CCACHE_BASEDIR=$BASEDIR" + +exec \ + env VERBOSE=1 \ + env CCACHE_BASEDIR=$BASEDIR \ + ccache $@ diff --git a/.github/workflows/ci_pipeline.yml b/.github/workflows/ci_pipeline.yml index 7c0ff8f5a..b468c478b 100644 --- a/.github/workflows/ci_pipeline.yml +++ b/.github/workflows/ci_pipeline.yml @@ -11,6 +11,7 @@ jobs: runs-on: ubuntu-22.04 env: ROS_DISTRO: humble + CCACHE_DEBUG: true container: image: ros:humble-ros-base-jammy steps: @@ -25,16 +26,27 @@ jobs: - name: Install python packages run: pip install colcon-lcov-result==0.5.0 pre-commit==2.20.0 + - name: Cache + uses: Chocobo1/setup-ccache-action@v1 + with: + api_token: ${{ secrets.GITHUB_TOKEN }} + update_packager_index: false + remove_stale_cache: false + - name: Build and test uses: ros-tooling/action-ros-ci@0.2.7 with: package-name: beluga beluga_amcl - target-ros2-distro: ${{ env.ROS_DISTRO }} + target-ros2-distro: ${{ env.ROS_DISTRO }} import-token: ${{ secrets.GITHUB_TOKEN }} colcon-defaults: | { "build": { - "mixin": ["coverage-gcc", "coverage-pytest"] + "mixin": ["coverage-gcc", "coverage-pytest"], + "cmake-args": [ + "-DCMAKE_C_COMPILER_LAUNCHER=/__w/beluga/beluga/.github/scripts/ccache_with_fix.sh", + "-DCMAKE_CXX_COMPILER_LAUNCHER=/__w/beluga/beluga/.github/scripts/ccache_with_fix.sh" + ] }, "test": { "mixin": ["coverage-pytest"] @@ -42,6 +54,12 @@ jobs: } colcon-mixin-repository: https://raw.githubusercontent.com/colcon/colcon-mixin-repository/c75e4b34a3959524564afb584e2aa33c7eec323c/index.yaml + - name: Upload cache as artifact + uses: actions/upload-artifact@v3 + with: + name: ccache + path: /github/home/.cache/ccache + - name: Lint shell: bash run: |