문제: merge / browser tests job이 매 실행마다 apt-get update와 약 220MB의 Noto/Liberation 글꼴 패키지를 인터넷 미러에서 다시 받아 약 31초(최대 71초)를 쓴다. 고른 방법과 버린 대안: - scripts/lib/visual-test-fonts.ts에 이미지 sha256 digest 앞 12자와 VISUAL_TEST_FONT_PACKAGES 해시로 정확한 캐시 키를 만드는 helper를 둔다. restore-keys 없이 정확한 키만 쓴다. - scripts/generate-ci-workflow.ts가 merge_browser의 browser-install(image) 앞에 main 전용 actions/cache 저장·복원 step과 비-main 전용 actions/cache/restore 복원 step을 두고(main-push-reuse 조건 포함), scripts/ci/install-visual-test-fonts.sh에 VISUAL_TEST_FONT_PACKAGES 목록을 그대로 넘긴다. - scripts/ci/install-visual-test-fonts.sh는 캐시 폴더에 .deb가 있으면 apt-get 없이 dpkg -i로 설치하고, 비어 있으면 --download-only로 내려받은 뒤 partial·lock을 지우고 dpkg -i로 설치한다. - 버린 대안: 커스텀 Playwright 이미지 레지스트리 등록(소유자 레지스트리 설정· 토큰 필요), /var/lib/apt/lists만 캐시(220MB 다운로드 남음), 글꼴 폴더 tar 캐시(dpkg 상태 불일치). 위험·한계: - main push reuse(CI-FE-0004)가 동작하는 main push에서는 글꼴 step이 건너뛰므로 캐시는 재사용이 아닌 main push 또는 workflow_dispatch(main)에서 최초 저장된다. - runner 캐시 저장소(5GB 상한)에 약 220MB가 더해진다. - release_gate의 non-imaged playwright install --with-deps 경로는 바꾸지 않았다. 검증: - C3 RED(트리 fcc122aa91a6): ci-browser-image.test.ts rc=1 (1 failed | 3 passed) - laptop-gate check:types, lint, verify:documentation, 단위 시험 5파일(535 passed) rc=0 - scripts/verify.sh docs rc=0, scripts/verify.sh hooks rc=0 (112 tests) Refs: CI-FE-0003
45 lines
1.3 KiB
Bash
Executable File
45 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# FE-3 (2) (CI-FE-0003). Installs the visual goldens' font packages from the
|
|
# cached .deb archives in $1; on a cache miss downloads them there first with
|
|
# apt-get and drops apt's partial/lock metadata so actions/cache archives only
|
|
# the .deb files. Package names follow $1.
|
|
set -euo pipefail
|
|
|
|
dir=${1:?cache directory is required}
|
|
shift
|
|
if (($# == 0)); then
|
|
echo "install-visual-test-fonts: at least one package name is required" >&2
|
|
exit 2
|
|
fi
|
|
|
|
sudo_cmd=$(command -v sudo || true)
|
|
run_privileged() {
|
|
if [ -n "$sudo_cmd" ]; then
|
|
"$sudo_cmd" "$@"
|
|
else
|
|
"$@"
|
|
fi
|
|
}
|
|
|
|
shopt -s nullglob
|
|
debs=("$dir"/*.deb)
|
|
if ((${#debs[@]} == 0)); then
|
|
mkdir -p "$dir/partial"
|
|
run_privileged env DEBIAN_FRONTEND=noninteractive apt-get update
|
|
run_privileged env DEBIAN_FRONTEND=noninteractive apt-get install -y --download-only -o Dir::Cache::archives="$dir" "$@"
|
|
run_privileged rm -rf "$dir/partial" "$dir/lock"
|
|
debs=("$dir"/*.deb)
|
|
fi
|
|
|
|
if ((${#debs[@]} > 0)); then
|
|
run_privileged env DEBIAN_FRONTEND=noninteractive dpkg -i "${debs[@]}"
|
|
exit 0
|
|
fi
|
|
|
|
for pkg in "$@"; do
|
|
if ! dpkg-query -W -f='${Status}\n' "$pkg" 2>/dev/null | grep -qx 'install ok installed'; then
|
|
echo "install-visual-test-fonts: no .deb archive downloaded and package not installed: $pkg" >&2
|
|
exit 1
|
|
fi
|
|
done
|