feat(ci): add format check, PR validation, and Docker buildx
Some checks failed
Lint, Build, and Docker / Check Code Formatting (push) Failing after 42s
Lint, Build, and Docker / Run Clippy Linter (push) Failing after 2s
Lint, Build, and Docker / Build Rust Binary (push) Has been skipped
Lint, Build, and Docker / Build Docker Image (push) Has been skipped
Lint, Build, and Docker / CI Summary (push) Failing after 1s
Some checks failed
Lint, Build, and Docker / Check Code Formatting (push) Failing after 42s
Lint, Build, and Docker / Run Clippy Linter (push) Failing after 2s
Lint, Build, and Docker / Build Rust Binary (push) Has been skipped
Lint, Build, and Docker / Build Docker Image (push) Has been skipped
Lint, Build, and Docker / CI Summary (push) Failing after 1s
- Add cargo fmt --check to enforce code formatting
- Add pull_request trigger for PR validation
- Split workflow into parallel jobs (format, clippy, build, docker)
- Integrate Docker Buildx with DinD service
- Add BuildKit caching for faster builds
- Add local test script (scripts/test-ci-locally.sh)
- Add comprehensive documentation
All local CI checks pass ✅
This commit is contained in:
parent
a93a068233
commit
ef58c77d9c
5 changed files with 795 additions and 33 deletions
94
docs/development/CI-QUICK-REFERENCE.md
Normal file
94
docs/development/CI-QUICK-REFERENCE.md
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
# 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)
|
||||
Loading…
Add table
Add a link
Reference in a new issue