Repository navigation
55 lines (50 loc) · 2.58 KB
/
Copy pathchecks.yml
File metadata and controls
55 lines (50 loc) · 2.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Checks every pull request and every push to main: ruff's lint (the order of imports with it), mypy's types, and the tests that
# load no weights and touch no network (the ones that need the models, Docker's images, a vLLM server or pi skip).
# mypy and the tests import the whole app, so the job first installs every package uv.lock pins, torch among them.
# A second job builds How it works with pygments alone, as pages.yml does after the merge.
name: Checks
# A push to a pull request's branch is checked once, as the pull request: on a push to any branch as well, both ran,
# neither cancelled the other (their concurrency groups differ by the event), and torch was installed twice.
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
concurrency:
group: checks-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@v10.3.0
with:
version-file: pyproject.toml # its required-version: no uv older than the fix for the revoked emSign certificates
- id: sync
run: uv sync --locked
# Each runs even when the one before failed, so that one push reports all three.
- run: uv run ruff check
- if: ${{ !cancelled() && steps.sync.outcome == 'success' }}
run: uv run mypy
- if: ${{ !cancelled() && steps.sync.outcome == 'success' }}
run: uv run pytest
# What pages.yml runs before it publishes How it works, word for word: keep the two the same. The job above has
# every package installed, so it would not notice docs/guide/guide.py, app/render.py, agent/i18n.py, agent/model_families/
# or a package's __init__.py importing torch, transformers, streamlit or httpx; only the Pages build on main would.
# --isolated keeps uv from reusing a .venv that already has pygments, and with it the whole app: there is none in a
# fresh checkout, but there is in a checkout where these are run by hand.
guide:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@v10.3.0
with:
version-file: pyproject.toml # its required-version: no uv older than the fix for the revoked emSign certificates
- run: uv run --isolated --no-project --with pygments --with pytest pytest tests/test_guide.py
# Runs even when the tests failed, so that one push reports both.
- if: ${{ !cancelled() }}
run: uv run --isolated --no-project --with pygments python -m docs.guide _site