Files
dance-lessons-coach/.gitea/workflows/go-ci-cd.yaml
Gabriel Radureau 183933b43e
Some checks failed
Go CI/CD Pipeline / Lint and Format (push) Successful in 4m51s
Docker Build and Publish / Version Bump (push) Successful in 4m54s
Docker Build and Publish / Build and Push Docker Image (push) Failing after 2m51s
Go CI/CD Pipeline / Build and Test (push) Successful in 9m47s
Go CI/CD Pipeline / Version Management (push) Successful in 12s
feat: integrate swag fmt and improve CI/CD workflows
- Add swag fmt to git pre-commit hook and CI/CD pipeline
- Create comprehensive CONTRIBUTING.md guide with AI section
- Update ADR-0013 with swag fmt documentation
- Fix swagger generation to include all endpoints
- Improve local testing scripts and workflows
- Update Dockerfile for better swagger handling
- Fix CI/CD workflow file references
2026-04-06 15:36:55 +02:00

146 lines
3.6 KiB
YAML

---
# DanceLessonsCoach CI/CD Pipeline for Arcodange Gitea
# Follows Arcodange conventions from webapp workflow
# Uses .gitea/workflows/ directory and internal registry
name: Go CI/CD Pipeline
on:
workflow_dispatch: {}
push:
branches:
- main
- 'ci/**'
- 'feature/**'
- 'fix/**'
- 'refactor/**'
paths-ignore:
- 'README.md'
- 'doc/**'
- 'adr/**'
- '.gitea/**'
pull_request:
branches:
- main
types: [opened, synchronize, reopened, labeled]
paths-ignore:
- 'README.md'
- 'doc/**'
- 'adr/**'
- '.gitea/**'
# cancel any previously-started runs of this workflow on the same branch
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
# Arcodange-specific environment variables
env:
GITEA_INTERNAL: "https://gitea.arcodange.lab/"
GITEA_EXTERNAL: "https://gitea.arcodange.fr/"
GITEA_ORG: "arcodange"
GITEA_REPO: "DanceLessonsCoach"
CI_REGISTRY: "gitea.arcodange.lab"
jobs:
build-test:
name: Build and Test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.26.1'
cache: true
- name: Install dependencies
run: go mod tidy
- name: Install swag
run: go install github.com/swaggo/swag/cmd/swag@latest
- name: Generate Swagger Docs
run: cd pkg/server && go generate
- name: Build all packages
run: go build ./...
- name: Run tests with coverage
run: go test ./... -cover -v
- name: Build binaries
run: ./scripts/build.sh
- name: List artifacts
run: ls -la bin/
lint-format:
name: Lint and Format
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.26.1'
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.26.1'
- name: Install swag
run: go install github.com/swaggo/swag/cmd/swag@latest
- name: Run go fmt
run: go fmt ./...
- name: Run swag fmt
run: swag fmt
- name: Check for formatting issues
run: |
if [ -n "$(go fmt ./...)" ]; then
echo "❌ Formatting issues found"
exit 1
fi
echo "✅ Code is properly formatted"
version-check:
name: Version Management
runs-on: ubuntu-latest
needs: [build-test, lint-format]
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Show current version
run: |
source VERSION
echo "Version: $MAJOR.$MINOR.$PATCH${PRERELEASE:+-$PRERELEASE}"
echo "GITEA_REPO=$GITEA_ORG/$GITEA_REPO" >> $GITHUB_ENV
- name: Check for version bump candidates
run: |
echo "📋 Last commit analysis:"
git log -1 --pretty=%B | head -1
if git log -1 --pretty=%B | grep -q "^feat:"; then
echo "🎯 Feature commit detected - consider MINOR version bump"
elif git log -1 --pretty=%B | grep -q "^fix:"; then
echo "🐛 Fix commit detected - consider PATCH version bump"
elif git log -1 --pretty=%B | grep -q "BREAKING CHANGE"; then
echo "💥 Breaking change detected - consider MAJOR version bump"
else
echo "⏭️ No automatic version bump needed"
fi