🤖 feat: implement trunk-based CI/CD with local testing

- Designed trunk-based development workflow with branch protection
- Added workflow validation job to prevent main branch breaks
- Integrated act (GitHub Actions runner) for local Gitea workflow testing
- Created unified CI/CD script interface (scripts/cicd.sh)
- Added YAML lint configuration with practical limits (400 chars)
- Organized all CI/CD scripts under scripts/cicd/ directory
- Confirmed Gitea/GitHub Actions compatibility via local testing
- Updated ADR 0017 with implementation details and test results
- Enhanced documentation with local development workflow

See ADR-0017 for complete trunk-based development workflow documentation.
See ADR-0016 for CI/CD pipeline design.
This commit is contained in:
2026-04-05 23:07:32 +02:00
parent e55c92735d
commit b391534f2d
25 changed files with 2347 additions and 13 deletions

View File

@@ -1,6 +1,12 @@
# DanceLessonsCoach
[![Build Status](https://gitea.arcodange.fr/api/badges/arcodange/DanceLessonsCoach/status)](https://gitea.arcodange.fr/arcodange/DanceLessonsCoach)
[![Go Report Card](https://goreportcard.com/badge/github.com/arcodange/DanceLessonsCoach)](https://goreportcard.com/report/github.com/arcodange/DanceLessonsCoach)
[![Version](https://img.shields.io/badge/version-1.1.1-blue.svg)](https://gitea.arcodange.fr/arcodange/DanceLessonsCoach/releases)
[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
A Go project demonstrating idiomatic package structure, CLI implementation, and JSON API with Chi router.
=======
## Features
@@ -34,6 +40,45 @@ cd DanceLessonsCoach
go run ./cmd/greet
```
## CI/CD Pipeline
DanceLessonsCoach includes a portable CI/CD pipeline using GitHub Actions syntax:
### Features
-**Multi-platform**: Works on Gitea, GitHub, and GitLab
-**Build & Test**: Automated Go builds and tests
-**Linting**: Code quality checks with `go fmt` and `go vet`
-**Version Management**: Automatic version detection
-**Portable**: Uses standard GitHub Actions workflow format
### Workflow File
```yaml
# .github/workflows/main.yml
jobs:
build-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: '1.26.1'
- run: go build ./...
- run: go test ./... -cover
lint-format:
runs-on: ubuntu-latest
steps:
- run: go fmt ./...
- run: go vet ./...
```
### Setup Instructions
1. **Gitea**: Enable GitHub Actions compatibility in repo settings
2. **GitHub**: Push to mirror repository (workflow runs automatically)
3. **GitLab**: Convert workflow to `.gitlab-ci.yml` or use compatibility mode
**See [ADR 0016](adr/0016-ci-cd-pipeline-design.md) for complete CI/CD design and [STATUS_BADGES.md](STATUS_BADGES.md) for badge setup.**
## Configuration
Basic configuration options:
@@ -137,6 +182,36 @@ go test ./...
go test ./pkg/greet/
```
## CI/CD
DanceLessonsCoach includes a comprehensive CI/CD pipeline with multiple testing options:
### Local Testing (No Gitea Required)
```bash
# Validate workflow structure
./scripts/cicd.sh validate
# Test workflow steps locally
./scripts/cicd.sh test-simple
```
### Gitea Integration
```bash
# Test local setup with Gitea configuration
./scripts/cicd.sh test-local
# Check pipeline status on Gitea
./scripts/cicd.sh check-status
```
### Full CI/CD Testing
```bash
# Test with docker compose (requires Gitea runner)
./scripts/cicd.sh test-docker
```
**See [adr/0016-ci-cd-pipeline-design.md](adr/0016-ci-cd-pipeline-design.md) for complete CI/CD architecture.**
## Project Structure
```