Repository navigation
83 lines (77 loc) · 3.25 KB
/
Copy pathweb.yml
File metadata and controls
83 lines (77 loc) · 3.25 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
78
79
80
81
82
83
name: TensorFold Web
on:
push:
branches: [main]
paths: ["web/**", ".github/workflows/web.yml", "build.zig.zon"]
pull_request:
paths: ["web/**", ".github/workflows/web.yml", "build.zig.zon"]
concurrency:
# a pull request push cancels that PR's older run (18 Nov: 28 superseded runs sat queued); main pushes all run
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
# 19 Nov: a landing train's PR (lead/train-*) skips these jobs. Our local CI runs the same checks on the train's
# tip, and the hosted queue (58 runs behind ~13 jobs) held main's and contributors' checks for hours. Each
# rider's own pull request runs these jobs, and main runs them again after the train lands.
# Forks never skip these jobs.
jobs:
python:
if: ${{ !(startsWith(github.head_ref, 'lead/train-') && github.event.pull_request.head.repo.full_name == github.repository) }} # a landing train's tip: see the note above jobs
# the engine extra is not installed: TensorFold Web runs without it and the tests must too
runs-on: ubuntu-latest
defaults:
run:
working-directory: web
strategy:
matrix:
python-version: ["3.11", "3.12"]
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- run: pip install -e ".[dev]"
- run: ruff check .
- run: pytest -q
package:
if: ${{ !(startsWith(github.head_ref, 'lead/train-') && github.event.pull_request.head.repo.full_name == github.repository) }} # a landing train's tip: see the note above jobs
# what a user installs: the wheel must carry the page and the data files
runs-on: ubuntu-latest
defaults:
run:
working-directory: web
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.12"
- run: pip install build && python -m build
- run: pip install dist/*.whl
- run: |
cd / && python -c "import tensorfold_web.server as s; assert (s.UI_DIST / 'index.html').is_file(), 'no page in the wheel'; import tensorfold_web.catalog"
ui:
if: ${{ !(startsWith(github.head_ref, 'lead/train-') && github.event.pull_request.head.repo.full_name == github.repository) }} # a landing train's tip: see the note above jobs
runs-on: ubuntu-latest
defaults:
run:
working-directory: web/ui
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 22
cache: npm
cache-dependency-path: web/ui/package-lock.json
- run: npm ci
- run: npm test
- run: npm run build
# The page and stand-in version ship in the package, so both must match the sources.
- name: Generated Web files are committed
run: |
git diff --exit-code -- ../tensorfold_web/ui_dist ../tensorfold_web/data/native-version.json || {
echo "Generated Web files are stale; run npm run build in web/ui and commit"
exit 1
}
- name: No untracked built files
run: test -z "$(git status --porcelain -- ../tensorfold_web/ui_dist)"