CI/CD Documentation Pipeline
This document describes the automated documentation build and deployment pipeline for the Stock Screening Platform.
Overviewβ
The documentation system automatically builds and deploys to GitHub Pages whenever changes are pushed to the main branch. The pipeline includes:
- Sphinx Documentation - Python API documentation from backend
- TypeDoc Documentation - TypeScript API documentation from frontend
- Docusaurus Site - Main documentation platform
- GitHub Pages - Hosting at https://docs.screener.kr
This pipeline ensures documentation is always up-to-date with the latest code changes, following continuous integration best practices.
Architectureβ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β GitHub Push (main) β
ββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β GitHub Actions Workflow β
β β
β ββββββββββββββββββ ββββββββββββββββββ ββββββββββββββββ β
β β Build Sphinx β β Build TypeDoc β β Build β β
β β (Python API) β β (Frontend API) β β Docusaurus β β
β βββββββββ¬βββββββββ βββββββββ¬βββββββββ ββββββββ¬ββββββββ β
β β β β β
β βββββββββββββββββββββ΄ββββββββββββββββββββ β
β β β
β βΌ β
β βββββββββββββββββββββββββ β
β β Deploy to GitHub Pagesβ β
β βββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββ
β https://docs.screener.kr β
βββββββββββββββββββββββββ
Workflow Configurationβ
File Locationβ
.github/workflows/docs.yml
Trigger Eventsβ
- Push to main branch with changes to:
docs/**frontend/src/**backend/app/**docs-site/**.github/workflows/docs.yml
- Manual trigger via GitHub Actions UI
The workflow only runs when documentation-related files change, saving build minutes and reducing unnecessary builds.
Build Stepsβ
1. Sphinx Documentation (Python API)β
cd docs/api/python
sphinx-build -b html -W --keep-going . _build/html
Output: docs-site/build/api/backend/
Flags:
-b html: Build HTML output-W: Treat warnings as errors--keep-going: Continue despite errors (collects all issues)
2. TypeDoc Documentation (Frontend API)β
cd frontend
npm run docs:generate
Output: docs-site/docs/api/frontend/ (configured in frontend/typedoc.json)
3. Docusaurus Buildβ
cd docs-site
npm run build
Output: docs-site/build/
4. GitHub Pages Deploymentβ
Uses actions/deploy-pages@v4 to deploy docs-site/build/ to GitHub Pages.
Performance Optimizationsβ
Dependency Cachingβ
The workflow caches dependencies to speed up builds:
- Node.js packages: docs-site/package-lock.json, frontend/package-lock.json
- Python packages: requirements-docs.txt
Expected Savings: 30-60 seconds per build
Dependency caching significantly reduces build time by reusing previously downloaded packages when dependencies haven't changed.
Build Parallelizationβ
Where possible, independent steps run in parallel through GitHub Actions' natural workflow execution.
Performance Targetsβ
| Metric | Target | Current |
|---|---|---|
| Total build time | < 3 minutes | TBD |
| Sphinx build | < 30 seconds | TBD |
| TypeDoc build | < 20 seconds | TBD |
| Docusaurus build | < 90 seconds | TBD |
| Deployment time | < 30 seconds | TBD |
GitHub Pages Configurationβ
Repository Settings Requiredβ
-
Enable GitHub Pages
- Go to:
Settings β Pages - Source:
GitHub Actions - Custom domain:
docs.screener.kr - Enforce HTTPS: β
- Go to:
-
Workflow Permissions
- Go to:
Settings β Actions β General β Workflow permissions - Select:
Read and write permissions - Enable:
Allow GitHub Actions to create and approve pull requests
- Go to:
-
Environments
- Automatically created:
github-pages - Protection rules can be added if needed
- Automatically created:
The workflow requires read and write permissions to deploy to GitHub Pages. Ensure these are configured correctly in repository settings.
DNS Configurationβ
At your domain provider, add a CNAME record:
Type: CNAME
Name: docs
Value: kcenon.github.io
TTL: 3600
DNS propagation may take up to 24 hours. Be patient and verify using dig command.
SSL Certificateβ
GitHub automatically provisions an SSL certificate for custom domains. This typically takes 24-48 hours after DNS configuration.
Verificationβ
Check Workflow Statusβ
# List recent workflow runs
gh run list --workflow=docs.yml
# View specific run details
gh run view <run-id> --log
# Watch a running workflow
gh run watch
Test Deploymentβ
# Check if site is accessible
curl -I https://docs.screener.kr
# Verify SSL certificate
curl -vI https://docs.screener.kr 2>&1 | grep "SSL certificate"
# Check GitHub Pages status
gh api repos/kcenon/screener_system/pages
Manual Triggerβ
# Trigger workflow manually
gh workflow run docs.yml
# Or via GitHub UI:
# Actions β Deploy Documentation to GitHub Pages β Run workflow
Troubleshootingβ
Build Failuresβ
Sphinx Build Failsβ
Symptom: Import errors, module not found
Solutions:
- Verify Python dependencies in
requirements-docs.txt - Check that backend modules are importable
- Review Sphinx configuration in
docs/api/python/conf.py
# Test locally
cd docs/api/python
sphinx-build -b html . _build/html
TypeDoc Build Failsβ
Symptom: TypeScript compilation errors
Solutions:
- Check TypeScript compilation:
cd frontend && npx tsc --noEmit - Verify
frontend/typedoc.jsonconfiguration - Check for TypeScript errors in source files
# Test locally
cd frontend
npm run docs:generate
Docusaurus Build Failsβ
Symptom: MDX syntax errors, broken links
Solutions:
- Check for MDX syntax errors:
cd docs-site && npm run build -- --debug - Review broken links in output
- Known issue: TypeDoc MDX compatibility (see DOC-008)
# Test locally
cd docs-site
npm run build
Docusaurus uses MDX which is stricter than standard Markdown. Ensure all JSX syntax is valid and properly closed.
Deployment Failuresβ
Permission Deniedβ
Symptom: Error: Resource not accessible by integration
Solution: Check workflow permissions in repository settings:
- Settings β Actions β General β Workflow permissions
- Enable "Read and write permissions"
Custom Domain Not Workingβ
Symptom: Site loads at kcenon.github.io/screener_system but not docs.screener.kr
Solutions:
- Verify CNAME file exists:
docs-site/static/CNAME - Check DNS configuration:
dig docs.screener.kr - Wait for DNS propagation (up to 24 hours)
- Verify custom domain in GitHub Pages settings
SSL Certificate Issuesβ
Symptom: SSL certificate not valid or not found
Solutions:
- Wait 24-48 hours for GitHub to provision certificate
- Ensure "Enforce HTTPS" is enabled in Pages settings
- Check that CNAME record is correctly configured
Performance Issuesβ
Slow Buildsβ
Solutions:
- Check that caching is working (look for cache hit/miss in logs)
- Profile individual build steps to identify bottlenecks
- Consider splitting documentation into multiple workflows if needed
Monitoringβ
Build Status Badgeβ
Add to README.md:
[](https://docs.screener.kr)
[](https://github.com/kcenon/screener_system/actions/workflows/docs.yml)
Status badges provide quick visibility into documentation build status directly from the README.
Notificationsβ
GitHub Actions automatically sends notifications for workflow failures to:
- Workflow author
- Commit author
- Repository watchers (if configured)
Configure additional notifications in repository settings:
- Settings β Notifications β Actions
Deployment Historyβ
View deployment history:
- Repository β Environments β github-pages
- Shows all deployments with timestamps and commit links
Costβ
| Component | Cost | Notes |
|---|---|---|
| GitHub Actions | $0 | 2,000 minutes/month free for public repos |
| GitHub Pages | $0 | Unlimited bandwidth for public repos |
| Storage | $0 | Unlimited for documentation sites |
| SSL Certificate | $0 | Auto-managed by GitHub |
| Total | $0/month | Completely free for open source |
GitHub provides a complete CI/CD and hosting solution at zero cost for open source projects.
Related Documentationβ
- GitHub Actions Documentation
- GitHub Pages Documentation
- Docusaurus Deployment Guide
- Sphinx Documentation
- TypeDoc Documentation
Known Issuesβ
TypeDoc MDX Compatibility (DOC-008)β
TypeDoc-generated Markdown contains comparison operators (<=, >=) that conflict with Docusaurus MDX parser.
Status: Tracked in ticket DOC-008 Workaround: Documentation is accessible but Docusaurus build may fail Resolution: Planned for DOC-008 implementation
TypeDoc-generated documentation may cause MDX parsing errors. This is a known issue tracked separately and will be resolved in a future update.
Maintenanceβ
Regular Tasksβ
- Review build times monthly and optimize if needed
- Update workflow versions quarterly
- Monitor GitHub Actions minutes usage
- Test manual deployment rollback procedure
Updating Workflowβ
- Make changes to
.github/workflows/docs.yml - Test on feature branch first
- Review workflow run logs
- Merge to main only after successful test
Always test workflow changes on a feature branch to avoid breaking the main documentation pipeline.
Emergency Rollbackβ
If a deployment breaks the documentation site:
# Revert to previous deployment
gh workflow run docs.yml --ref <previous-commit-sha>
# Or manually trigger workflow from previous commit via GitHub UI
Supportβ
For issues with documentation deployment:
- Check workflow logs:
gh run list --workflow=docs.yml - Review troubleshooting section above
- Create issue with
documentationandci/cdlabels - Contact repository maintainers
Last Updated: 2025-11-13 Workflow Version: 1.1.0 Status: Active