Skip to content

Commit f3ec057

Browse files
authored
Add workflow to build and deploy documentation (#1347)
1 parent fc78a5b commit f3ec057

4 files changed

Lines changed: 88 additions & 3 deletions

File tree

.github/workflows/docs.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Documentation
2+
3+
on:
4+
push:
5+
6+
permissions:
7+
contents: write
8+
9+
concurrency:
10+
group: docs-${{ github.ref }}
11+
cancel-in-progress: false
12+
13+
env:
14+
FORCE_COLOR: 1
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
23+
- name: Install the latest version of uv
24+
uses: astral-sh/setup-uv@v6
25+
26+
- name: Install dependencies
27+
run: uv sync --group doc
28+
29+
- name: Install just
30+
uses: extractions/setup-just@v3
31+
32+
- name: Restore TorchIO cached data
33+
id: cache-torchio-data-restore
34+
uses: actions/cache/restore@v4
35+
with:
36+
path: ~/.cache/torchio
37+
key: ${{ runner.os }}-torchio-data
38+
39+
- name: Build docs
40+
run: just build-docs
41+
42+
- name: Save TorchIO cached data
43+
if: steps.cache-torchio-data-restore.outputs.cache-hit != 'true'
44+
id: cache-torchio-data-save
45+
uses: actions/cache@v4
46+
with:
47+
path: ~/.cache/torchio
48+
key: ${{ steps.cache-torchio-data-restore.outputs.cache-primary-key }}
49+
50+
# Uploade to smokeshow if not on main branch
51+
- name: Upload docs to smokeshow
52+
if: github.ref != 'refs/heads/main'
53+
run: |
54+
rm ./docs/build/html/_images/*.gif
55+
rm ./docs/build/html/_images/*.png
56+
uvx smokeshow upload ./docs/build/html
57+
58+
# Upload to GitHub Pages if on main branch
59+
- name: Upload artifacts using actions/upload-pages-artifact
60+
if: github.ref == 'refs/heads/main'
61+
id: deployment
62+
uses: actions/upload-pages-artifact@v3
63+
with:
64+
path: ./docs/build/html
65+
66+
deploy:
67+
if: github.ref == 'refs/heads/main'
68+
69+
needs: build
70+
71+
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
72+
permissions:
73+
pages: write # to deploy to Pages
74+
id-token: write # to verify the deployment originates from an appropriate source
75+
76+
runs-on: ubuntu-latest
77+
78+
# Deploy to the github-pages environment
79+
environment:
80+
name: github-pages
81+
url: ${{ steps.deployment.outputs.page_url }}
82+
83+
steps:
84+
- name: Deploy to GitHub Pages
85+
id: deployment
86+
uses: actions/deploy-pages@v4

docs/source/data/image.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ structure.
4141

4242

4343
.. autoclass:: ScalarImage
44+
:members:
4445

4546
.. autoclass:: LabelMap
4647

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ dev = [
7575
"pre-commit-uv==4.1.4",
7676
]
7777
doc = [
78+
"distinctipy==1.3.4",
7879
"einops==0.8.0",
7980
"furo==2024.8.6",
8081
"matplotlib==3.9.4",

src/torchio/transforms/preprocessing/spatial/to_canonical.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,3 @@ class ToCanonical(ToOrientation):
2222
2323
.. _NiBabel docs about image orientation: https://nipy.org/nibabel/image_orientation.html
2424
"""
25-
26-
def __init__(self, **kwargs):
27-
super().__init__('RAS', **kwargs)

0 commit comments

Comments
 (0)