Skip to content

Commit 2cdc1e2

Browse files
Fix ccache caching (#690)
* Build all stack build on push on master to save ccache * Set CCACHE_MSVC * Follow official ccache documentation * Revert "Follow official ccache documentation" This reverts commit ac66d2b. * Use a different wrapper * Fix slashes in script
1 parent 0d4d682 commit 2cdc1e2

4 files changed

Lines changed: 23 additions & 8 deletions

File tree

.github/workflows/debian-stack-build.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Debian Stack Build
22
on:
33
workflow_dispatch:
4-
pull_request:
4+
pull_request: &event
55
branches:
66
- master
77
paths:
@@ -11,6 +11,7 @@ on:
1111
- 'ros_controls.jazzy.repos'
1212
- 'ros_controls.kilted.repos'
1313
- 'ros_controls.rolling.repos'
14+
push: *event
1415
schedule:
1516
# Run every day to detect flakiness and broken dependencies
1617
- cron: '33 2 * * MON-FRI'

.github/workflows/reusable-ros-tooling-win-build.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ jobs:
8989
tooling_repo_path: src/ros-controls/ros2_control_ci
9090
CCACHE_DIR: ${{ github.workspace }}/${{ inputs.ccache_dir }}
9191
CACHE_PREFIX: win-${{ inputs.ros_distro }}-${{ inputs.target_workspace }}-${{ github.job }}
92+
CCACHE_MSVC: "1"
9293
steps:
9394
- name: Checkout default ref when build is not scheduled
9495
if: ${{ github.event_name != 'schedule' }}
@@ -201,7 +202,13 @@ jobs:
201202
call pixi shell-hook -s cmd > pixi_env.bat
202203
call pixi_env.bat >nul 2>&1
203204
204-
mkdir -p ${{ env.CCACHE_DIR }}
205+
if not exist "${{ env.CCACHE_DIR }}" mkdir "${{ env.CCACHE_DIR }}"
206+
set "CCACHE_WRAPPER=%RUNNER_TEMP:\=/%/cl_wrapper.bat"
207+
> "%CCACHE_WRAPPER%" echo @echo off
208+
>> "%CCACHE_WRAPPER%" echo ccache cl.exe %%*
209+
210+
echo CCACHE wrapper created at: %CCACHE_WRAPPER%
211+
type "%CCACHE_WRAPPER%"
205212
ccache --show-config
206213
ccache --zero-stats
207214
@@ -298,6 +305,7 @@ jobs:
298305
call pixi shell-hook -s cmd > pixi_env.bat
299306
call pixi_env.bat >nul 2>&1
300307
308+
set "CCACHE_WRAPPER=%RUNNER_TEMP:\=/%/cl_wrapper.bat"
301309
call ${{ env.ros_underlay_path }}\ros2_${{ inputs.ros_distro }}\ros2-windows\setup.bat
302310
pushd ${{ env.upstream_workspace }}
303311
@@ -314,13 +322,13 @@ jobs:
314322
)
315323
316324
if not "${{ inputs.ninja_packages }}"=="" (
317-
colcon build --packages-up-to ${{ inputs.ninja_packages }} --cmake-args -G Ninja --event-handler console_cohesion+ --merge-install
325+
colcon build --packages-up-to ${{ inputs.ninja_packages }} --cmake-args -G Ninja -DCMAKE_C_COMPILER="%CCACHE_WRAPPER%" -DCMAKE_CXX_COMPILER="%CCACHE_WRAPPER%" --event-handler console_cohesion+ --merge-install
318326
set skip_arg=%skip_arg% ${{ inputs.ninja_packages }}
319327
)
320328
321329
REM skip pinocchio, which take an eternity to build. build with different cmake args, see below
322330
colcon build --packages-skip pinocchio %skip_arg% %skip_regex_arg% --event-handler console_cohesion+ ^
323-
--cmake-args -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache ${{ inputs.upstream_cmake_args }} ^
331+
--cmake-args -DCMAKE_C_COMPILER="%CCACHE_WRAPPER%" -DCMAKE_CXX_COMPILER="%CCACHE_WRAPPER%" ${{ inputs.upstream_cmake_args }} ^
324332
--merge-install
325333
326334
REM Check if 'pinocchio' is in the list of packages, and build it
@@ -334,7 +342,7 @@ jobs:
334342
--cmake-args --no-warn-unused-cli ^
335343
-DBUILD_EXAMPLES=OFF -DBUILD_PYTHON_INTERFACE=OFF -DBUILD_WITH_HPP_FCL_SUPPORT=OFF ^
336344
-DBUILD_WITH_COLLISION_SUPPORT=OFF ^
337-
-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache ^
345+
-DCMAKE_C_COMPILER="%CCACHE_WRAPPER%" -DCMAKE_CXX_COMPILER="%CCACHE_WRAPPER%" ^
338346
--packages-select pinocchio ^
339347
--merge-install
340348
)
@@ -346,6 +354,7 @@ jobs:
346354
call pixi shell-hook -s cmd > pixi_env.bat
347355
call pixi_env.bat >nul 2>&1
348356
357+
set "CCACHE_WRAPPER=%RUNNER_TEMP:\=/%/cl_wrapper.bat"
349358
call ${{ env.ros_underlay_path }}\ros2_${{ inputs.ros_distro }}\ros2-windows\setup.bat
350359
call ${{ env.upstream_workspace }}\install\setup.bat
351360
@@ -363,7 +372,7 @@ jobs:
363372
pushd ${{ env.target_workspace }}
364373
)
365374
colcon build %skip_arg% %skip_regex_arg% --event-handler console_cohesion+ ^
366-
--cmake-args -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache ${{ inputs.target_cmake_args }} ^
375+
--cmake-args -DCMAKE_C_COMPILER="%CCACHE_WRAPPER%" -DCMAKE_CXX_COMPILER="%CCACHE_WRAPPER%" ${{ inputs.target_cmake_args }} ^
367376
--merge-install
368377
369378
- name: Show ccache stats

.github/workflows/rhel-stack-build.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: RHEL Stack Build
22
on:
33
workflow_dispatch:
4-
pull_request:
4+
pull_request: &event
55
branches:
66
- master
77
paths:
@@ -11,6 +11,7 @@ on:
1111
- 'ros_controls.jazzy.repos'
1212
- 'ros_controls.kilted.repos'
1313
- 'ros_controls.rolling.repos'
14+
push: *event
1415
schedule:
1516
# Run every day to detect flakiness and broken dependencies
1617
- cron: '42 4 * * MON-FRI'

.github/workflows/windows-stack-build.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@ name: Rolling Windows Semi-Binary Build
44

55
on:
66
workflow_dispatch:
7-
pull_request:
7+
pull_request: &event
88
branches:
99
- master
1010
paths:
1111
- '.github/workflows/windows-stack-build.yml'
1212
- '.github/workflows/reusable-ros-tooling-win-build.yml'
1313
- 'ros_controls.rolling.repos'
14+
push: *event
15+
schedule:
16+
# Run every day to detect flakiness and broken dependencies
17+
- cron: '42 4 * * MON-FRI'
1418

1519
jobs:
1620
binary-windows:

0 commit comments

Comments
 (0)