Skip to content

Commit 7e0de4e

Browse files
committed
Add actions for notebook clearing, building docs, and running unit tests
Also clean up existing actions.
1 parent 5e88bcd commit 7e0de4e

File tree

6 files changed

+128
-15
lines changed

6 files changed

+128
-15
lines changed

.github/actions/setup/action.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: "Set up uv and python"
2+
inputs:
3+
groups:
4+
description: "uv dependency groups to install"
5+
required: false
6+
default: "dev"
7+
runs:
8+
using: "composite"
9+
steps:
10+
- uses: actions/setup-python@v5
11+
with:
12+
python-version: "3.13"
13+
14+
- uses: astral-sh/setup-uv@v7
15+
16+
- name: Sync deps
17+
shell: bash
18+
run: uv sync --group ${{ inputs.groups }} --frozen

.github/workflows/build-docs.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: CI - Build docs
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths:
7+
- "docs/**"
8+
- "**/*.py"
9+
- ".github/workflows/build-docs.yml"
10+
pull_request:
11+
paths:
12+
- "docs/**"
13+
- ".github/workflows/build-docs.yml"
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
docs:
21+
name: Build docs
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- name: Setup
27+
uses: ./.github/actions/setup
28+
29+
- name: Set up just
30+
uses: extractions/setup-just@v3
31+
32+
- name: Build docs
33+
run: just docs
34+
35+
doctest:
36+
name: Run doctests
37+
runs-on: ubuntu-latest
38+
steps:
39+
- uses: actions/checkout@v4
40+
41+
- name: Setup
42+
uses: ./.github/actions/setup
43+
with:
44+
groups: docs
45+
46+
- name: Set up just
47+
uses: extractions/setup-just@v3
48+
49+
- name: Run doctests
50+
run: just doctest

.github/workflows/ci-lint-typecheck.yml

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
name: Ruff (lint + format)
2525
runs-on: ubuntu-latest
2626
steps:
27-
- uses: actions/checkout@v4
27+
- uses: actions/checkout@v6
2828

2929
- name: Ruff check
3030
uses: astral-sh/ruff-action@v3
@@ -40,19 +40,10 @@ jobs:
4040
name: Typecheck (pyrefly)
4141
runs-on: ubuntu-latest
4242
steps:
43-
- uses: actions/checkout@v4
43+
- uses: actions/checkout@v6
4444

45-
- name: Set up Python
46-
uses: actions/setup-python@v5
47-
with:
48-
python-version: "3.13"
49-
cache: "pip"
50-
51-
- name: Install uv
52-
run: python -m pip install -U uv
53-
54-
- name: Sync typecheck deps (locked)
55-
run: uv sync --dev --frozen
45+
- name: Setup
46+
- uses: ./.github/actions/setup
5647

5748
- name: Run pyrefly
5849
run: uv run pyrefly check
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: CI - Clear notebook outputs
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths:
7+
- "**/*.ipynb"
8+
- ".github/workflows/clear-notebooks.yml"
9+
pull_request:
10+
paths:
11+
- "**/*.ipynb"
12+
- ".github/workflows/clear-notebooks.yml"
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.ref }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
nbconvert:
20+
name: Clear notebooks
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v6
24+
25+
- name: Setup
26+
uses: ./.github/actions/setup
27+
28+
- name: nbconvert
29+
run: uv run pre-commit run notebook-clear-outputs --all-files

.github/workflows/unit-tests.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Run unit tests
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths:
7+
- "**/*.py"
8+
- ".github/workflows/unit-tests.yml"
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
nbconvert:
16+
name: Run unit tests
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v6
20+
21+
- name: Setup
22+
uses: ./.github/actions/setup
23+
24+
- name: pytest
25+
run: uv run pytest

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ repos:
2222
pass_filenames: false
2323
always_run: true
2424

25-
- id: pytest-check
25+
- id: pytest
2626
name: pytest (all tests)
2727
entry: uv run pytest
2828
language: system
@@ -31,7 +31,7 @@ repos:
3131

3232
- id: notebook-clear-outputs
3333
name: reset jupyter notebook state
34-
entry: uv run jupyter nbconvert --clear-output
34+
entry: uv run jupyter nbconvert --clear-output --show-diff-on-failure
3535
files: \.ipynb$
3636
language: system
3737

0 commit comments

Comments
 (0)