-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (67 loc) · 2.6 KB
/
Copy pathpython-tests.yaml
File metadata and controls
77 lines (67 loc) · 2.6 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: Python Tests
# The score computation's own suite, run on its own rather than through the block.
# `computation-test-suite`: the arithmetic is where a wrong number comes from, and a
# block-level assertion cannot see one. This lane needs no backend, no registry and no
# upstream pipeline, so it stays fast and fails for one reason only.
on:
merge_group:
pull_request:
types: [opened, reopened, synchronize]
branches:
- 'main'
push:
branches:
- 'main'
workflow_dispatch: {}
jobs:
pytest:
runs-on: ubuntu-latest
defaults:
run:
working-directory: software
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
with:
version: "0.11.16"
enable-cache: true
cache-dependency-glob: software/pyproject.toml
- name: Install dependencies
run: uv sync
- name: Run pytest
run: uv run pytest
requirements-sync:
# src/requirements.txt is generated from pyproject.toml (the single source of truth)
# and is what the package builder installs from. This job fails if the committed file
# has drifted — e.g. someone changed a dependency and forgot to regenerate. Fix
# locally with `pnpm deps:export` (see software/package.json).
#
# It matters more here than it looks: requirements.txt is a *selector* over the wheels
# the runenv already ships, installed with --no-index. A drifted pin does not fall back
# to PyPI — it fails the offline install at block build time.
runs-on: ubuntu-latest
defaults:
run:
working-directory: software
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
with:
version: "0.11.16"
enable-cache: true
cache-dependency-glob: software/pyproject.toml
- name: Regenerate requirements.txt from pyproject.toml
# The same script `pnpm deps:export` runs locally — single source of truth.
run: bash scripts/deps-export.sh
- name: Verify requirements.txt is in sync with pyproject.toml
run: |
if ! git diff --exit-code -- src/requirements.txt; then
echo ""
echo "::error::src/requirements.txt is out of sync with pyproject.toml"
echo "Dependencies are defined in software/pyproject.toml; src/requirements.txt is generated."
echo "Resolve locally with:"
echo " cd software && pnpm deps:export"
echo "then commit the updated src/requirements.txt."
exit 1
fi
echo "src/requirements.txt is in sync with pyproject.toml."