Skip to content

Commit ecf0899

Browse files
committed
add CI tests as GitHub actions
1 parent 31d2234 commit ecf0899

4 files changed

Lines changed: 97 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Run lint, format-check, and tests on every push to main and on every PR.
2+
#
3+
# Local equivalent: `scripts/check.sh` (which expects a local .venv;
4+
# this workflow uses the runner's python directly so it doesn't depend
5+
# on that layout).
6+
7+
name: ci
8+
9+
on:
10+
push:
11+
branches: [main]
12+
pull_request:
13+
branches: [main]
14+
workflow_dispatch:
15+
16+
# Force JavaScript-based actions to use Node 24 — same reason as
17+
# docs.yml: GitHub deprecated Node 20 actions in late 2025 and removes
18+
# Node 20 from runners on 2026-09-16.
19+
env:
20+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
21+
22+
permissions:
23+
contents: read
24+
25+
# Cancel in-flight runs on the same ref when a new commit lands; PRs
26+
# rebased many times in quick succession don't queue up wasted minutes.
27+
concurrency:
28+
group: ci-${{ github.workflow }}-${{ github.ref }}
29+
cancel-in-progress: true
30+
31+
jobs:
32+
test:
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/checkout@v4
36+
37+
- uses: actions/setup-python@v5
38+
with:
39+
python-version: "3.13"
40+
41+
- name: Install package + dev extras
42+
run: |
43+
python -m pip install --upgrade pip
44+
pip install -e ".[dev]"
45+
46+
- name: Fetch upstream Kikawa Auspice JSONs
47+
# Real-data tests in tests/test_real_data.py and tests/test_cli.py
48+
# skip cleanly when these files are absent. We want them to
49+
# actually run in CI, so fetch the upstream JSONs first.
50+
run: python examples/fetch_auspice_data.py
51+
52+
- name: Build Kikawa titer chart specs
53+
# tests/test_real_data.py also reads the saved Vega-Lite specs
54+
# produced by this script. Ditto for tests/test_cli.py end-to-end.
55+
run: python examples/flu-seqneut-2025to2026_titer_charts.py
56+
57+
- name: Lint (ruff)
58+
run: ruff check .
59+
60+
- name: Format check (black)
61+
run: black --check .
62+
63+
- name: Tests (pytest)
64+
run: pytest tests/

.github/workflows/docs.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# Build the docs on every push to `main` and deploy to GitHub Pages.
1+
# Build the docs on every push to `main` (then deploy to GitHub Pages)
2+
# and on every pull request targeting `main` (build only, no deploy).
3+
# The PR build catches broken mkdocstrings refs, missing images, and
4+
# unresolved cross-links *before* they land on `main` and break the
5+
# next deploy.
26
#
37
# Local equivalent: `scripts/build_docs.sh` (mkdocs build --strict).
48
# This workflow file is dormant until the repo is published with Pages
@@ -10,6 +14,8 @@ name: docs
1014
on:
1115
push:
1216
branches: [main]
17+
pull_request:
18+
branches: [main]
1319
workflow_dispatch:
1420

1521
# Opt every JavaScript-based action in this workflow into Node.js 24.
@@ -57,6 +63,11 @@ jobs:
5763
path: ./site
5864

5965
deploy:
66+
# Only deploy on push-to-main. PRs (especially from forks) lack
67+
# `pages: write` permissions and would publish PR-only content to
68+
# the live site if they did. The build job above still runs on PRs
69+
# — that's where docs regressions get caught pre-merge.
70+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
6071
needs: build
6172
runs-on: ubuntu-latest
6273
environment:

CLAUDE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@
5656
```bash
5757
scripts/check.sh
5858
```
59+
The same three checks run in CI via
60+
[`.github/workflows/ci.yml`](.github/workflows/ci.yml) on push to
61+
`main` and on PRs (CI also fetches the upstream Kikawa Auspice JSONs
62+
so real-data tests run rather than skip). Local green ≈ CI green.
5963
- **Build docs alongside checks** when changing public API surface:
6064
```bash
6165
scripts/build_docs.sh

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,23 @@ Then open `site/examples.html` in a browser and, for each example:
5959
If something visibly regresses, fix it before pushing — there's no
6060
CI gate that will catch a visual regression for you.
6161

62+
### Continuous integration
63+
64+
[`.github/workflows/ci.yml`](.github/workflows/ci.yml) runs on every
65+
push to `main` and every pull request: it installs the package, fetches
66+
the upstream Kikawa Auspice JSONs (so the real-data tests actually
67+
exercise rather than skip), builds the Kikawa titer chart specs, and
68+
runs `ruff check`, `black --check`, and `pytest tests/`. This mirrors
69+
[`scripts/check.sh`](scripts/check.sh) — green locally should mean
70+
green in CI.
71+
72+
A separate workflow,
73+
[`.github/workflows/docs.yml`](.github/workflows/docs.yml), builds the
74+
docs site on every push to `main` and every PR (catching broken
75+
mkdocstrings refs / missing images / unresolved cross-links before
76+
merge), and additionally deploys `site/` to GitHub Pages on push to
77+
`main`.
78+
6279
### Documentation
6380
The docs are at
6481
[https://jbloomlab.github.io/tree-annotated-plot/](https://jbloomlab.github.io/tree-annotated-plot/).

0 commit comments

Comments
 (0)