✨ feat: enhance commit message skill with issue reference suggestions (related to #2)
Some checks failed
Go CI/CD Pipeline / Build and Test (push) Successful in 4m26s
Docker Build and Publish / Version Bump (push) Successful in 10m6s
Go CI/CD Pipeline / Lint and Format (push) Successful in 10m33s
Go CI/CD Pipeline / Version Management (push) Successful in 25s
Main Branch CI/CD (Optimized) / Build and Test (push) Failing after 4m2s
Main Branch CI/CD (Optimized) / Lint and Format (push) Successful in 4m41s
Main Branch CI/CD (Optimized) / Version Management and Docker Build (push) Has been skipped
Docker Build and Publish / Build and Push Docker Image (push) Failing after 5m1s
Some checks failed
Go CI/CD Pipeline / Build and Test (push) Successful in 4m26s
Docker Build and Publish / Version Bump (push) Successful in 10m6s
Go CI/CD Pipeline / Lint and Format (push) Successful in 10m33s
Go CI/CD Pipeline / Version Management (push) Successful in 25s
Main Branch CI/CD (Optimized) / Build and Test (push) Failing after 4m2s
Main Branch CI/CD (Optimized) / Lint and Format (push) Successful in 4m41s
Main Branch CI/CD (Optimized) / Version Management and Docker Build (push) Has been skipped
Docker Build and Publish / Build and Push Docker Image (push) Failing after 5m1s
This commit is contained in:
207
.gitea/workflows/main-branch-optimized.yaml
Normal file
207
.gitea/workflows/main-branch-optimized.yaml
Normal file
@@ -0,0 +1,207 @@
|
||||
---
|
||||
# DanceLessonsCoach Optimized Main Branch Workflow
|
||||
# Fast, efficient CI/CD with artifact sharing for main branch
|
||||
# Combines testing, version management, and Docker publishing
|
||||
|
||||
name: Main Branch CI/CD (Optimized)
|
||||
|
||||
on:
|
||||
workflow_dispatch: {}
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
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: Upload build artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: build-artifacts
|
||||
path: bin/
|
||||
retention-days: 1
|
||||
|
||||
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: 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-management:
|
||||
name: Version Management and Docker Build
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build-test, lint-format]
|
||||
if: github.ref == 'refs/heads/main'
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Download build artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: build-artifacts
|
||||
path: bin/
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: '1.26.1'
|
||||
|
||||
- name: Install swag (if needed)
|
||||
run: |
|
||||
if [ ! -f pkg/server/docs/swagger.json ]; then
|
||||
echo "📝 Generating Swagger documentation..."
|
||||
go install github.com/swaggo/swag/cmd/swag@latest
|
||||
cd pkg/server && go generate
|
||||
echo "✅ Swagger documentation generated"
|
||||
else
|
||||
echo "✅ Swagger documentation already exists, skipping generation"
|
||||
fi
|
||||
|
||||
- name: Analyze commit and bump version if needed
|
||||
id: version-bump
|
||||
run: |
|
||||
# Analyze last commit message
|
||||
LAST_COMMIT=$(git log -1 --pretty=%B | head -1)
|
||||
VERSION_BUMPED="false"
|
||||
|
||||
if echo "$LAST_COMMIT" | grep -q "^feat:"; then
|
||||
echo "🎯 Feature commit detected - bumping MINOR version"
|
||||
./scripts/version-bump.sh minor
|
||||
VERSION_BUMPED="true"
|
||||
elif echo "$LAST_COMMIT" | grep -q "^fix:"; then
|
||||
echo "🐛 Fix commit detected - bumping PATCH version"
|
||||
./scripts/version-bump.sh patch
|
||||
VERSION_BUMPED="true"
|
||||
elif echo "$LAST_COMMIT" | grep -q "BREAKING CHANGE"; then
|
||||
echo "💥 Breaking change detected - bumping MAJOR version"
|
||||
./scripts/version-bump.sh major
|
||||
VERSION_BUMPED="true"
|
||||
else
|
||||
echo "⏭️ No automatic version bump needed"
|
||||
fi
|
||||
|
||||
# Update swagger version regardless of bump
|
||||
source VERSION
|
||||
NEW_VERSION="$MAJOR.$MINOR.$PATCH${PRERELEASE:+-$PRERELEASE}"
|
||||
sed -i "s|// @version [0-9.]*|// @version $NEW_VERSION|" cmd/server/main.go
|
||||
|
||||
echo "version_bumped=$VERSION_BUMPED" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Commit version changes if bumped
|
||||
if: steps.version-bump.outputs.version_bumped == 'true'
|
||||
run: |
|
||||
git config --global user.name "CI Bot"
|
||||
git config --global user.email "ci@arcodange.fr"
|
||||
git add VERSION cmd/server/main.go
|
||||
git commit -m "chore: auto version bump [skip ci]" || echo "No changes to commit"
|
||||
git push
|
||||
|
||||
- name: Login to Gitea Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.CI_REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.PACKAGES_TOKEN }}
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Build and push Docker image
|
||||
run: |
|
||||
# Determine tags based on event type
|
||||
source VERSION
|
||||
IMAGE_VERSION="$MAJOR.$MINOR.$PATCH${PRERELEASE:+-$PRERELEASE}"
|
||||
|
||||
TAGS="$IMAGE_VERSION latest ${{ github.sha }}"
|
||||
echo "Building Docker image with tags: $TAGS"
|
||||
docker build -t dance-lessons-coach .
|
||||
|
||||
for TAG in $TAGS; do
|
||||
IMAGE_NAME="${{ env.CI_REGISTRY }}/${{ env.GITEA_ORG }}/${{ env.GITEA_REPO }}:$TAG"
|
||||
echo "Tagging and pushing: $IMAGE_NAME"
|
||||
docker tag dance-lessons-coach "$IMAGE_NAME"
|
||||
docker push "$IMAGE_NAME"
|
||||
done
|
||||
|
||||
- name: Show published images
|
||||
run: |
|
||||
source VERSION
|
||||
IMAGE_VERSION="$MAJOR.$MINOR.$PATCH${PRERELEASE:+-$PRERELEASE}"
|
||||
echo "📦 Published Docker images:"
|
||||
echo " - ${{ env.CI_REGISTRY }}/${{ env.GITEA_ORG }}/${{ env.GITEA_REPO }}:$IMAGE_VERSION"
|
||||
echo " - ${{ env.CI_REGISTRY }}/${{ env.GITEA_ORG }}/${{ env.GITEA_REPO }}:latest"
|
||||
echo " - ${{ env.CI_REGISTRY }}/${{ env.GITEA_ORG }}/${{ env.GITEA_REPO }}:${{ github.sha }}"
|
||||
Reference in New Issue
Block a user