# CI/CD Quick Reference

Fast reference for the Forgejo CI/CD pipeline.

---

## Trigger CI

```bash
# Push to main or develop
git push origin main
git push origin develop

# Create/update pull request
# Automatically triggers CI
```

---

## Local Pre-Commit Check

```bash
# Run all CI checks locally
./scripts/test-ci-locally.sh

# Individual checks
cd backend
cargo fmt --all -- --check        # Format check
cargo clippy --all-targets --all-features -- -D warnings  # Lint
cargo build --release             # Build
```

---

## Fix Common Issues

### Format Fail
```bash
cd backend
cargo fmt --all
git commit -am "style: auto-format"
```

### Clippy Fail
```bash
cd backend
cargo clippy --all-targets --all-features -- -D warnings
# Fix issues, then commit
```

---

## CI Jobs

| Job | Time | Purpose |
|-----|------|---------|
| format | ~10s | Check code formatting |
| clippy | ~30s | Run linter |
| build | ~60s | Build binary |
| docker-build | ~40s | Build Docker image |

**Total**: ~2.5 min (parallel execution)

---

## Monitor CI

URL: http://gitea.soliverez.com.ar/alvaro/normogen/actions

---

## Docker Build Details

- **Builder**: Docker Buildx v0.29.1
- **Service**: DinD (docker:dind)
- **Socket**: TCP (localhost:2375)
- **Cache**: BuildKit local cache
- **Images**: 
  - `normogen-backend:latest`
  - `normogen-backend:{sha}`

---

## Workflow File

`.forgejo/workflows/lint-and-build.yml`

---

## Documentation

- [Full Documentation](./CI-IMPROVEMENTS.md)
- [Implementation Summary](../CI-CD-IMPLEMENTATION-SUMMARY.md)
- [Original Pipeline](./FORGEJO-CI-CD-PIPELINE.md)
