tenseleyflow/documentlanguagemodel / 2381a8e

Browse files

ci: add slow-tests job with HF cache keyed on tiny-model revision

Authored by espadonne
SHA
2381a8e2b88216eb6cf72c1ac7a8e92f0c801a7d
Parents
209d2a5
Tree
512a62c

1 changed file

StatusFile+-
M .github/workflows/ci.yml 45 0
.github/workflows/ci.ymlmodified
@@ -13,6 +13,8 @@ concurrency:
13
 env:
13
 env:
14
   UV_VERSION: "0.11.6"
14
   UV_VERSION: "0.11.6"
15
   PYTHON_VERSION: "3.11"
15
   PYTHON_VERSION: "3.11"
16
+  # TODO(sprint-06): replace with pinned 40-char SHA from the base-model registry.
17
+  TINY_MODEL_REVISION: "main"
16
 
18
 
17
 jobs:
19
 jobs:
18
   lint-type-test:
20
   lint-type-test:
@@ -82,3 +84,46 @@ jobs:
82
           # `doctor` and `show` will become local-only once their sprints
84
           # `doctor` and `show` will become local-only once their sprints
83
           # land (05, 13). Until then, only --help and --version are
85
           # land (05, 13). Until then, only --help and --version are
84
           # asserted here — but the job scaffolding is in place.
86
           # asserted here — but the job scaffolding is in place.
87
+
88
+  slow-tests:
89
+    # Sprint 02: marker-gated tests that touch HF. Cache-keyed on
90
+    # (pyproject.toml hash, tiny-model revision) per audit guidance.
91
+    name: slow tests (hf-cache)
92
+    runs-on: ubuntu-latest
93
+    steps:
94
+      - uses: actions/checkout@v4
95
+
96
+      - name: Install uv
97
+        uses: astral-sh/setup-uv@v4
98
+        with:
99
+          version: ${{ env.UV_VERSION }}
100
+
101
+      - name: Sync dependencies
102
+        run: uv sync --all-extras --dev
103
+
104
+      - name: Restore HF cache
105
+        id: hf-cache
106
+        uses: actions/cache@v4
107
+        with:
108
+          path: ${{ github.workspace }}/.hf-cache
109
+          key: hf-tiny-${{ env.TINY_MODEL_REVISION }}-${{ hashFiles('pyproject.toml') }}
110
+          restore-keys: |
111
+            hf-tiny-${{ env.TINY_MODEL_REVISION }}-
112
+
113
+      - name: Pre-warm tiny model
114
+        env:
115
+          HF_HOME: ${{ github.workspace }}/.hf-cache
116
+          DLM_TINY_MODEL_REVISION: ${{ env.TINY_MODEL_REVISION }}
117
+        run: |
118
+          set -euxo pipefail
119
+          echo "Cache hit: ${{ steps.hf-cache.outputs.cache-hit }}"
120
+          uv run python - <<'PY'
121
+          from tests.fixtures.tiny_model import tiny_model_path
122
+          print("tiny model at:", tiny_model_path())
123
+          PY
124
+
125
+      - name: Run slow tests
126
+        env:
127
+          HF_HOME: ${{ github.workspace }}/.hf-cache
128
+          DLM_TINY_MODEL_REVISION: ${{ env.TINY_MODEL_REVISION }}
129
+        run: uv run pytest -m "slow" -v