Skip to content

Commit 992cc2c

Browse files
beveradbclaude
andauthored
ci: use persistent local model cache on self-hosted runners (#266)
* ci: use persistent local model cache instead of actions/cache Self-hosted runners are persistent VMs, so there's no need to use actions/cache to transfer ~2GB of model files via GitHub's cache service on every CI run. Instead, point AUDIO_SEPARATOR_MODEL_DIR to /opt/audio-separator-models/ where models are pre-downloaded by the runner startup script and persist across job runs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: clean up duplicate import and sort imports in integration test Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 12f8fc6 commit 992cc2c

2 files changed

Lines changed: 14 additions & 18 deletions

File tree

.github/workflows/run-integration-tests.yaml

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ jobs:
2525
if: needs.changes.outputs.should_run == 'true'
2626
runs-on: self-hosted
2727
env:
28-
AUDIO_SEPARATOR_MODEL_DIR: ${{ github.workspace }}/models
28+
# Use persistent local directory on self-hosted runners instead of actions/cache.
29+
# Models are pre-downloaded to this path by the runner startup script, so there's
30+
# no need to download ~2GB of models on every CI run.
31+
AUDIO_SEPARATOR_MODEL_DIR: /opt/audio-separator-models
2932

3033
steps:
3134
- name: Checkout project
@@ -56,25 +59,18 @@ jobs:
5659
python-version: '3.13'
5760
cache: poetry
5861

59-
- name: Create models directory
60-
run: mkdir -p $AUDIO_SEPARATOR_MODEL_DIR
61-
62-
- name: Cache models directory
63-
uses: actions/cache@v3
64-
id: model-cache
65-
with:
66-
path: ${{ env.AUDIO_SEPARATOR_MODEL_DIR }}
67-
key: model-cache-${{ hashFiles('tests/integration/test_cli_integration.py') }}
68-
restore-keys: model-cache-
69-
7062
- name: Install Poetry dependencies
7163
run: poetry install -E cpu
7264

73-
- name: Display model cache status
65+
- name: Verify pre-cached models
7466
run: |
75-
echo "Model cache hit: ${{ steps.model-cache.outputs.cache-hit == 'true' }}"
7667
echo "Models directory contents:"
77-
ls -la $AUDIO_SEPARATOR_MODEL_DIR || echo "Directory empty or doesn't exist"
68+
ls -lh $AUDIO_SEPARATOR_MODEL_DIR
69+
MODEL_COUNT=$(ls -1 $AUDIO_SEPARATOR_MODEL_DIR | wc -l)
70+
echo "Total files: $MODEL_COUNT"
71+
if [ "$MODEL_COUNT" -lt 10 ]; then
72+
echo "::warning::Expected at least 10 pre-cached model files, found $MODEL_COUNT"
73+
fi
7874
7975
- name: Run integration tests
8076
run: poetry run pytest -sv --cov=audio_separator --cov-report=xml tests/integration

tests/integration/test_cli_integration.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import os
22
import subprocess
3-
import pytest
4-
from pathlib import Path
53
import sys
6-
import os
4+
from pathlib import Path
5+
6+
import pytest
77
sys.path.append(os.path.dirname(os.path.dirname(__file__)))
88
from utils import generate_reference_images, compare_images
99

0 commit comments

Comments
 (0)