Test Models #5
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
| name: Test Models | |
| on: | |
| workflow_dispatch: # Allows manual triggering of the workflow | |
| schedule: # Schedules the workflow to run weekly | |
| - cron: '0 0 * * 0' # Runs every Sunday at midnight UTC | |
| push: | |
| paths: | |
| - '.github/workflows/test_models.yml' | |
| - 'src/lazyslide/models/**' | |
| - 'tests/models/**' | |
| jobs: | |
| Test: | |
| runs-on: linux-cpu8-300g # Use a runner with enough disk space | |
| steps: | |
| - name: Get User Permission | |
| id: checkAccess | |
| uses: actions-cool/check-user-permission@v2 | |
| with: | |
| require: write | |
| username: ${{ github.triggering_actor }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Check User Permission | |
| if: steps.checkAccess.outputs.require-result == 'false' | |
| run: | | |
| echo "${{ github.triggering_actor }} does not have permissions on this repo." | |
| echo "Current permission level is ${{ steps.checkAccess.outputs.user-permission }}" | |
| echo "Job originally triggered by ${{ github.actor }}" | |
| exit 1 | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} # This is dangerous without human review | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| python-version: 3.12 | |
| enable-cache: true | |
| cache-dependency-glob: "uv.lock" | |
| - name: Install project | |
| run: uv sync --dev --group model | |
| - name: Login to Hugging Face | |
| run: | | |
| uv run hf auth login --token ${{ secrets.HF_TOKEN }} | |
| - name: Tests # TODO: Add tests for models | |
| run: | | |
| uv run pytest tests/models -n auto --maxfail=1 --dist=loadfile --cov=src/lazyslide/models --cov-report=xml --cov-report=html | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} |