# full details
# Releases
gh release list # all releases
gh release create v2.0 --notes "..." # new release
# Repo info
gh repo view luk036/digraphx-cpp # README + meta
gh repo list luk036 # all user repos
# CI status check (quick)
gh run list -R luk036/digraphx-cpp -L 1 --json status --jq '.[].status'
```
--
**Pro tip:** alias for daily use:
```bash
# ~/.bashrc
alias ghci='gh run list -L 5'
alias ghls='gh repo list luk036'
```
---
class: nord-light, middle, center
## โ๏ธ CI โ GitHub Actions
---
### ๐ค What is CI?
**Continuous Integration** = every push triggers automated checks:
.mermaid[
graph LR
A["๐จโ๐ป git push"] --> B["๐ GitHub receives"]
B --> C["๐ง Build"]
B --> D["๐งช Test"]
B --> E["๐ฆ Deploy Docs"]
C --> F{"All green?"}
D --> F
E --> F
F -->|"โ
Yes"| G["๐ Ready to merge"]
F -->|"โ No"| H["๐ฌ Email/Slack alert"]
H --> A
style A fill:#e3f2fd,stroke:#1565c0,stroke-width:3px
style B fill:#e3f2fd,stroke:#1565c0,stroke-width:3px
style C fill:#c8e6c9,stroke:#2e7d32,stroke-width:3px
style D fill:#c8e6c9,stroke:#2e7d32,stroke-width:3px
style E fill:#c8e6c9,stroke:#2e7d32,stroke-width:3px
style F fill:#fff9c4,stroke:#f57f17,stroke-width:3px
style G fill:#c8e6c9,stroke:#2e7d32,stroke-width:3px
style H fill:#ffcdd2,stroke:#c62828,stroke-width:3px
]
--
**CI is a safety net** ๐ฅ
โ catches bugs before they reach users.
---
### ๐ Workflow Basics
GitHub Actions = YAML files in `.github/workflows/`:
.font-sm.mb-xs[
```yaml
# .github/workflows/ci.yaml
name: CI
on:
push:
branches: [dev] # trigger on dev pushes
pull_request:
branches: [main] # also on PRs to main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3 # ๐ฅ get code
- name: Install deps
run: sudo apt-get install -y doxygen graphviz
- name: Build
run: cmake --build build --target all
- name: Test
run: ctest --test-dir build
```
]
---
### ๐งฉ Matrix Builds
Test across **multiple OS and config combinations**:
.font-sm.mb-xs[
```yaml
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
config: [Debug, Release]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Build
run: |
cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.config }}
cmake --build build
```
]
--
**Result:** 6 parallel builds (3 OS ร 2 configs) โ catch platform-specific bugs ๐ฏ
.mermaid[
graph TB
subgraph "6 Parallel Jobs"
UD["๐ง Ubuntu Debug"]
UR["๐ง Ubuntu Release"]
WD["๐ช Windows Debug"]
WR["๐ช Windows Release"]
MD["๐ MacOS Debug"]
MR["๐ MacOS Release"]
end
UD & UR & WD & WR & MD & MR --> P["โ
All pass or โ Fail"]
style P fill:#fff9c4,stroke:#f57f17,stroke-width:3px
]
---
### ๐๏ธ CI Job Types
Typical open-source CI pipeline:
```yaml
jobs:
lint: # ๐ Code style (clang-format, clang-tidy)
runs-on: ubuntu-latest
build: # ๐ง Compile on all platforms
strategy:
matrix:
os: [ubuntu, windows, macos]
test: # ๐งช Run test suites
needs: build
runs-on: ubuntu-latest
docs: # ๐ Generate documentation
runs-on: ubuntu-latest
```
--
**Dependency chain:** `lint` โ `build` โ `test` โ `docs` ๐
**Fan-out:** `build` runs on 3 OS in parallel, `test` waits for all โ
---
### ๐ CI Artifacts & Deployment
CI can also **deploy** artifacts:
```yaml
docs:
runs-on: ubuntu-latest
steps:
- run: cmake --build build --target docs
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build/doxygen/html
```
--
**Every push to `dev` โ auto-deploys docs to `gh-pages` branch** ๐
**The `secrets.GITHUB_TOKEN`** is auto-injected by Actions โ no config needed ๐
```text
git push dev โ CI builds โ docs published to
https://luk036.github.io/digraphx-cpp/
```
---
class: nord-light, middle, center
## ๐ค Why This Matters in the AI Era
---
### ๐ง The AI Paradox
**AI generates more code than ever.** So why do traditional tools matter *more*?
.mermaid[
graph LR
A["๐ค AI writes code"] --> B["๐ More commits"]
B --> C["๐ More PRs"]
C --> D["๐งช More to test"]
D --> E["๐ More to monitor"]
E --> F["๐ More to review"]
F --> A
style A fill:#e3f2fd,stroke:#1565c0,stroke-width:3px
style B fill:#e3f2fd,stroke:#1565c0,stroke-width:3px
style C fill:#fff9c4,stroke:#f57f17,stroke-width:3px
style D fill:#ffcdd2,stroke:#c62828,stroke-width:3px
style E fill:#e3f2fd,stroke:#1565c0,stroke-width:3px
style F fill:#c8e6c9,stroke:#2e7d32,stroke-width:3px
]
--
**AI accelerates output.** Git, CI, and `gh` **manage the complexity** that acceleration creates. Without them, more code = more chaos ๐ฅ
---
### ๐ฏ Git: The AI Safety Net
**AI generates code. Git tracks every byte.**
```bash
# Who wrote what?
git log --oneline --author="Sisyphus" # AI agent's work
git log --oneline --author="luk036" # human's work
# What did AI change?
git diff HEAD~3..HEAD --stat
# Emergency rollback
git revert
```
--
**AI hallucinations** โ bad code โ `git revert` fixes in seconds โฑ๏ธ
**Without git:** AI writes garbage, you can't unwind it ๐๏ธ
---
### โ๏ธ CI: The AI Hallucination Detector
AI models **hallucinate** โ they produce plausible-looking but wrong code:
```cpp
// AI-generated "solution"
auto solve_quadratic(double a, double b, double c) {
return std::sqrt(b * b - 4 * a * c) / (2 * a); // โ missing -b!
}
```
**CI catches it:**
```text
FAILED test_quadratic.py::test_roots
Expected: (1.0, -2.0)
Got: (2.0, -2.0)
```
--
**Key insight:** The faster AI generates code, the **more** you need CI to verify it.
CI is the **trust layer** between AI output and production โ
---
### ๐ค CI: Multi-platform Reality Check
AI trained on Linux code โ but your users are on **Windows, MacOS, ARM**:
```yaml
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
```
.mermaid[
graph LR
A["๐ค AI generates code"] --> B["๐ง Linux CI"]
A --> C["๐ช Windows CI"]
A --> D["๐ MacOS CI"]
B --> E{"โ
Cross-platform?"}
C --> E
D --> E
E -->|"โ"| F["๐ง Fix + re-prompt"]
E -->|"โ
"| G["๐ Ship"]
style A fill:#e3f2fd,stroke:#1565c0,stroke-width:3px
style B fill:#e3f2fd,stroke:#1565c0,stroke-width:3px
style C fill:#e3f2fd,stroke:#1565c0,stroke-width:3px
style D fill:#e3f2fd,stroke:#1565c0,stroke-width:3px
style E fill:#fff9c4,stroke:#f57f17,stroke-width:3px
style F fill:#ffcdd2,stroke:#c62828,stroke-width:3px
style G fill:#c8e6c9,stroke:#2e7d32,stroke-width:3px
]
--
**AI is platform-blind. CI is platform-aware.** Together they're unbeatable ๐
---
### ๐ป gh CLI: AI Agent's Best Friend
**AI agents don't use browsers.** They use **CLI tools**:
```bash
# AI agent checks its own CI status
gh run list --repo luk036/digraphx-cpp --limit 3 --json conclusion
# AI agent creates a PR
gh pr create --title "AI: refactor matrix multiply" \
--body "Generated by Sisyphus agent" \
--label "ai-generated"
# AI agent views failures
gh run view --log --log-failed
```
--
**This session's workflow was 90% AI-driven** using these exact commands ๐
--
**`gh` is the API bridge** between AI agents and GitHub โ no browser, no GUI, no CAPTCHA ๐ฏ
---
### ๐ The Productivity Multiplier
$$ \text{Output} = \text{AI Speed} \times \text{CI Safety} \times \text{Git Control} $$
.mermaid[
graph TB
subgraph "Without Git + CI + gh"
A1["๐ค AI writes code"]
A2["๐ฑ Manual review"]
A3["๐ Bugs reach users"]
A4["โฑ๏ธ Hours to fix"]
A1 --> A2 --> A3 --> A4
end
style A2 fill:#ffcdd2,stroke:#c62828,stroke-width:3px
style A3 fill:#ffcdd2,stroke:#c62828,stroke-width:3px
]
.mermaid[
graph TB
subgraph "With Git + CI + gh"
B1["๐ค AI writes code"]
B2["โ๏ธ CI tests instantly"]
B3["๐ gh alerts on failure"]
B4["๐ git revert + fix"]
B5["โ
Ship with confidence"]
B1 --> B2 --> B3 --> B4 --> B5
end
style B2 fill:#c8e6c9,stroke:#2e7d32,stroke-width:3px
style B3 fill:#fff9c4,stroke:#f57f17,stroke-width:3px
style B5 fill:#c8e6c9,stroke:#2e7d32,stroke-width:3px
]
---
### ๐งญ The Triangle: Human ยท AI ยท Tooling
.mermaid[
graph LR
H["๐จโ๐ป Human\n(Review, approve, direct)"] --> T
A["๐ค AI Agent\n(Write, commit, PR)"] --> T
T["๐ ๏ธ Git + gh + CI\n(Track, test, deploy)"] --> H
T --> A
style H fill:#e3f2fd,stroke:#1565c0,stroke-width:3px
style A fill:#e3f2fd,stroke:#1565c0,stroke-width:3px
style T fill:#e3f2fd,stroke:#1565c0,stroke-width:3px
]
--
**Git** is the ledger ๐ โ every AI action is recorded, reversible, auditable
**CI** is the gatekeeper ๐ง โ AI output must pass tests before shipping
**`gh`** is the remote control ๐ก โ AI agents operate GitHub programmatically
--
> **"AI doesn't replace version control. It makes version control more important."**
---
### ๐ AI-Era Truths
.font-sm.mb-xs[
| AI Capability | What It Needs From You | Tool |
|---------------|----------------------|------|
| ๐ง Generate code | ๐งช Verify it compiles | CI build |
| ๐ Hallucinate APIs | ๐ Catch undefined symbols | CI lint + test |
| ๐ Scale to 21 repos | ๐ค Automate every step | git + gh scripting |
| ๐ Cross-platform blind | โ
Test everywhere | Matrix CI |
| โฉ Fast iteration | ๐ Audit trail | git log + blame |
| ๐ค Agent autonomy | ๐ก Remote control API | gh CLI |
]
**The more AI you use, the more you need these tools.** Not less. ๐
---
class: nord-light, middle, center
## ๐ The Dev Loop
---
### ๐ฌ Real Example: CI Catches a Bug
**Step 1:** Push changes to CI config + source docs ๐
```bash
git add include/ && git commit -m "docs: add equations"
git add .github/ && git commit -m "ci: enable graphviz"
git push
```
**Step 2:** Check CI status with `gh` ๐
```bash
gh run list --repo luk036/digraphx-cpp --limit 5
```
```text
COMPLETED failure push dev docs: enable graphviz Ubuntu โ
COMPLETED failure push dev docs: enable graphviz Windows โ
COMPLETED failure push dev docs: enable graphviz MacOS โ
```
**All 4 runners failed** โ ๐จ something is wrong!
---
### ๐ต๏ธ Step 3: Investigate with `gh run view`
```bash
gh run view --repo luk036/digraphx-cpp --log | tail -30
```
```text
/home/runner/.../neg_cycle.hpp:38:4:
error: stray '@' in program
38 | * @verbatim
| ^
```
**Root cause:** A Doxygen `@verbatim` tag ended up **outside** `/** */` comment block.
The compiler sees `@` as a stray character in C++ code ๐ฅ
```cpp
/**
* @dot ... @enddot
*/
* โ ๐ฉ not in comment!
* @verbatim โ "stray '@'"
*/
```
---
### ๐ ๏ธ Step 4: Fix & Recommit
**One-line fix:** remove the orphaned lines ๐
```bash
# Edit the file โ delete 22 orphaned lines
git add include/digraphx/neg_cycle.hpp
git commit -m "fix: close orphaned Doxygen comment block"
git push
```
--
**Step 5:** Verify fix with `gh` ๐
```bash
gh run list --repo luk036/digraphx-cpp --limit 3
```
```text
IN_PROGRESS push dev fix: orphaned Doxygen comment Ubuntu
QUEUED push dev fix: orphaned Doxygen comment Windows
QUEUED push dev fix: orphaned Doxygen comment MacOS
```
**New CI runs triggered automatically** โ no manual retry needed โ
---
### โฑ๏ธ The Full Cycle: 5 Minutes
.mermaid[
graph LR
A["๐ git push"] --> B["โณ CI runs (2 min)"]
B --> C["๐ gh run list"]
C --> D{"โ All failed?"}
D -->|"Yes"| E["๐ gh run view --log"]
E --> F["๐ Identify bug"]
F --> G["โ๏ธ Fix (1 edit)"]
G --> H["๐ git commit"]
H --> I["๐ git push"]
I --> J["โ
New CI triggers"]
J --> B
D -->|"No / Partial"| K["๐ Merge & deploy"]
style A fill:#e3f2fd,stroke:#1565c0,stroke-width:3px
style C fill:#fff9c4,stroke:#f57f17,stroke-width:3px
style E fill:#ffcdd2,stroke:#c62828,stroke-width:3px
style G fill:#c8e6c9,stroke:#2e7d32,stroke-width:3px
style K fill:#c8e6c9,stroke:#2e7d32,stroke-width:3px
]
**From `git push` to fix deployed:** under 5 minutes โก
**Key enablers:** `gh run list` + `gh run view` = debug without browser ๐ฏ
---
### ๐ค Automation Patterns
Patterns for managing **multiple open-source repos**:
```powershell
# Pattern 1: Batch status check
foreach ($repo in $repos) {
Push-Location $repo
git status --porcelain
Pop-Location
}
# Pattern 2: Batch commit + push
foreach ($repo in $repos) {
Push-Location $repo
git add -A && git commit -m "$msg" && git push
Pop-Location
}
# Pattern 3: Batch CI check
foreach ($repo in $repos) {
gh run list --repo "org/$repo" --limit 2
}
```
**Parallel execution** (3 batches ร 7 repos) = 3ร faster than sequential ๐
---
### ๐ง Best Practices Summary
.font-sm.mb-xs[
| Practice | Why |
|----------|-----|
| **Atomic commits** | Revert, cherry-pick, bisect all work |
| **Split config vs code** | Different revert cadence |
| **Always check CI** | `gh run list` before merging |
| **Fix CI first** | Red builds = broken contract |
| **Batch when >1 repo** | Script it, parallelize it |
| **Use `gh` not browser** | Stay in terminal, stay in flow |
| **Fast-forward merge** | Clean linear history |
| **Descriptive commit msgs** | `git log` tells the story |
]
---
count: false
class: nord-dark, middle, center
### ๐ Key Takeaways
**1๏ธโฃ Git** โ atomic commits, branch strategy, clean merges ๐ฒ
**2๏ธโฃ gh CLI** โ `gh run list` + `gh run view` + `gh pr` = browser-free dev flow ๐ป
**3๏ธโฃ CI** โ safety net that catches bugs before users see them โ๏ธ
**4๏ธโฃ The Loop** โ Code โ Commit โ Push โ CI โ Fix โ Merge โ **Ship** ๐
**5๏ธโฃ Automate** โ batch scripts + parallel execution for multi-repo workflows ๐ค
---
count: false
class: nord-dark, middle, center
# ๐ Thank You! ๐
### Open-source Dev Flow: Git + gh + CI
**Slides**: `luk036.github.io/idea/git-gh-ci-remark.html`
**Tools**: `git` ยท `gh` ยท GitHub Actions
**Q&A** ๐ค