Cache the pinned fpgen model archive across CI runs

Nine jobs downloaded the fpgen model from its GitHub release on every
run, so a 504 from GitHub failed pythonlib and skipped every browser
job behind it. pin-fpgen-model.py --archive keeps the downloaded archive
in a file and installs from it when it is there, checked against the
pin either way. The fpgen-model action caches that file, keyed on
fpgen-model.json, and every job installs the model through it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jake Writer
2026-11-09 23:02:24 +00:00
co-authored by Claude Opus 5.5
parent 2ac91c0dc4
commit b8db95563b
5 changed files with 90 additions and 60 deletions
+6 -1
View File
@@ -10,10 +10,12 @@ Usage:
python3 python/scripts/pin-fpgen-model.py # install if not already pinned
python3 python/scripts/pin-fpgen-model.py --check # verify only; non-zero if not pinned
python3 python/scripts/pin-fpgen-model.py --force # re-download and reinstall
python3 python/scripts/pin-fpgen-model.py --archive F # keep the archive in F, and install from F when it is there
"""
import argparse
import sys
from pathlib import Path
try:
from camoufox.fpgen_model import PIN, ensure_fpgen_model, fpgen_data_dir, is_pinned
@@ -26,6 +28,9 @@ def main():
formatter_class=argparse.RawDescriptionHelpFormatter)
ap.add_argument('--check', action='store_true', help='verify only; non-zero if not pinned')
ap.add_argument('--force', action='store_true', help='reinstall even if already pinned')
ap.add_argument('--archive', type=Path,
help='keep the downloaded archive in this file, and install from it when it is '
'there (still checked against the pin), so CI can cache it')
args = ap.parse_args()
if args.check:
@@ -36,7 +41,7 @@ def main():
file=sys.stderr)
return 1
ensure_fpgen_model(force=args.force)
ensure_fpgen_model(force=args.force, archive=args.archive)
print(f'OK: fpgen model {PIN["tag"]} pinned in {fpgen_data_dir()}', file=sys.stderr)
return 0