Add sandbox_c cmake project + ccache workflow for pool testing
Build RPi image / build (push) Successful in 10s
Sandbox - ephemeral runner + shared cache / cargo (push) Successful in 1m27s
Sandbox - cmake + ccache on the pool / build (push) Successful in 10s

This commit is contained in:
druppy committed 2026-10-24 22:54:55 +02:00
1 parent fb253f9b27
commit ba41deb9ec
9 files changed
+160

No files matched your search

+61
View File
@@ -0,0 +1,61 @@
name: Sandbox - cmake + ccache on the pool
on:
push:
branches: [ci/sandbox]
workflow_dispatch:
env:
# Inside the workspace so actions/cache can store it. The path is identical on
# every run, which matters because ccache hashes the compiler command line.
CCACHE_DIR: ${{ github.workspace }}/.ccache
jobs:
build:
runs-on: cmake
defaults:
run:
shell: bash
working-directory: sandbox_c
steps:
- uses: actions/checkout@v4
- name: Toolchain
run: |
set -euo pipefail
command -v cmake >/dev/null && command -v ccache >/dev/null && exit 0
apt-get update -qq
apt-get install -y -qq --no-install-recommends \
cmake ninja-build gcc libc6-dev ccache ca-certificates >/dev/null
cmake --version | head -1
ccache --version | head -1
# Cache the compiler cache, never build/: CMake bakes absolute paths into
# CMakeCache.txt, so a restored build tree breaks if the workspace moves.
- name: Cache ccache
uses: actions/cache@v4
with:
path: ${{ env.CCACHE_DIR }}
key: ccache-${{ hashFiles('sandbox_c/**') }}
restore-keys: ccache-
- name: ccache before build
run: ccache --show-stats | grep -E "cache (hits|misses|read)" || ccache --show-stats
- name: Configure
run: |
cmake -S . -B build -G Ninja \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_BUILD_TYPE=Release
- name: Build
run: cmake --build build --parallel
- name: Test
run: ctest --test-dir build --output-on-failure
- name: ccache after build
if: always()
run: |
ccache --show-stats
set -o pipefail
ctest --test-dir build 2>&1 | grep -E "tests passed"