-
Notifications
You must be signed in to change notification settings - Fork 337
77 lines (64 loc) · 2.53 KB
/
Copy pathci.yml
File metadata and controls
77 lines (64 loc) · 2.53 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: CI
on:
push:
branches: ["main"]
pull_request:
# Least-privilege token: this workflow only reads the repo. Arbitrary
# dependency build code runs during install, so never expose a writable
# token to it (see the supply-chain notes in pyproject.toml).
permissions:
contents: read
# Cancel superseded runs on the same ref (rapid PR pushes) instead of
# letting them pile up and post stale statuses.
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
persist-credentials: false
- uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
version: "0.10.2"
enable-cache: true
# `uv sync --locked` installs the exact uv.lock resolution (direct AND
# transitive deps) and fails if the lock is stale — a bare `pip install`
# would ignore the lockfile and let transitive versions float, defeating
# the repo's exact-pin supply-chain policy. Run `uv lock` and commit the
# lockfile whenever pyproject dependencies change.
#
# `--extra api` is required: the REST tests (tests/test_api*.py) import
# fastapi/uvicorn, which live in the `api` extra — without it pytest fails
# at collection with ModuleNotFoundError: fastapi.
- name: Install (locked)
run: uv sync --locked --extra dev --extra api --python 3.12
# --no-sync: don't let `uv run` re-sync without the dev extra and
# uninstall the tools it is about to run.
- name: Ruff lint
run: uv run --no-sync ruff check .
- name: Ruff format check
run: uv run --no-sync ruff format --check .
- name: Mypy
run: uv run --no-sync mypy openkb
- name: Pytest
run: uv run --no-sync pytest
# Build the Workbench SPA so a broken frontend (vite/config error, stale
# package-lock, JS error) is caught here at PR time rather than only in
# publish.yml after a release tag is pushed. Mirrors the release build step.
web:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
persist-credentials: false
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: "20"
- name: Build Workbench web bundle
working-directory: frontend
run: |
npm ci
npm run build