learning_ai_common_plat/.windsurf/workflows/gitea-ci.md
saravanakumardb1 ff97a372ac fix(workflows): convert hardcoded repo lists to read from repos.txt
audit-repo-health.md:
- All 9 steps now read from repos.txt dynamically
- Repos without relevant files (package.json, .dockerignore, etc.) are skipped
- No more manual maintenance when repos are added/removed

verify-all-backends.md:
- Remove duplicate learning_ai_notes entry
- Add learning_ai_efforise backend
- Add learning_ai_efforise client + learning_ai_local_llms dashboard to web checks

gitea-ci.md:
- Steps 3+4 read from repos.txt, skip repos without gitea remote
- Handle oss/ subdirectory repos via basename for Gitea API
2026-04-03 10:33:48 -07:00

95 lines
3.2 KiB
Markdown

---
description: Start Gitea local CI, check status, or push all repos to trigger CI runs
---
# Gitea Local CI Workflow
Manages the self-hosted Gitea + act_runner CI infrastructure for all ByteLyst repos.
See `docs/devops/GITEA_LOCAL_CI.md` for full documentation.
## 1. Ensure Gitea and act_runner are running
// turbo
```bash
brew services start gitea && brew services start act_runner && sleep 2 && brew services list | grep -E "gitea|act_runner"
```
## 2. Verify Gitea is responding
// turbo
```bash
curl -s http://localhost:3300/api/v1/version | python3 -c "import sys,json; print('Gitea', json.load(sys.stdin)['version'])"
```
## 3. Push all workspace repos to Gitea to trigger CI
This pushes `main` to the `gitea` remote for every repo that has one configured.
Each push triggers the `.gitea/workflows/ci.yml` workflow on the local runner.
```bash
REPOS_DIR="/Users/sd9235/code/mygh"
while IFS= read -r repo; do
[[ -z "$repo" || "$repo" =~ ^# ]] && continue
cd "$REPOS_DIR/$repo" 2>/dev/null || continue
# Skip repos without a gitea remote
git remote get-url gitea &>/dev/null || continue
echo "=== $repo ==="
git push gitea main 2>&1 | tail -2
done < /Users/sd9235/code/mygh/learning_ai_common_plat/.windsurf/workflows/repos.txt
```
## 4. Wait for jobs to process, then check results
Wait ~2 minutes per repo for the runner (capacity=1) to process the queue, then check results.
```bash
REPOS_DIR="/Users/sd9235/code/mygh"
while IFS= read -r repo; do
[[ -z "$repo" || "$repo" =~ ^# ]] && continue
cd "$REPOS_DIR/$repo" 2>/dev/null || continue
git remote get-url gitea &>/dev/null || continue
# Use basename for Gitea API (oss/learning_ai_claw-cowork → learning_ai_claw-cowork)
repo_name=$(basename "$repo")
echo "=== $repo ==="
curl -s -u "bytelyst:bytelyst123" "http://localhost:3300/api/v1/repos/bytelyst/$repo_name/actions/jobs" | python3 -c "
import sys, json
jobs = json.load(sys.stdin).get('jobs', [])
if not jobs:
print(' (no jobs)')
else:
max_run = max(j['run_id'] for j in jobs)
for j in jobs:
if j['run_id'] == max_run:
c = j.get('conclusion','pending')
icon = '✅' if c == 'success' else '❌' if c == 'failure' else '⏳'
print(f' {icon} {c:12} {j[\"name\"]}')
" 2>/dev/null
done < /Users/sd9235/code/mygh/learning_ai_common_plat/.windsurf/workflows/repos.txt
```
## 5. (Optional) View logs for a failing job
Replace REPO and JOB_ID with the repo name and job number from step 4.
```bash
REPO="learning_ai_clock"
JOB_ID="76"
curl -s -u "bytelyst:bytelyst123" "http://localhost:3300/api/v1/repos/bytelyst/$REPO/actions/jobs/$JOB_ID/logs" | tail -30
```
## 6. (Optional) Stop Gitea services
```bash
brew services stop act_runner && brew services stop gitea
```
## Troubleshooting
- **Runner not picking up jobs:** `brew services restart act_runner`
- **Runner still queued after restart:** re-register against `http://127.0.0.1:3300` instead of `http://localhost:3300`
- **Stale .next/lock:** `rm -f /Users/sd9235/code/mygh/learning_ai_common_plat/dashboards/*-web/.next/lock`
- **Permission denied on tsc:** `chmod +x /Users/sd9235/code/mygh/learning_ai_common_plat/node_modules/.bin/*`
- **Check runner log:** `tail -30 /opt/homebrew/var/log/act_runner.err`