---
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"
for repo in \
  learning_ai_common_plat \
  learning_voice_ai_agent \
  learning_multimodal_memory_agents \
  learning_ai_clock \
  learning_ai_fastgap \
  learning_ai_jarvis_jr \
  learning_ai_peakpulse \
  learning_ai_notes \
  learning_ai_flowmonk \
  learning_ai_trails \
  learning_ai_local_memory_gpt; do
  echo "=== $repo ==="
  cd "$REPOS_DIR/$repo"
  git push gitea main 2>&1 | tail -2
done
```

## 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"
for repo in \
  learning_ai_common_plat \
  learning_ai_clock \
  learning_ai_trails \
  learning_ai_flowmonk \
  learning_ai_notes \
  learning_ai_fastgap \
  learning_ai_jarvis_jr \
  learning_ai_peakpulse \
  learning_ai_local_memory_gpt \
  learning_voice_ai_agent \
  learning_multimodal_memory_agents; do
  echo "=== $repo ==="
  curl -s -u "bytelyst:bytelyst123" "http://localhost:3300/api/v1/repos/bytelyst/$repo/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
```

## 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`
- **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`
