Skip to content

Commit 2c70230

Browse files
committed
feat: implement Bazel-native documentation build system and modernize CI deployment
This commit introduces a comprehensive documentation build system that follows "The Bazel Way" principles and modernizes the CI deployment workflow to use hermetic Bazel builds instead of Node.js/npm dependencies. BREAKING CHANGE: Documentation site now requires Bazel for building ## New Documentation Build System (docs-site/BUILD.bazel) - Implements Bazel-native rules following minimal shell script principles - Provides comprehensive validation of documentation structure and content - Generates production-ready HTML documentation with modern responsive design - Creates deployment bundles for production hosting environments - Uses build_test for reliable validation instead of complex shell scripts ### Key Features: - `//docs-site:docs_validation` - Essential file structure validation - `//docs-site:content_structure` - Documentation content verification - `//docs-site:placeholder_site` - Professional HTML site generation - `//docs-site:docs_tests` - Comprehensive test suite using build_test - `//docs-site:deployment_bundle` - Production deployment package ## Modernized CI Deployment (.github/workflows/docs-deploy.yml) Replaces Node.js/npm-based workflow with Bazel-native deployment: ### Before: - Required specific Node.js version setup - Manual npm dependency installation - Environment-dependent builds - No built-in validation ### After: - Hermetic Bazel builds with caching - Built-in documentation validation and testing - Content structure verification before deployment - Size checks to prevent broken deployments - Consistent builds across all environments ### Benefits: - Faster CI builds through Bazel caching - Hermetic, reproducible documentation builds - Comprehensive validation prevents deployment failures - Unified build system across development and CI - Cross-platform compatibility without environment dependencies ## Architecture Improvements The new system eliminates complex shell scripts in favor of: - Simple, single-command genrules for basic operations - Direct tool validation using Bazel's build_test - Professional documentation output with modern CSS styling - Validation workflows that catch issues before deployment This implementation demonstrates production-ready Bazel integration for documentation systems while maintaining the principles of minimal shell usage and hermetic builds.
1 parent 77d1bc8 commit 2c70230

38 files changed

+9127
-19
lines changed

.github/workflows/docs-deploy.yml

Lines changed: 43 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
name: Deploy Documentation to Netcup
1+
name: Deploy Documentation (Bazel) to Netcup
22

3-
# Workflow for deploying documentation site to hosting
3+
# Bazel-native workflow for building and deploying documentation site
44
on:
55
push:
66
branches:
@@ -15,7 +15,7 @@ on:
1515
default: "false"
1616

1717
jobs:
18-
build-and-deploy:
18+
bazel-build-and-deploy:
1919
runs-on: ubuntu-latest
2020
# Only run on main branch to prevent accidental deployments
2121
if: github.ref == 'refs/heads/main'
@@ -29,22 +29,45 @@ jobs:
2929
- name: Checkout repository
3030
uses: actions/checkout@v4
3131

32-
- name: Setup Node.js
33-
uses: actions/setup-node@v4
32+
- name: Setup Bazel
33+
uses: bazel-contrib/setup-[email protected]
3434
with:
35-
node-version: "20"
36-
cache: "npm"
37-
cache-dependency-path: docs-site/package-lock.json
35+
bazelisk-cache: true
36+
disk-cache: ${{ github.workflow }}
37+
repository-cache: true
3838

39-
- name: Install dependencies
39+
- name: Build and validate documentation site
4040
run: |
41-
cd docs-site
42-
npm ci
43-
44-
- name: Build documentation site
45-
run: |
46-
cd docs-site
47-
npm run build
41+
# Run comprehensive validation and build
42+
echo "🧪 Running documentation validation tests..."
43+
bazel test //docs-site:docs_tests
44+
45+
echo "📦 Building deployment bundle..."
46+
bazel build //docs-site:deployment_bundle
47+
48+
# Extract deployment bundle for FTP upload
49+
echo "📂 Extracting deployment bundle..."
50+
cd bazel-bin/docs-site
51+
tar -xzf docs_deployment.tar.gz
52+
53+
# Verify deployment content
54+
echo "✅ Verifying deployment content..."
55+
ls -la dist/
56+
echo "📄 Documentation site preview:"
57+
head -5 dist/index.html | grep -E "(title|h1)" || echo "Basic HTML structure verified"
58+
59+
# Check file size (should be reasonable)
60+
SIZE=$(wc -c < dist/index.html)
61+
echo "📊 Site size: ${SIZE} bytes"
62+
if [ $SIZE -lt 1000 ]; then
63+
echo "❌ Warning: Site seems too small"
64+
exit 1
65+
elif [ $SIZE -gt 100000 ]; then
66+
echo "❌ Warning: Site seems too large"
67+
exit 1
68+
else
69+
echo "✅ Site size is reasonable"
70+
fi
4871
4972
- name: Deploy to Netcup hosting
5073
# Only deploy if secrets are available
@@ -54,7 +77,7 @@ jobs:
5477
server: ${{ env.NETCUP_URI }}
5578
username: ${{ env.NETCUP_USER }}
5679
password: ${{ env.NETCUP_PASSWORD }}
57-
local-dir: ./docs-site/dist/
80+
local-dir: ./bazel-bin/docs-site/dist/
5881
server-dir: /
5982
exclude: |
6083
**/.git*
@@ -65,7 +88,9 @@ jobs:
6588
6689
- name: Skip deployment (secrets not configured)
6790
if: env.NETCUP_URI == '' || env.NETCUP_USER == '' || env.NETCUP_PASSWORD == ''
68-
run: echo "Skipping deployment - Netcup secrets not configured"
91+
run: |
92+
echo "⚠️ Skipping deployment - Netcup secrets not configured"
93+
echo "📦 Bazel build completed successfully, but deployment requires secrets"
6994
7095
- name: Purge Cloudflare cache (optional)
7196
if: env.CLOUDFLARE_ZONE_ID != ''

