|
| 1 | +# GitHub Actions Workflow Architecture |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +This document describes the GitHub Actions workflow used to build and deploy the site at https://uclchem.github.io. |
| 6 | + |
| 7 | +### Triggers |
| 8 | + |
| 9 | +- Push to `main` (automatic deploy) |
| 10 | +- Weekly scheduled run (Sunday 00:00 UTC) |
| 11 | +- Manual `workflow_dispatch` from Actions tab |
| 12 | + |
| 13 | +### Build job (summary) |
| 14 | + |
| 15 | +1. Checkout this repository (`uclchem/uclchem.github.io`, branch: `main`) |
| 16 | +2. Set up Python environment (Ubuntu, Python 3.12) and enable pip caching |
| 17 | +3. Install system dependencies (e.g., `gfortran`) |
| 18 | +4. Sync notebooks and assets from the main UCLCHEM repository: |
| 19 | + - Clone `https://github.com/uclchem/UCLCHEM.git` |
| 20 | + - Copy numbered notebooks into `./notebooks/` and any notebook assets |
| 21 | + - Copy `answer/uclchem.png` → `./_static/logo.png` (if present) |
| 22 | +5. Install UCLCHEM (pip install from GitHub) and documentation dependencies (`pip install -r requirements.txt`) |
| 23 | +6. Clear caches (`rm -rf _build/.jupyter_cache`) |
| 24 | +7. Build Sphinx docs (`make html`): execute notebooks (optional), generate API via AutoAPI, render blog |
| 25 | +8. Upload build artifact (`./_build/html`) for deployment |
| 26 | + |
| 27 | +### Deploy job (summary) |
| 28 | + |
| 29 | +- Runs after a successful build on `main` |
| 30 | +- Uses `actions/deploy-pages@v4` with the uploaded artifact |
| 31 | +- Deploys to GitHub Pages environment `github-pages` at `https://uclchem.github.io` |
| 32 | + |
| 33 | +## Data flow (concise) |
| 34 | + |
| 35 | +- Source repo: `uclchem/UCLCHEM` (notebooks, package source, assets) |
| 36 | +- Doc repo: `uclchem/uclchem.github.io` (Sphinx sources, config) |
| 37 | +- On build: notebooks and assets are pulled from the source repo → Sphinx builds → `_build/html` → GitHub Pages |
| 38 | + |
| 39 | +--- |
| 40 | + |
| 41 | +(See the sections below for features, triggers, permissions, timings and verification steps.) |
| 42 | + |
| 43 | + |
| 44 | +## Data Flow |
| 45 | + |
| 46 | +``` |
| 47 | +uclchem/UCLCHEM uclchem/uclchem.github.io |
| 48 | +(main repository) (documentation repository) |
| 49 | + │ │ |
| 50 | + │ │ |
| 51 | + ├─ notebooks/*.ipynb ────────────────▶│ notebooks/*.ipynb |
| 52 | + │ │ |
| 53 | + ├─ src/uclchem/ ──┐ │ |
| 54 | + │ │ │ |
| 55 | + │ [pip install] ────────────▶│ (UCLCHEM package) |
| 56 | + │ │ |
| 57 | + └─ answer/uclchem.png ───────────────▶│ _static/logo.png |
| 58 | + │ |
| 59 | + ├─ conf.py |
| 60 | + ├─ *.md files |
| 61 | + ├─ blog/*.md |
| 62 | + ├─ user_docs/*.md |
| 63 | + │ |
| 64 | + [Sphinx Build] |
| 65 | + │ |
| 66 | + ▼ |
| 67 | + _build/html/ |
| 68 | + │ |
| 69 | + [GitHub Pages] |
| 70 | + │ |
| 71 | + ▼ |
| 72 | + https://uclchem.github.io |
| 73 | +``` |
| 74 | + |
| 75 | +## Key Features |
| 76 | + |
| 77 | +### Automatic Synchronization |
| 78 | +- **Source:** uclchem/UCLCHEM repository notebooks |
| 79 | +- **Destination:** uclchem.github.io/notebooks |
| 80 | +- **Frequency:** On every build (push, weekly, or manual) |
| 81 | +- **Pattern:** `[0-9]*.ipynb` (numbered notebooks only) |
| 82 | + |
| 83 | +### Build Process |
| 84 | +- **Sphinx:** Converts .md/.rst → HTML |
| 85 | +- **myst-nb:** Executes and renders Jupyter notebooks |
| 86 | +- **AutoAPI:** Generates Python API documentation from UCLCHEM source |
| 87 | +- **ABlog:** Renders blog posts with timestamps and categories |
| 88 | + |
| 89 | +### Deployment Method |
| 90 | +- **Type:** GitHub Actions native (modern) |
| 91 | +- **Old method:** ~~peaceiris/actions-gh-pages~~ (deprecated) |
| 92 | +- **New method:** actions/upload-pages-artifact + actions/deploy-pages |
| 93 | +- **Branch:** No gh-pages branch needed |
| 94 | +- **Environment:** github-pages (tracked in repo) |
| 95 | + |
| 96 | +## Triggers |
| 97 | + |
| 98 | +| Event | When | Description | |
| 99 | +|-------|------|-------------| |
| 100 | +| `push` | On commit to `main` | Immediate deployment of changes | |
| 101 | +| `schedule` | Sunday 00:00 UTC | Weekly sync of notebooks from main repo | |
| 102 | +| `workflow_dispatch` | Manual | Trigger from Actions tab | |
| 103 | + |
| 104 | +## Permissions Required |
| 105 | + |
| 106 | +```yaml |
| 107 | +permissions: |
| 108 | + contents: read # Read repository content |
| 109 | + pages: write # Deploy to GitHub Pages |
| 110 | + id-token: write # OIDC token for Pages deployment |
| 111 | +``` |
| 112 | +
|
| 113 | +## Concurrency Control |
| 114 | +
|
| 115 | +```yaml |
| 116 | +concurrency: |
| 117 | + group: "pages" |
| 118 | + cancel-in-progress: true |
| 119 | +``` |
| 120 | +
|
| 121 | +- Only one deployment at a time |
| 122 | +- New deployments cancel pending ones |
| 123 | +- Prevents conflicts from simultaneous builds |
| 124 | +
|
| 125 | +## Build Time |
| 126 | +
|
| 127 | +| Phase | Duration | Notes | |
| 128 | +|-------|----------|-------| |
| 129 | +| Setup (Python, gfortran) | ~1-2 min | Cached | |
| 130 | +| Notebook sync | ~30 sec | Shallow clone | |
| 131 | +| UCLCHEM install | ~2-3 min | From GitHub | |
| 132 | +| Sphinx build | ~5-10 min | Notebook execution | |
| 133 | +| Upload & deploy | ~1-2 min | Artifact transfer | |
| 134 | +| **Total** | **~10-15 min** | First run | |
| 135 | +| **Total (cached)** | **~5-7 min** | Subsequent runs | |
| 136 | +
|
| 137 | +## Verification Steps |
| 138 | +
|
| 139 | +After deployment: |
| 140 | +
|
| 141 | +1. ✅ Check Actions tab for green checkmark |
| 142 | +2. ✅ Verify deployment environment shows correct URL |
| 143 | +3. ✅ Visit https://uclchem.github.io |
| 144 | +4. ✅ Check notebooks are present and rendered |
| 145 | +5. ✅ Verify API documentation exists at /api/ |
| 146 | +6. ✅ Check blog posts at /blog/ |
| 147 | +
|
| 148 | +## Monitoring |
| 149 | +
|
| 150 | +### Success Indicators |
| 151 | +- Build job completes without errors |
| 152 | +- Deploy job shows deployment URL |
| 153 | +- Site is accessible at https://uclchem.github.io |
| 154 | +- Notebooks, API docs, and blog are all present |
| 155 | +
|
| 156 | +### Failure Indicators |
| 157 | +- Red X in Actions tab |
| 158 | +- Error messages in job logs |
| 159 | +- 404 errors on site |
| 160 | +- Missing content sections |
| 161 | +
|
| 162 | +### Debugging |
| 163 | +1. Click failed workflow run |
| 164 | +2. Expand failed step |
| 165 | +3. Review error messages |
| 166 | +4. Check logs for specific issues |
| 167 | +5. Test locally: `make html` |
| 168 | + |
| 169 | +## Repository Settings |
| 170 | + |
| 171 | +Required GitHub Pages configuration: |
| 172 | + |
| 173 | +``` |
| 174 | +Settings → Pages |
| 175 | + Source: GitHub Actions ← CRITICAL! |
| 176 | + |
| 177 | +Settings → Actions → General |
| 178 | + Workflow permissions: Read and write |
| 179 | +``` |
| 180 | + |
| 181 | +## File Locations |
| 182 | + |
| 183 | +| File | Purpose | |
| 184 | +|------|---------| |
| 185 | +| `.github/workflows/deploy-docs.yml` | Main workflow definition | |
| 186 | +| `.github/SETUP.md` | Complete setup instructions | |
| 187 | +| `.github/MIGRATION.md` | Migration notes from old method | |
| 188 | +| `.github/check-setup.sh` | Setup verification script | |
| 189 | +| `requirements.txt` | Python dependencies | |
| 190 | +| `conf.py` | Sphinx configuration | |
| 191 | +| `Makefile` | Build shortcuts | |
0 commit comments