-
Notifications
You must be signed in to change notification settings - Fork 75
185 lines (159 loc) Β· 4.81 KB
/
Copy pathdocs.yml
File metadata and controls
185 lines (159 loc) Β· 4.81 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
name: Documentation
on:
push:
branches:
- main
pull_request: {}
workflow_dispatch: {}
release:
types:
- published
concurrency:
group: doc-${{github.ref}}
cancel-in-progress: true
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
name: Build documentation
runs-on: ubuntu-latest
steps:
- name: "π Checkout"
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: πΆοΈ Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: "3.14"
activate-environment: true
- name: π¦ Set up Python dependencies
run: |
uv sync --only-group doc
- id: docs
name: "π Build documentation site"
run: |
sphinx-build docs build/doc
- name: "π€ Package documentation site"
uses: actions/upload-artifact@v4
with:
name: lenskit-docs
path: build/doc
publish:
name: Archive documentation
runs-on: ubuntu-latest
needs:
- build
if: github.event_name == 'push' || (github.event_name == 'release' && !github.event.release.prerelease)
environment: docs
steps:
- name: "π Checkout"
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Check out doc site
uses: actions/checkout@v4
if: github.event_name != 'release'
with:
repository: lenskit/lenskit-docs
ssh-key: "${{ secrets.DOC_DEPLOY_KEY }}"
path: doc-site
ref: version/latest
- name: Check out doc site (stable)
uses: actions/checkout@v4
if: github.event_name == 'release'
with:
repository: lenskit/lenskit-docs
ssh-key: "${{ secrets.DOC_DEPLOY_KEY }}"
path: doc-site
ref: version/stable
- name: "π₯ Fetch documentation package"
uses: actions/download-artifact@v4
with:
name: lenskit-docs
path: build/doc
- name: "π» Copy documentation content"
run: |
rsync -avc --delete --exclude=.git/ --exclude=.buildinfo --exclude=.doctrees build/doc/ doc-site/
- name: "π§³ Commit updated documentation content"
run: |
cd doc-site
git config user.name 'LensKit Doc Bot'
git config user.email 'docbot@lenskit.org'
git add .
if git status --porcelain |grep '^.'; then
git commit -m 'rebuild documentation'
git push
else
echo "no changes to documentation"
fi
- name: "π·οΈ Tag release documentation"
if: github.event_name == 'release'
run: |
cd doc-site
ver=$(echo ${{github.event.release.tag_name}} | sed -e 's/^v//')
git checkout -b version/$ver
git push origin version/$ver
- name: "π§πΌβπ€ Activate documentation publication"
uses: actions/script@v7
with:
github-token: "${{ secrets.DOC_TOKEN }}"
script: |
github.rest.actions.createWorkflowDispatch({
owner: 'lenskit',
repo: 'lenskit-docs',
workflow_id: 'publish.yml',
ref: 'main',
})
test:
name: Run documentation tests
runs-on: ubuntu-latest
steps:
- name: π Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: πΆοΈ Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: "3.12.5"
activate-environment: true
- name: π¦ Set up Python dependencies (Unix)
if: runner.os != 'Windows'
run: |
uv sync --all-extras --no-default-groups --group test --group doc --group demo
- name: Cache ML data
uses: actions/cache@v4
with:
path: |
data
!data/*.zip
key: test-doc-mldata
- name: Download ML data
run: |
coverage run --source=src/lenskit -m lenskit data fetch -D data --movielens ml-100k ml-1m ml-10m ml-20m
- name: π Validate code examples
run: |
sphinx-build -b doctest docs build/doc
- name: π Validate example notebooks
run: |
pytest --cov=src/lenskit --nbval-lax --log-file test-notebooks.log docs
- name: π Coverage results
if: ${{ !cancelled() }}
run: |
coverage xml
coverage report
cp .coverage coverage.db
- name: π€ Upload test results
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: test-examples
path: |
test*.log
coverage.db
coverage.xml
- name: π€ Upload coverage to CodeCov
uses: codecov/codecov-action@v7.0.0