- Remove GitHub Actions workflow (.github/workflows/dotnet-ci.yml) - Create Woodpecker CI pipeline (.woodpecker.yml) - Configure pipeline with 3 stages: - build-and-test: runs on all branches, builds and runs unit/integration tests - docker-build: builds and pushes Docker image to git.lrhdev.dk on main - deploy: placeholder for deployment to deutsch.lrhdev.dk - Update infrastructure-setup.md to document Woodpecker configuration - Feature 1.1 (Infrastructure Setup) CI/CD tasks now complete for self-hosted setup Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
65 lines
1.9 KiB
YAML
65 lines
1.9 KiB
YAML
pipeline:
|
|
# Build and test stage
|
|
build-and-test:
|
|
image: mcr.microsoft.com/dotnet/sdk:9.0
|
|
commands:
|
|
# Restore dependencies
|
|
- dotnet restore GermanApp/GermanApp.csproj
|
|
|
|
# Build the backend
|
|
- dotnet build GermanApp/GermanApp.csproj --no-restore --configuration Release
|
|
|
|
# Run unit tests
|
|
- dotnet test Tests/GermanApp.Tests.Unit.csproj --no-build --configuration Release --verbosity normal
|
|
|
|
# Run integration tests
|
|
- dotnet test Tests/GermanApp.Tests.Integration.csproj --no-build --configuration Release --verbosity normal
|
|
when:
|
|
# Run on all branches
|
|
branch:
|
|
- main
|
|
- feature/*
|
|
- bugfix/*
|
|
- refactor/*
|
|
|
|
# Docker build and push stage
|
|
docker-build:
|
|
image: plugins/docker
|
|
settings:
|
|
dockerfile: GermanApp/Dockerfile
|
|
context: GermanApp
|
|
repo: git.lrhdev.dk/lasserh/deutschlernen
|
|
registry: git.lrhdev.dk
|
|
tags:
|
|
- latest
|
|
- ${CI_COMMIT_SHA:0:8}
|
|
username:
|
|
from_secret: docker_username
|
|
password:
|
|
from_secret: docker_password
|
|
when:
|
|
# Only build and push on main branch
|
|
branch:
|
|
- main
|
|
# Only run if build-and-test succeeded
|
|
status:
|
|
- success
|
|
|
|
# Deploy stage (placeholder - customize for your deployment)
|
|
deploy:
|
|
image: alpine
|
|
commands:
|
|
- echo "Deployment step"
|
|
- echo "Add your deployment commands here"
|
|
- echo "Example: ssh user@deutsch.lrhdev.dk 'cd /path/to/app && docker-compose pull && docker-compose up -d'"
|
|
when:
|
|
# Only deploy on main branch after successful docker-build
|
|
branch:
|
|
- main
|
|
status:
|
|
- success
|
|
|
|
# Woodpecker uses YAML similar to Drone CI
|
|
# Secrets need to be configured in the Woodpecker UI:
|
|
# - docker_username: Your Docker registry username
|
|
# - docker_password: Your Docker registry password/token
|