-
Notifications
You must be signed in to change notification settings - Fork 0
342 lines (300 loc) Β· 10.8 KB
/
Copy pathdocs.yml
File metadata and controls
342 lines (300 loc) Β· 10.8 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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
name: FauxDB Documentation
# Only run manually for documentation builds
on:
workflow_dispatch:
inputs:
build_type:
description: 'Type of documentation build'
required: true
default: 'full'
type: choice
options:
- full
- quick
- api-only
deploy:
description: 'Deploy to GitHub Pages'
required: false
default: true
type: boolean
environment:
description: 'Deployment environment'
required: true
default: 'production'
type: choice
options:
- production
- preview
version:
description: 'Documentation version (leave empty for latest)'
required: false
type: string
# Allow GitHub Pages deployment
permissions:
contents: read
pages: write
id-token: write
# Ensure only one deployment runs at a time
concurrency:
group: "pages"
cancel-in-progress: false
env:
CARGO_TERM_COLOR: always
jobs:
setup:
name: Setup Documentation Environment
runs-on: ubuntu-latest
outputs:
docs-version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set documentation version
id: version
run: |
if [ -n "${{ github.event.inputs.version }}" ]; then
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
else
# Get version from Cargo.toml or git tag
if [ -f "Cargo.toml" ]; then
VERSION=$(grep '^version = ' Cargo.toml | cut -d'"' -f2)
echo "version=$VERSION" >> $GITHUB_OUTPUT
else
echo "version=latest" >> $GITHUB_OUTPUT
fi
fi
echo "π Documentation version: ${{ steps.version.outputs.version }}"
build-docs:
name: Build Documentation
runs-on: ubuntu-latest
needs: setup
if: ${{ github.event.inputs.build_type == 'full' || github.event.inputs.build_type == 'quick' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
# FIXED: Removed Node.js setup - using pure Rust/mdbook solution
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy, rust-docs
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
postgresql postgresql-contrib \
postgresql-server-dev-all \
libssl-dev \
pkg-config \
build-essential
- name: Cache Rust dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-docs-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-docs-
- name: Install documentation dependencies
run: |
# Install mdbook and related tools
cargo install mdbook mdbook-mermaid mdbook-graphviz mdbook-toc
- name: Build Rust documentation
run: |
# Build library documentation
cargo doc --no-deps --document-private-items
# Build API documentation with examples
cargo doc --package fauxdb --no-deps --document-private-items --features full
- name: Build Markdown documentation
run: |
# Build main documentation with mdbook
if [ -f "docs/book.toml" ]; then
cd docs
mdbook build
# Copy API docs to book output
cp -r ../target/doc book/html/api
fi
- name: Generate API reference
run: |
# Generate comprehensive API reference
mkdir -p docs/_site/api
# Copy rustdoc output
cp -r target/doc/* docs/_site/api/ 2>/dev/null || true
# Generate additional API documentation
echo "# FauxDB API Reference" > docs/_site/api/README.md
echo "" >> docs/_site/api/README.md
echo "This directory contains the complete API reference for FauxDB." >> docs/_site/api/README.md
echo "" >> docs/_site/api/README.md
echo "## Quick Links" >> docs/_site/api/README.md
echo "- [Main Library](fauxdb/index.html)" >> docs/_site/api/README.md
echo "- [Error Types](fauxdb/error/index.html)" >> docs/_site/api/README.md
echo "- [Configuration](fauxdb/config/index.html)" >> docs/_site/api/README.md
echo "- [Server](fauxdb/production_server/index.html)" >> docs/_site/api/README.md
- name: Generate search index
run: |
# Search index is automatically generated by mdbook
echo "Search index will be generated by mdbook automatically"
- name: Upload documentation artifacts
uses: actions/upload-artifact@v4
with:
name: documentation-build
path: |
docs/_site
target/doc
retention-days: 30
build-api-docs:
name: Build API Documentation Only
runs-on: ubuntu-latest
needs: setup
if: ${{ github.event.inputs.build_type == 'api-only' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rust-docs
- name: Cache Rust dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-api-docs-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-api-docs-
- name: Build API documentation
run: |
# Build comprehensive API documentation
cargo doc --no-deps --document-private-items --features full
# Generate API overview
mkdir -p api-docs
echo "# FauxDB API Documentation" > api-docs/README.md
echo "" >> api-docs/README.md
echo "Version: ${{ needs.setup.outputs.docs-version }}" >> api-docs/README.md
echo "Generated: $(date)" >> api-docs/README.md
echo "" >> api-docs/README.md
echo "## Quick Start" >> api-docs/README.md
echo "" >> api-docs/README.md
echo "\`\`\`rust" >> api-docs/README.md
echo "use fauxdb::{ProductionFauxDBServer, ProductionConfig};" >> api-docs/README.md
echo "" >> api-docs/README.md
echo "let config = ProductionConfig::load_from_env()?;" >> api-docs/README.md
echo "let server = ProductionFauxDBServer::new(config).await?;" >> api-docs/README.md
echo "\`\`\`" >> api-docs/README.md
- name: Upload API documentation artifacts
uses: actions/upload-artifact@v4
with:
name: api-documentation
path: |
target/doc
api-docs
retention-days: 30
deploy-preview:
name: Deploy Preview
runs-on: ubuntu-latest
needs: [setup, build-docs]
if: ${{ github.event.inputs.deploy == 'true' && github.event.inputs.environment == 'preview' }}
steps:
- name: Download documentation artifacts
uses: actions/download-artifact@v4
with:
name: documentation-build
path: ./docs-site
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload to Pages
uses: actions/upload-pages-artifact@v3
with:
path: ./docs-site
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
- name: Preview deployment notification
run: |
echo "π Documentation preview deployed!"
echo ""
echo "π Deployment Details:"
echo " Environment: Preview"
echo " Version: ${{ needs.setup.outputs.docs-version }}"
echo " Build Type: ${{ github.event.inputs.build_type }}"
echo " Deployed by: ${{ github.actor }}"
echo " Deployment URL: ${{ steps.deployment.outputs.page_url }}"
echo ""
echo "π Access your preview at: ${{ steps.deployment.outputs.page_url }}"
deploy-production:
name: Deploy to Production
runs-on: ubuntu-latest
needs: [setup, build-docs]
if: ${{ github.event.inputs.deploy == 'true' && github.event.inputs.environment == 'production' }}
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Download documentation artifacts
uses: actions/download-artifact@v4
with:
name: documentation-build
path: ./docs-site
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload to Pages
uses: actions/upload-pages-artifact@v3
with:
path: ./docs-site
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
- name: Production deployment notification
run: |
echo "π Documentation deployed to production!"
echo ""
echo "π Deployment Details:"
echo " Environment: Production"
echo " Version: ${{ needs.setup.outputs.docs-version }}"
echo " Build Type: ${{ github.event.inputs.build_type }}"
echo " Deployed by: ${{ github.actor }}"
echo " Production URL: https://pgelephant.github.io/fauxdb/"
echo ""
echo "β
Documentation is now live at: https://pgelephant.github.io/fauxdb/"
docs-summary:
name: Documentation Build Summary
runs-on: ubuntu-latest
needs: [setup, build-docs, deploy-preview, deploy-production]
if: always()
steps:
- name: Build summary
run: |
echo "π FauxDB Documentation Build Summary"
echo "======================================"
echo ""
echo "π Build Details:"
echo " Version: ${{ needs.setup.outputs.docs-version }}"
echo " Build Type: ${{ github.event.inputs.build_type }}"
echo " Environment: ${{ github.event.inputs.environment }}"
echo " Deploy: ${{ github.event.inputs.deploy }}"
echo " Triggered by: ${{ github.actor }}"
echo ""
echo "π Job Results:"
echo " Setup: ${{ needs.setup.result }}"
echo " Build Docs: ${{ needs.build-docs.result }}"
echo " Deploy Preview: ${{ needs.deploy-preview.result }}"
echo " Deploy Production: ${{ needs.deploy-production.result }}"
echo ""
if [ "${{ github.event.inputs.deploy }}" == "true" ]; then
if [ "${{ github.event.inputs.environment }}" == "production" ]; then
echo "π Production URL: https://pgelephant.github.io/fauxdb/"
else
echo "π Preview URL: Check deployment step output"
fi
else
echo "π¦ Documentation artifacts uploaded (no deployment)"
fi
echo ""
echo "β
Documentation build completed!"