Skip to content

Commit 7ac62cd

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

File tree

6 files changed

+129
-15
lines changed

6 files changed

+129
-15
lines changed

.github/actions/setup/setup.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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: checkout@v6
11+
12+
- uses: actions/setup-python@v5
13+
with:
14+
python-version: "3.13"
15+
16+
- uses: astral-sh/setup-uv@v7
17+
18+
- name: Sync deps
19+
shell: bash
20+
run: uv sync --group ${{ inputs.groups }} --frozen

.github/workflows/build-docs.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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+
- name: Setup
25+
- uses: ./.github/actions/setup/setup.yml
26+
27+
- name: Set up just
28+
uses: extractions/setup-just@v3
29+
30+
- name: Build docs
31+
run: just docs
32+
33+
doctest:
34+
name: Run doctests
35+
runs-on: ubuntu-latest
36+
steps:
37+
- name: Setup
38+
- uses: ./.github/actions/setup/setup.yml
39+
40+
- name: Set up just
41+
uses: extractions/setup-just@v3
42+
43+
- name: Run doctests
44+
run: just doctest

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

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,8 @@ jobs:
4040
name: Typecheck (pyrefly)
4141
runs-on: ubuntu-latest
4242
steps:
43-
- uses: actions/checkout@v4
44-
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
43+
- name: Setup
44+
- uses: ./.github/actions/setup/setup.yml
5645

5746
- name: Run pyrefly
5847
run: uv run pyrefly check
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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+
- name: Setup
24+
- uses: ./.github/actions/setup/setup.yml
25+
26+
- name: nbconvert
27+
run: uv run pre-commit run notebook-clear-outputs --all-files

.github/workflows/unit-tests.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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@v4
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: "3.13"
25+
cache: "pip"
26+
27+
- name: Install uv
28+
run: python -m pip install -U uv
29+
30+
- name: uv sync
31+
run: uv sync --frozen
32+
33+
- name: pytest
34+
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)