Skip to content

Commit 261c729

Browse files
authored
Merge pull request #193 from carbondirect/boost-doc
🚀 Complete CI/CD Documentation Build System v3.0.2
2 parents f281de8 + 3f11b5e commit 261c729

File tree

223 files changed

+35639
-1680
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

223 files changed

+35639
-1680
lines changed

.github/CICD-DOCUMENTATION.md

Lines changed: 322 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,322 @@
1+
# 🚀 BOOST Documentation CI/CD Pipeline
2+
3+
This document describes the comprehensive CI/CD pipeline implementation for the BOOST Data Standard documentation build and deployment process.
4+
5+
## 📋 Overview
6+
7+
The CI/CD pipeline consists of **4 main workflows** designed to ensure documentation quality, automate builds, and deploy documentation across multiple environments:
8+
9+
1. **PR Validation** (`validate-pr.yml`) - Fast quality gates for pull requests
10+
2. **Build & Deploy** (`build-deploy.yml`) - Full documentation build and deployment to staging
11+
3. **Release Management** (`release.yml`) - Tagged release builds with artifact creation
12+
4. **Schema Validation** (`schema-validation.yml`) - Comprehensive schema integrity checks
13+
14+
## 🏗️ Workflow Architecture
15+
16+
```mermaid
17+
graph TD
18+
A[Pull Request] --> B[PR Validation]
19+
B --> C{Validation Passed?}
20+
C -->|Yes| D[Merge to Main]
21+
C -->|No| E[Fix Issues]
22+
E --> B
23+
24+
D --> F[Build & Deploy]
25+
F --> G[Deploy to GitHub Pages]
26+
27+
H[Create Tag] --> I[Release Workflow]
28+
I --> J[Build Release Artifacts]
29+
J --> K[Create GitHub Release]
30+
31+
L[Schema Changes] --> M[Schema Validation]
32+
M --> N[FK Integrity Check]
33+
N --> O[Python Model Validation]
34+
```
35+
36+
## 🔍 Workflow Details
37+
38+
### 1. PR Validation (`validate-pr.yml`)
39+
40+
**Triggers:** Pull requests to `main` or `develop` branches
41+
**Purpose:** Fast quality gates to prevent issues from entering main branch
42+
**Duration:** ~3-5 minutes
43+
44+
**Quality Gates:**
45+
- ✅ JSON Schema syntax validation for all 33+ entities
46+
- ✅ Schema structure validation (required keys, proper format)
47+
- ✅ Foreign key integrity checks
48+
- ✅ Documentation build test
49+
- ✅ HTML output validation
50+
51+
**Artifacts:** PR build artifacts (retained 7 days)
52+
53+
### 2. Build & Deploy (`build-deploy.yml`)
54+
55+
**Triggers:** Pushes to `main` branch, manual dispatch
56+
**Purpose:** Full documentation build and deployment to production
57+
**Duration:** ~8-12 minutes
58+
59+
**Build Process:**
60+
1. **Environment Setup**: Python 3.11, LaTeX, Bikeshed
61+
2. **Version Extraction**: From git tags (authoritative source)
62+
3. **Schema Validation**: Comprehensive validation of all schemas
63+
4. **Documentation Build**: HTML generation with ReSpec styling
64+
5. **Build Validation**: Output validation and quality checks
65+
6. **GitHub Pages Deployment**: Automated deployment to public documentation site
66+
67+
**Outputs:**
68+
- 📚 Complete HTML documentation
69+
- 🔍 Interactive ERD Navigator
70+
- 📋 All schema files
71+
- 🌐 Deployed to GitHub Pages
72+
73+
### 3. Release Management (`release.yml`)
74+
75+
**Triggers:** Git tags matching `v[0-9]+.0.0` pattern (major versions only), manual dispatch
76+
**Purpose:** Create production releases with downloadable artifacts for major versions
77+
**Duration:** ~12-18 minutes
78+
79+
**Major Version Policy:** Only major versions (v1.0.0, v2.0.0, v3.0.0, etc.) trigger automatic releases.
80+
81+
**Release Process:**
82+
1. **Comprehensive Validation**: Full schema and integrity validation
83+
2. **Multi-format Build**: HTML + PDF documentation generation
84+
3. **Release Package Creation**: Complete downloadable packages
85+
4. **GitHub Release**: Automated release creation with artifacts
86+
87+
**Artifacts:**
88+
- 📦 Complete release packages (ZIP, TAR.GZ)
89+
- 📄 PDF documentation (when available)
90+
- 📚 HTML documentation
91+
- 🔍 ERD Navigator
92+
- 📋 All schema files
93+
94+
### 4. Schema Validation (`schema-validation.yml`)
95+
96+
**Triggers:** Schema file changes, manual dispatch with validation levels
97+
**Purpose:** Deep validation of schema integrity and relationships
98+
**Duration:** ~5-8 minutes
99+
100+
### 5. Version Management (`version-check.yml`)
101+
102+
**Triggers:** All version tags (excluding major versions), manual version planning
103+
**Purpose:** Analyze version tags and provide guidance for non-major versions
104+
**Duration:** ~1-2 minutes
105+
106+
**Features:**
107+
- Version type analysis (major/minor/patch)
108+
- Release policy enforcement notifications
109+
- Manual release guidance for non-major versions
110+
- Version planning assistance
111+
112+
**Validation Matrix:**
113+
- **Syntax Validation**: JSON format correctness
114+
- **Structure Validation**: Required keys and schema structure
115+
- **Metadata Validation**: BOOST metadata completeness
116+
- **Pattern Validation**: Foreign key pattern consistency
117+
- **Relationship Validation**: FK integrity across all entities
118+
- **Python Model Validation**: Pydantic model compatibility
119+
120+
## 🔧 Technical Implementation
121+
122+
### Dependencies
123+
124+
**System Dependencies:**
125+
- `bikeshed` - Document processing engine
126+
- `Python 3.11` - For HTML manipulation and validation scripts
127+
- `LaTeX` - PDF generation (optional)
128+
- `pandoc` - HTML to PDF conversion fallback
129+
130+
**Python Dependencies:**
131+
- `jsonschema` - JSON Schema validation
132+
- `pydantic[email]>=2.0.0` - Python model validation
133+
- `requests` - HTTP utilities
134+
135+
### Environment Variables
136+
137+
| Variable | Purpose | Example |
138+
|----------|---------|---------|
139+
| `BOOST_DOC_VERSION` | Current build version | `v2.9.0` |
140+
| `GITHUB_TOKEN` | GitHub API access | Auto-provided |
141+
142+
### Caching Strategy
143+
144+
- **Python Dependencies**: pip cache for faster installs
145+
- **System Packages**: apt cache for LaTeX and system tools
146+
- **Bikeshed Data**: Bikeshed spec database cache
147+
148+
## 📊 Quality Gates & Validation
149+
150+
### Schema Validation Requirements
151+
152+
1. **JSON Syntax**: All schema files must be valid JSON
153+
2. **Structure Compliance**: Required keys (`schema`, `boost_metadata`) must be present
154+
3. **Metadata Completeness**: Entity name, primary key, area, description required
155+
4. **Foreign Key Integrity**: All FK patterns must reference existing entities
156+
5. **Pattern Consistency**: FK patterns must follow BOOST conventions
157+
158+
### Build Validation Requirements
159+
160+
1. **HTML Generation**: `boost-spec.html` must be generated successfully
161+
2. **File Size**: HTML output must be substantial (>200KB for releases)
162+
3. **Content Validation**: Must contain expected BOOST content
163+
4. **Styling Application**: ReSpec CSS must be applied correctly
164+
5. **ERD Navigator**: Interactive tool must be present and functional
165+
166+
## 🚀 Deployment Strategy
167+
168+
### GitHub Pages Deployment
169+
170+
**URL Structure:**
171+
- Main Documentation: `https://[username].github.io/[repo]/boost-spec.html`
172+
- ERD Navigator: `https://[username].github.io/[repo]/erd-navigator/`
173+
- Schema Files: `https://[username].github.io/[repo]/schema/`
174+
175+
**Deployment Process:**
176+
1. Build artifacts are packaged for Pages
177+
2. Automatic index.html redirect to main documentation
178+
3. Version information embedded in deployment
179+
4. All supporting files (CSS, schemas, ERD) included
180+
181+
### Release Artifacts
182+
183+
**Package Contents:**
184+
- Complete HTML documentation with interactive features
185+
- PDF documentation (when available)
186+
- Interactive ERD Navigator
187+
- All JSON schema validation files
188+
- Python reference implementation
189+
- Supporting files (CSS, includes, etc.)
190+
- Comprehensive README with usage instructions
191+
192+
## 🔄 Workflow Triggers & Conditions
193+
194+
### Automatic Triggers
195+
196+
| Trigger | Workflows | Purpose |
197+
|---------|-----------|---------|
198+
| PR to main/develop | `validate-pr.yml` | Quality gates |
199+
| Push to main | `build-deploy.yml`, `schema-validation.yml` | Deploy latest |
200+
| Tag push `v[0-9]+.0.0` | `release.yml` | Create major releases |
201+
| Tag push `v*.*.*` (non-major) | `version-check.yml` | Version analysis |
202+
| Schema file changes | `schema-validation.yml` | Validate changes |
203+
204+
### Manual Triggers
205+
206+
All workflows support manual dispatch via GitHub Actions UI with configurable parameters.
207+
208+
## 🏷️ **Version Release Policy**
209+
210+
### **Major Version Releases (Automatic)**
211+
- **Pattern:** `v[0-9]+.0.0` (e.g., v1.0.0, v2.0.0, v3.0.0)
212+
- **Trigger:** Automatic release workflow
213+
- **Includes:** Full documentation, PDF, artifacts, GitHub release
214+
- **Use for:** Breaking changes, major new features, significant updates
215+
216+
### **Minor/Patch Version Releases (Manual)**
217+
- **Pattern:** `v*.*.*` (e.g., v2.1.0, v2.1.1)
218+
- **Trigger:** Version analysis workflow only
219+
- **Default:** No automatic release created
220+
- **Manual Options:**
221+
1. Use manual dispatch in Release workflow with `force_release=true`
222+
2. Wait and accumulate changes for next major version
223+
224+
### **Version Policy Summary**
225+
226+
| Version Type | Pattern | Auto Release | Manual Release | Use Case |
227+
|--------------|---------|--------------|----------------|----------|
228+
| **Major** | `v1.0.0` | ✅ Yes | ✅ Yes | Breaking changes, major features |
229+
| **Minor** | `v1.1.0` | ❌ No | ✅ Yes (forced) | New features, backwards compatible |
230+
| **Patch** | `v1.1.1` | ❌ No | ✅ Yes (forced) | Bug fixes, small improvements |
231+
232+
## 📈 Performance Optimizations
233+
234+
1. **Parallel Validation**: Schema validation runs in parallel matrix
235+
2. **Conditional Builds**: Only run when relevant files change
236+
3. **Artifact Caching**: Dependencies cached between runs
237+
4. **Incremental Validation**: Only validate changed schemas when possible
238+
5. **Concurrent Jobs**: Multiple validation types run simultaneously
239+
240+
## 🛡️ Security Considerations
241+
242+
1. **Permissions**: Minimal required permissions for each workflow
243+
2. **Token Usage**: GitHub tokens automatically scoped and rotated
244+
3. **Artifact Retention**: Appropriate retention policies (7-90 days)
245+
4. **Environment Protection**: Production deployments require approval
246+
5. **Dependency Security**: Regular dependency updates via Dependabot
247+
248+
## 📚 Usage Instructions
249+
250+
### For Contributors
251+
252+
1. **Making Changes**: Create feature branches, submit PRs
253+
2. **Schema Changes**: Ensure FK patterns follow BOOST conventions
254+
3. **Testing**: PR validation provides immediate feedback
255+
4. **Documentation**: Changes automatically deployed after merge
256+
257+
### For Maintainers
258+
259+
1. **Creating Releases**: Push tags matching `v*.*.*` pattern
260+
2. **Manual Builds**: Use workflow dispatch for custom builds
261+
3. **Quality Control**: Review PR validation results before merge
262+
4. **Monitoring**: Check GitHub Actions tab for build status
263+
264+
### For Integrators
265+
266+
1. **Schema Access**: Download from releases or access via GitHub Pages
267+
2. **Python Models**: Use reference implementation from releases
268+
3. **API Integration**: Access schemas via predictable URLs
269+
4. **Version Tracking**: Monitor releases for updates
270+
271+
## 🔧 Troubleshooting
272+
273+
### Common Issues
274+
275+
**Build Failures:**
276+
- Check bikeshed installation and update
277+
- Verify all schema files have valid JSON syntax
278+
- Ensure git tags are properly formatted
279+
280+
**Deployment Issues:**
281+
- Verify GitHub Pages is enabled in repository settings
282+
- Check workflow permissions for Pages deployment
283+
- Ensure artifacts are correctly packaged
284+
285+
**Schema Validation Failures:**
286+
- Validate JSON syntax in changed schemas
287+
- Check FK patterns match expected prefixes
288+
- Ensure all referenced entities exist
289+
290+
### Monitoring & Alerts
291+
292+
1. **GitHub Actions**: Built-in status monitoring
293+
2. **Pages Deployment**: Automatic deployment status
294+
3. **Release Creation**: GitHub notifications for new releases
295+
4. **PR Checks**: Automatic status checks on pull requests
296+
297+
## 🎯 Future Enhancements
298+
299+
1. **PDF Generation**: Enhanced LaTeX-based PDF generation
300+
2. **Multi-format Output**: Additional output formats (Word, etc.)
301+
3. **Performance Testing**: Automated performance validation
302+
4. **Link Validation**: Comprehensive link checking
303+
5. **Accessibility**: Automated accessibility testing
304+
6. **Internationalization**: Multi-language documentation support
305+
306+
## 📞 Support & Maintenance
307+
308+
**Workflow Maintenance:**
309+
- Regular dependency updates
310+
- GitHub Actions version updates
311+
- Performance optimization reviews
312+
- Security audit and updates
313+
314+
**Documentation Maintenance:**
315+
- Keep this guide updated with changes
316+
- Document new quality gates or validation rules
317+
- Update troubleshooting guides based on issues
318+
319+
For questions or issues with the CI/CD pipeline, please:
320+
1. Check the GitHub Actions logs for detailed error information
321+
2. Review this documentation for troubleshooting steps
322+
3. Open an issue in the repository for pipeline-related problems

0 commit comments

Comments
 (0)