Cockatrice/.github/workflows/ccache-probe.yml
Lukas Brübach 2b515d0866 [CI] Create the per-measurement cache directories before mounting them
--mount type=bind refuses a missing source, and docker.sh only creates its
default cache directory, so both probe builds died at the mount.
2026-11-04 12:32:26 +01:00

103 lines
3.8 KiB
YAML

---
# Throwaway diagnostic: why does master's ccache serve only ~14% of calls when a
# whole pull-request cache is restored?
#
# Result so far (run 41818008344): one Arch configuration costs 1.2 GB with the
# default flags, and a cache bigger than that serves 1058 of 1059 calls. The 700M
# bound therefore cannot hold one build, and a cache just under the working set
# evicts exactly what the next build asks for.
#
# This run measures the only lever that can make one configuration fit a bound:
# less debug info. Every leg's objects carry full DWARF (Debug uses -ggdb, and
# CrashReporting adds -g to Release whenever the SDK is on), and debug info
# dominates the compressed object.
#
# Two jobs, two cold builds each, no Actions cache, so the repository quota is
# untouched:
# -g0 no debug info at all: the lower bound of what a cache could cost
# -g1 file and line only: what a backtrace needs, and the candidate default
# `du` of each cache dir is the number to compare against 1.2 GB.
name: ccache probe
on:
push:
branches:
- ci/ccache-probe
pull_request:
branches:
- master
concurrency:
group: ${{ github.workflow }} @ ${{ github.ref_name }}
cancel-in-progress: true
jobs:
probe:
name: ${{ matrix.label }} debug info
runs-on: ubuntu-latest
timeout-minutes: 150
strategy:
fail-fast: false
matrix:
include:
# The debug leg: -ggdb on every object.
- label: Arch
name: Arch
leg: --server --debug --test --cmake-generator Ninja
run_env: ''
# The release leg that packages: CrashReporting adds -g on top of -O2.
- label: Debian 13
name: Debian13
leg: --server --release --test --cmake-generator Ninja
run_env: '-e WITH_CRASH_REPORTING=ON'
env:
NAME: ${{ matrix.name }}
CACHE: ${{ github.workspace }}/.cache/${{ matrix.name }}
# Far above any candidate working set: a cache that evicts cannot be measured.
CCACHE_BOUND: 6G
steps:
- name: "Checkout"
uses: actions/checkout@v7
- name: "Build image and record the compiler's identity"
shell: bash
run: |
source .ci/docker.sh --build
docker image inspect --format 'image id: {{.Id}}' "$IMAGE_NAME"
echo "=== compiler as ccache sees it (compiler_check = mtime hashes mtime and size)"
docker run --rm "$IMAGE_NAME" bash -c 'for c in c++ cc gcc g++; do p="$(command -v $c)"; [ -n "$p" ] && stat -c "%n size=%s mtime=%Y" "$p"; done; c++ --version | head -1'
- name: "Cold build with -g0"
shell: bash
run: |
rm -rf build
source .ci/docker.sh
export RUN_ARGS="$RUN_ARGS ${{ matrix.run_env }}"
# One cache directory per measurement: a shared one would mix the two results.
export CCACHE_DIR="$CACHE/.ccache-g0"
# --mount type=bind refuses a source that does not exist, and docker.sh only
# creates its default cache directory.
mkdir -p "$CCACHE_DIR"
export RUN_ARGS="$RUN_ARGS -e PROBE_CMAKE_ARGS=-DCOCKATRICE_DEBUG_INFO_LEVEL=0"
RUN ${{ matrix.leg }} --ccache "$CCACHE_BOUND"
echo "=== cache for -g0"
du -sh "$CCACHE_DIR"
- name: "Cold build with -g1"
shell: bash
run: |
rm -rf build
source .ci/docker.sh
export RUN_ARGS="$RUN_ARGS ${{ matrix.run_env }}"
export CCACHE_DIR="$CACHE/.ccache-g1"
mkdir -p "$CCACHE_DIR"
export RUN_ARGS="$RUN_ARGS -e PROBE_CMAKE_ARGS=-DCOCKATRICE_DEBUG_INFO_LEVEL=1"
RUN ${{ matrix.leg }} --ccache "$CCACHE_BOUND"
echo "=== cache for -g1"
du -sh "$CCACHE_DIR"
- name: "Both measurements"
shell: bash
run: |
du -sh "$CACHE"/.ccache-* | sed 's/^/ /'