Files
harfbuzz/.github/workflows/configs-build.yml
Behdad Esfahbod 4fd912a3c8 [ci] Avoid saving unchanged compiler-cache snapshots
Restore compiler caches through a shared setup action and save them
explicitly only when compilation reports cache misses. Keep existing
restore prefixes and make cache-save failures nonfatal. Before saving
ccache, prune entries that were not used during the job.

This avoids duplicate snapshots on fully cached runs and removes
unrelated restored objects from changed snapshots. Key the MSVC
installed prefix by its dependency build inputs rather than unrelated
workflow edits; dependency options remain in the hashed helper project.

Validation: actual ccache 4.9.1 cold/warm and pruning checks; sccache
statistics and failure-path checks; nine workflow setup/save pairs;
actionlint, git diff --check, and meson test -C build
(302 passed, one skipped). Remote uploads remain for CI.

Assisted-by: OpenAI Codex
2026-11-11 19:48:07 -06:00

77 lines
2.4 KiB
YAML

name: configs
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Ccache
id: compiler-cache
uses: ./.github/actions/compiler-cache
with:
key: ${{ github.workflow }}-${{ runner.os }}-${{ runner.arch }}
- name: Create main.cc
run: |
cat <<EOF > main.cc
#include "src/harfbuzz.cc"
int main() { return 0; }
EOF
cat <<EOF > subset.cc
#include "src/harfbuzz-subset.cc"
EOF
- name: install dependencies
run: sudo apt-get install gcc
- name: Build configurations
env:
# Ragel #line directives name pseudo-files; use real include dependencies.
CCACHE_DEPEND: 1
run: |
build_config() {
local config=$1 status=0
echo "Build with $config"
ccache g++ -std=c++11 -MD -c main.cc -D"$config" -o "main-$config.o" &&
g++ "main-$config.o" -o "main-$config" || status=1
echo "Build subset library with $config"
ccache g++ -std=c++11 -MD -c subset.cc -D"$config" -o "subset-$config.o" || status=1
return "$status"
}
configs=(HB_DISABLE_DEPRECATED HB_MINI HB_LEAN HB_TINY HB_NO_DRAW HB_NO_PAINT)
status=0
for ((i=0; i<${#configs[@]}; i+=2)); do
pids=()
for config in "${configs[@]:i:2}"; do
build_config "$config" > "$config.log" 2>&1 &
pids+=("$!")
done
for ((j=0; j<${#pids[@]}; j++)); do
wait "${pids[j]}" || status=1
config=${configs[i+j]}
echo "::group::Build with $config"
cat "$config.log"
echo "::endgroup::"
done
done
exit "$status"
- name: Save Compiler Cache
if: ${{ !cancelled() && steps.compiler-cache.outcome == 'success' }}
uses: ./.github/actions/save-compiler-cache
with:
key: ${{ steps.compiler-cache.outputs.key }}
variant: ${{ steps.compiler-cache.outputs.variant }}
start: ${{ steps.compiler-cache.outputs.start }}