Add model caching and secrets passphrase to CI workflows#560
Merged
Conversation
CI test jobs were downloading ONNX/GGUF models anonymously from the Hugging Face Hub on every run, which hits anonymous IP rate limits on shared GitHub runners (downloads denied). - Pass WORKGLOW_SECRETS_PASSPHRASE to the model-downloading vitest jobs (hft, nodellama; rag already had it) so the test preload decrypts the on-disk credential store and hydrates HF_TOKEN into process.env. transformers.js authenticates Hub downloads when HF_TOKEN is set, raising the rate limit against the account. - Cache the repo-root ./models directory (where the test cache dir is configured) per job so models are not re-fetched on every run.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR improves CI/CD efficiency and security by adding caching for Hugging Face model downloads and injecting the secrets passphrase environment variable into test workflows.
Key Changes
Model caching: Added
actions/cache@v4steps to three test jobs (RAG, HuggingFace Transformers, and LlamaCpp provider tests) to cache downloaded models in themodels/directory. Each job uses a unique cache key (hf-models-rag-,hf-models-hft-,hf-models-nodellama-) scoped by OS and keyed on sample file changes.Secrets passphrase injection: Added
WORKGLOW_SECRETS_PASSPHRASEenvironment variable (from GitHub secrets) to the HuggingFace Transformers and LlamaCpp provider test jobs, enabling decryption of encrypted credentials during test execution.Encrypted credentials: Added encrypted HuggingFace token credential file (
.secrets/credentials/26f1356ad1fd23bad72f47e1cafd32b3886e57b1701ac6fbaaf4f2aa0ba2bb8a.json) for use in tests requiring HuggingFace API access.Implementation Details
hashFiles('packages/test/src/samples/**')to invalidate when test samples changehttps://claude.ai/code/session_013CxVhBFku7dJvm7Bwucn1z