From a4b722d40018de29b7b7a4de07421b1478b5d83b Mon Sep 17 00:00:00 2001 From: Ramon Roche Date: Sat, 26 Sep 2026 14:27:05 -0700 Subject: [PATCH] ci(packaging): seed the container build caches from main (#28859) * ci(packaging): seed the container build caches from main The workflow only ran on pull requests, tags and manual dispatch, so nothing ever saved a cache under main. Pull requests can only read their own ref and main, so every first run on a PR built all images cold (30 min vs 13 min warm). Running on main and weekly gives PRs a cache to fall back to; the weekly run also keeps it inside the runner cache's 10-day expiry. The ROS ccache fallback also skipped the image name, so sih and gazebo could restore each other's cache. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Ramon Roche * ci(packaging): clarify why main is rebuilt weekly Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Ramon Roche --------- Signed-off-by: Ramon Roche --- .github/workflows/build_deb_package.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_deb_package.yml b/.github/workflows/build_deb_package.yml index 8f451a6caf7..2055aa19cf1 100644 --- a/.github/workflows/build_deb_package.yml +++ b/.github/workflows/build_deb_package.yml @@ -2,9 +2,9 @@ name: SITL Packages and Containers on: push: + branches: [main] tags: ['v*'] - pull_request: - paths: + paths: &container_paths - 'cmake/package.cmake' - 'platforms/posix/CMakeLists.txt' - 'Tools/packaging/**' @@ -14,6 +14,12 @@ on: - 'boards/px4/sitl/sih.px4board' - '.github/workflows/build_deb_package.yml' - '.github/actions/build-deb/**' + pull_request: + paths: *container_paths + schedule: + # RunsOn deletes cache files 10 days after they are saved, even if still + # in use. Rebuild main weekly so pull requests always have a cache to reuse. + - cron: '0 6 * * 1' workflow_dispatch: inputs: deploy_containers: @@ -176,7 +182,9 @@ jobs: with: path: ros-ccache key: ros-ccache-${{ matrix.arch }}-${{ matrix.image }}-${{ github.sha }} - restore-keys: ros-ccache-${{ matrix.arch }}- + restore-keys: | + ros-ccache-${{ matrix.arch }}-${{ matrix.image }}- + ros-ccache-${{ matrix.arch }}- - name: Reuse compiler cache across image layers uses: reproducible-containers/buildkit-cache-dance@v3