Spaces:
Running
Running
| name: Tests | |
| on: | |
| push: | |
| pull_request: | |
| permissions: | |
| contents: read | |
| actions: write | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| tests: | |
| name: pytest (py${{ matrix.python-version }}) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.12"] | |
| env: | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| HF_HUB_ETAG_TIMEOUT: "120" | |
| HF_HUB_DOWNLOAD_TIMEOUT: "120" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - uses: astral-sh/setup-uv@v5 | |
| - name: Set HF_HOME | |
| shell: bash | |
| run: | | |
| echo "HF_HOME=${RUNNER_TEMP}/.hf" >> "$GITHUB_ENV" | |
| mkdir -p "${RUNNER_TEMP}/.hf" | |
| - name: Cache Hugging Face hub | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ runner.temp }}/.hf | |
| key: hf-${{ runner.os }}-${{ hashFiles('uv.lock', 'pyproject.toml') }} | |
| restore-keys: hf-${{ runner.os }}- | |
| # test-only .env file | |
| - name: Create test .env | |
| run: | | |
| printf "OPENAI_API_KEY=test-dummy\n" > .env | |
| - name: Install (locked) | |
| run: | | |
| uv sync --frozen --group dev --extra all_vision | |
| # Prefetch HF dataset to avoid download during test collection | |
| - name: Prefetch HF dataset | |
| run: | | |
| .venv/bin/python - <<'PY' | |
| from huggingface_hub import snapshot_download | |
| snapshot_download( | |
| repo_id="pollen-robotics/reachy-mini-emotions-library", | |
| repo_type="dataset", | |
| etag_timeout=120, | |
| max_workers=4, | |
| ) | |
| PY | |
| - name: Run tests | |
| run: .venv/bin/pytest -q | |