ci(gitea): add parallel workflow for backend frontend and infra checks

This commit is contained in:
WorkClub Automation
2026-03-06 22:02:28 +01:00
parent c543d3df1a
commit 53e2d57f2d
3 changed files with 371 additions and 0 deletions

152
.gitea/workflows/ci.yml Normal file
View File

@@ -0,0 +1,152 @@
name: CI Pipeline
on:
push:
branches: ["main", "develop", "feature/**"]
paths-ignore:
- "**.md"
- "docs/**"
- ".gitignore"
- "LICENSE"
pull_request:
branches: ["main"]
paths-ignore:
- "**.md"
- "docs/**"
- ".gitignore"
- "LICENSE"
workflow_dispatch:
jobs:
backend-ci:
name: Backend Build & Test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup .NET 10
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Restore NuGet cache
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('backend/**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Restore dependencies
working-directory: ./backend
run: dotnet restore WorkClub.slnx
- name: Build solution
working-directory: ./backend
run: dotnet build WorkClub.slnx --configuration Release --no-restore
- name: Run unit tests
working-directory: ./backend
run: dotnet test WorkClub.Tests.Unit/WorkClub.Tests.Unit.csproj --configuration Release --no-build --verbosity normal --logger "trx;LogFileName=unit-tests.trx"
- name: Run integration tests
working-directory: ./backend
run: dotnet test WorkClub.Tests.Integration/WorkClub.Tests.Integration.csproj --configuration Release --no-build --verbosity normal --logger "trx;LogFileName=integration-tests.trx"
- name: Upload test results on failure
if: failure()
uses: actions/upload-artifact@v3
with:
name: backend-test-results
path: backend/**/TestResults/*.trx
retention-days: 7
frontend-ci:
name: Frontend Lint, Test & Build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Restore Bun cache
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('frontend/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-
- name: Install dependencies
working-directory: ./frontend
run: bun install --frozen-lockfile
- name: Run linter
working-directory: ./frontend
run: bun run lint
- name: Run unit tests
working-directory: ./frontend
run: bun run test
- name: Build Next.js application
working-directory: ./frontend
run: bun run build
env:
NEXT_PUBLIC_API_URL: "http://localhost:5001"
NEXTAUTH_URL: "http://localhost:3000"
NEXTAUTH_SECRET: "ci-build-secret-not-used-at-runtime"
KEYCLOAK_CLIENT_ID: "workclub-app"
KEYCLOAK_CLIENT_SECRET: "ci-build-secret"
KEYCLOAK_ISSUER: "http://localhost:8080/realms/workclub"
- name: Upload build artifacts on failure
if: failure()
uses: actions/upload-artifact@v3
with:
name: frontend-build-logs
path: |
frontend/.next/
frontend/out/
retention-days: 7
infra-ci:
name: Infrastructure Validation
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Validate docker-compose.yml
run: docker compose config --quiet
- name: Setup Kustomize
uses: imranismail/setup-kustomize@v2
with:
kustomize-version: "5.4.1"
- name: Validate kustomize base
working-directory: ./infra/k8s
run: kustomize build base > /dev/null
- name: Validate kustomize dev overlay
working-directory: ./infra/k8s
run: kustomize build overlays/dev > /dev/null
- name: Upload validation errors on failure
if: failure()
uses: actions/upload-artifact@v3
with:
name: infra-validation-errors
path: |
docker-compose.yml
infra/k8s/**/*.yaml
retention-days: 7