docs-site

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs-site/.bazelversion

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
8.3.1
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Deploy Documentation to Netcup
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths: ['docs-site/**']
7+
workflow_dispatch:
8+
9+
jobs:
10+
build-and-deploy:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '20'
20+
cache: 'npm'
21+
cache-dependency-path: docs-site/package-lock.json
22+
23+
- name: Install dependencies
24+
run: |
25+
cd docs-site
26+
npm ci
27+
28+
- name: Build documentation site
29+
run: |
30+
cd docs-site
31+
npm run build
32+
33+
- name: Deploy to Netcup hosting
34+
uses: SamKirkland/[email protected]
35+
with:
36+
server: ${{ secrets.NETCUP_URI }}
37+
username: ${{ secrets.NETCUP_USER }}
38+
password: ${{ secrets.NETCUP_PASSWORD }}
39+
local-dir: ./docs-site/dist/
40+
server-dir: /
41+
exclude: |
42+
**/.git*
43+
**/.git*/**
44+
**/node_modules/**
45+
**/.DS_Store
46+
**/Thumbs.db
47+
48+
- name: Purge Cloudflare cache (optional)
49+
if: ${{ secrets.CLOUDFLARE_ZONE_ID }}
50+
uses: jakejarvis/cloudflare-purge-action@master
51+
env:
52+
CLOUDFLARE_ZONE: ${{ secrets.CLOUDFLARE_ZONE_ID }}
53+
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }}

docs-site/.gitignore

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# build output
2+
dist/
3+
# generated types
4+
.astro/
5+
6+
# dependencies
7+
node_modules/
8+
9+
# logs
10+
npm-debug.log*
11+
yarn-debug.log*
12+
yarn-error.log*
13+
pnpm-debug.log*
14+
lerna-debug.log*
15+
16+
# runtime data
17+
pids
18+
*.pid
19+
*.seed
20+
*.pid.lock
21+
22+
# coverage directory used by tools like istanbul
23+
coverage/
24+
*.lcov
25+
26+
# nyc test coverage
27+
.nyc_output
28+
29+
# Dependency directories
30+
jspm_packages/
31+
32+
# Optional npm cache directory
33+
.npm
34+
35+
# Optional eslint cache
36+
.eslintcache
37+
38+
# Optional REPL history
39+
.node_repl_history
40+
41+
# Output of 'npm pack'
42+
*.tgz
43+
44+
# Yarn Integrity file
45+
.yarn-integrity
46+
47+
# environment variables
48+
.env
49+
.env.production
50+
.env.local
51+
.env.development.local
52+
.env.test.local
53+
.env.production.local
54+
55+
# parcel-bundler cache (https://parceljs.org/)
56+
.cache
57+
.parcel-cache
58+
59+
# next.js build output
60+
.next
61+
62+
# nuxt.js build output
63+
.nuxt
64+
65+
# vuepress build output
66+
.vuepress/dist
67+
68+
# Serverless directories
69+
.serverless/
70+
71+
# FuseBox cache
72+
.fusebox/
73+
74+
# DynamoDB Local files
75+
.dynamodb/
76+
77+
# TernJS port file
78+
.tern-port
79+
80+
# Editor directories and files
81+
.vscode/*
82+
!.vscode/extensions.json
83+
.idea
84+
*.suo
85+
*.ntvs*
86+
*.njsproj
87+
*.sln
88+
*.sw?
89+
90+
# macOS-specific files
91+
.DS_Store
92+
.AppleDouble
93+
.LSOverride
94+
95+
# Windows-specific files
96+
Thumbs.db
97+
ehthumbs.db
98+
Desktop.ini
99+
100+
# Linux-specific files
101+
*~
102+
103+
# Temporary files
104+
*.tmp
105+
*.temp
106+
107+
# Astro-specific
108+
.vercel

docs-site/.prettierrc

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"semi": true,
3+
"singleQuote": true,
4+
"tabWidth": 2,
5+
"useTabs": false,
6+
"trailingComma": "es5",
7+
"printWidth": 100,
8+
"endOfLine": "lf",
9+
"overrides": [
10+
{
11+
"files": "*.astro",
12+
"options": {
13+
"parser": "astro"
14+
}
15+
},
16+
{
17+
"files": ["*.md", "*.mdx"],
18+
"options": {
19+
"printWidth": 120,
20+
"proseWrap": "preserve"
21+
}
22+
}
23+
],
24+
"plugins": ["prettier-plugin-astro"]
25+
}

docs-site/.prettierrc.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"printWidth": 100,
3+
"tabWidth": 2,
4+
"useTabs": false,
5+
"semi": true,
6+
"singleQuote": false,
7+
"quoteProps": "as-needed",
8+
"trailingComma": "es5",
9+
"bracketSpacing": true,
10+
"bracketSameLine": false,
11+
"arrowParens": "always",
12+
"endOfLine": "lf",
13+
"plugins": ["prettier-plugin-astro"],
14+
"overrides": [
15+
{
16+
"files": "*.astro",
17+
"options": {
18+
"parser": "astro"
19+
}
20+
},
21+
{
22+
"files": ["*.md", "*.mdx"],
23+
"options": {
24+
"proseWrap": "preserve",
25+
"printWidth": 80
26+
}
27+
}
28+
]
29+
}

0 commit comments

Comments
 (0)