-
Notifications
You must be signed in to change notification settings - Fork 0
136 lines (129 loc) · 5.61 KB
/
Copy pathdocs.yml
File metadata and controls
136 lines (129 loc) · 5.61 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: docs
on:
pull_request:
push:
branches: [main]
# Nightly schedule temporarily disabled. Verified green via workflow_dispatch on 2026-07-30
# (run 30549210747). Re-enable by uncommenting when the nightly execution should resume.
# schedule:
# # Nightly, 03:17 UTC. Off-peak minute to avoid the top-of-hour runner crush.
# - cron: "17 3 * * *"
workflow_dispatch: {}
concurrency:
group: docs-${{ github.ref }}
cancel-in-progress: true
jobs:
validate:
# Cheap and catches most mistakes, so it runs first and gates the build. Matches pykale's own
# support window: Python 3.10, 3.11 and 3.12.
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
- run: pip install "pydantic>=2.9" pyyaml jsonschema pytest
- name: Catalog, metadata, schema and thumbnails agree
run: |
python scripts/generate_schema.py --check
python scripts/validate_catalog.py
# Thumbnails are gitignored and rebuilt (see scripts/generate_thumbnails.py); a bare
# checkout has none, so generate first, then --check verifies the output is deterministic.
python scripts/generate_thumbnails.py
python scripts/generate_thumbnails.py --check
- run: python -m pytest -q
- name: Landing-page data is up to date
run: python scripts/export_landing_page.py --check --output ../landing-page/src/data/tutorials.json
continue-on-error: true # landing-page/ is a sibling repo; absent in a bare checkout
build:
# Structure-only build on PRs and main pushes: renders every tutorial from source but executes
# none, so it is fast (~2 min) and needs no runtime/dataset dependencies. Runtime breakage is
# caught separately by the nightly job below.
needs: validate
if: github.event_name != 'schedule'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip
- run: pip install -e ".[docs,dev]"
- name: Resolve PyKale's current PyPI release for the navbar version chip
# The structure-only build does not install pykale, so site_meta would fall back to "dev".
# Pass the latest PyPI version in via PYKALE_VERSION so the published site shows e.g. v0.2.0.
run: |
VER=$(curl -sf https://pypi.org/pypi/pykale/json | python -c "import sys,json; print(json.load(sys.stdin)['info']['version'])")
echo "PYKALE_VERSION=$VER" >> "$GITHUB_ENV"
echo "Navbar version chip -> $VER"
- name: Build (no execution)
run: make html-noplot
- uses: actions/upload-artifact@v4
with:
name: html
path: _build/html
retention-days: 14
# Also upload in the Pages-artifact format so the deploy job (push to main) can publish it.
- uses: actions/upload-pages-artifact@v3
with:
path: _build/html
deploy:
# Publish the built HTML to GitHub Pages (https://pykale.github.io/tutorials/). Only on pushes to
# main -- PRs build but do not deploy. Requires the repo's Pages source to be "GitHub Actions".
needs: build
if: github.event_name == 'push'
runs-on: ubuntu-latest
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from this workflow
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
# A dedicated group so a deploy is never cancelled mid-publish by a newer run.
concurrency:
group: pages
cancel-in-progress: false
steps:
- id: deployment
uses: actions/deploy-pages@v4
nightly-exec:
# The only job that actually RUNS tutorials. Without it, a narrative with a runtime bug (a wrong
# kale call, a shape mismatch) passes every PR check and only breaks after merge. Executes the
# CPU-runnable, non-draft tutorials -- the sphinx-gallery filter and list_runnable.py share one
# `is_runnable` definition, so exactly the same set installs and runs. GPU-required tutorials are
# rendered but never executed here, matching PyTorch's curated do-not-run list.
needs: validate
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
timeout-minutes: 120
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip
- run: pip install -e ".[docs,dev]"
- name: Install PyKale (the tutorials import kale at execution time)
# Only this job executes tutorials, so only it needs kale. Matches the notebook install cell
# (_shared/gallery/notebook_first_cell.py), which installs the same source on Colab.
run: pip install "git+https://github.com/pykale/pykale.git"
- name: Install runnable tutorials' extra dependencies
run: |
python scripts/list_runnable.py --requirements | while read -r req; do
echo "Installing $req"
pip install -r "$req"
done
- name: Full build (executes runnable tutorials)
run: make html
- uses: actions/upload-artifact@v4
with:
name: html-executed
path: _build/html
retention-days: 14
# No deploy step yet: the publishing target (ReadTheDocs vs GitHub Pages) is undecided.
# Add it here once that call is made.