mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 18:41:08 +02:00
feat(infra): add load testing + finalize CI/CD for Go and Hono services
Load testing: - k6 test suite for mana-sync (HTTP sync, WebSocket stress, mixed) - 3 scenarios: mixed workload, WebSocket-only, sync throughput - Custom metrics: push/pull latency, WS connect time, conflict count CI/CD: - Add 6 missing services to ci.yml: mana-sync, mana-notify, mana-api-gateway, mana-crawler, mana-media, mana-credits - Add same services to cd-macmini.yml for auto-deploy - Add mana-sync + mana-media to docker-validate.yml - Go services trigger on shared-go/ changes Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
1cb48b797a
commit
92557ee835
6 changed files with 642 additions and 8 deletions
32
.github/workflows/cd-macmini.yml
vendored
32
.github/workflows/cd-macmini.yml
vendored
|
|
@ -26,6 +26,14 @@ on:
|
|||
- all
|
||||
- matrix-web
|
||||
- mana-auth
|
||||
- mana-sync
|
||||
- mana-media
|
||||
- mana-notify
|
||||
- mana-api-gateway
|
||||
- mana-crawler
|
||||
- mana-credits
|
||||
- mana-search
|
||||
- mana-matrix-bot
|
||||
- chat-backend
|
||||
- chat-web
|
||||
- todo-backend
|
||||
|
|
@ -39,7 +47,6 @@ on:
|
|||
- mukke-web
|
||||
- storage-backend
|
||||
- storage-web
|
||||
- mana-matrix-bot
|
||||
|
||||
concurrency:
|
||||
group: cd-macmini
|
||||
|
|
@ -65,6 +72,13 @@ jobs:
|
|||
outputs:
|
||||
matrix-web: ${{ steps.changes.outputs.matrix-web }}
|
||||
mana-auth: ${{ steps.changes.outputs.mana-auth }}
|
||||
mana-sync: ${{ steps.changes.outputs.mana-sync }}
|
||||
mana-media: ${{ steps.changes.outputs.mana-media }}
|
||||
mana-notify: ${{ steps.changes.outputs.mana-notify }}
|
||||
mana-api-gateway: ${{ steps.changes.outputs.mana-api-gateway }}
|
||||
mana-crawler: ${{ steps.changes.outputs.mana-crawler }}
|
||||
mana-credits: ${{ steps.changes.outputs.mana-credits }}
|
||||
mana-search: ${{ steps.changes.outputs.mana-search }}
|
||||
chat-backend: ${{ steps.changes.outputs.chat-backend }}
|
||||
chat-web: ${{ steps.changes.outputs.chat-web }}
|
||||
todo-backend: ${{ steps.changes.outputs.todo-backend }}
|
||||
|
|
@ -121,6 +135,13 @@ jobs:
|
|||
|
||||
check_changes "matrix-web" "apps/matrix/apps/web/" "apps/matrix/packages/"
|
||||
check_changes "mana-auth" "services/mana-auth/"
|
||||
check_changes "mana-sync" "services/mana-sync/" "packages/shared-go/"
|
||||
check_changes "mana-media" "services/mana-media/"
|
||||
check_changes "mana-notify" "services/mana-notify/" "packages/shared-go/"
|
||||
check_changes "mana-api-gateway" "services/mana-api-gateway/" "packages/shared-go/"
|
||||
check_changes "mana-crawler" "services/mana-crawler/" "packages/shared-go/"
|
||||
check_changes "mana-credits" "services/mana-credits/"
|
||||
check_changes "mana-search" "services/mana-search/" "packages/shared-go/"
|
||||
check_changes "chat-backend" "apps/chat/apps/backend/" "apps/chat/packages/"
|
||||
check_changes "chat-web" "apps/chat/apps/web/" "apps/chat/packages/"
|
||||
check_changes "todo-backend" "apps/todo/apps/backend/" "apps/todo/packages/"
|
||||
|
|
@ -140,7 +161,7 @@ jobs:
|
|||
|
||||
# Check if anything needs deploying
|
||||
ANY="false"
|
||||
for svc in matrix-web mana-auth chat-backend chat-web todo-backend todo-web calendar-backend calendar-web clock-web contacts-backend contacts-web mukke-backend mukke-web storage-backend storage-web mana-matrix-bot mana-landing-builder; do
|
||||
for svc in matrix-web mana-auth mana-sync mana-media mana-notify mana-api-gateway mana-crawler mana-credits mana-search chat-backend chat-web todo-backend todo-web calendar-backend calendar-web clock-web contacts-backend contacts-web mukke-backend mukke-web storage-backend storage-web mana-matrix-bot mana-landing-builder; do
|
||||
val=$(grep "^$svc=" $GITHUB_OUTPUT | tail -1 | cut -d= -f2)
|
||||
if [ "$val" == "true" ]; then
|
||||
ANY="true"
|
||||
|
|
@ -203,6 +224,13 @@ jobs:
|
|||
# Build list from detected changes
|
||||
if [ "${{ needs.detect-changes.outputs.matrix-web }}" == "true" ]; then SERVICES="$SERVICES matrix-web"; fi
|
||||
if [ "${{ needs.detect-changes.outputs.mana-auth }}" == "true" ]; then SERVICES="$SERVICES mana-auth"; fi
|
||||
if [ "${{ needs.detect-changes.outputs.mana-sync }}" == "true" ]; then SERVICES="$SERVICES mana-sync"; fi
|
||||
if [ "${{ needs.detect-changes.outputs.mana-media }}" == "true" ]; then SERVICES="$SERVICES mana-media"; fi
|
||||
if [ "${{ needs.detect-changes.outputs.mana-notify }}" == "true" ]; then SERVICES="$SERVICES mana-notify"; fi
|
||||
if [ "${{ needs.detect-changes.outputs.mana-api-gateway }}" == "true" ]; then SERVICES="$SERVICES mana-api-gateway"; fi
|
||||
if [ "${{ needs.detect-changes.outputs.mana-crawler }}" == "true" ]; then SERVICES="$SERVICES mana-crawler"; fi
|
||||
if [ "${{ needs.detect-changes.outputs.mana-credits }}" == "true" ]; then SERVICES="$SERVICES mana-credits"; fi
|
||||
if [ "${{ needs.detect-changes.outputs.mana-search }}" == "true" ]; then SERVICES="$SERVICES mana-search"; fi
|
||||
if [ "${{ needs.detect-changes.outputs.chat-backend }}" == "true" ]; then SERVICES="$SERVICES chat-backend"; fi
|
||||
if [ "${{ needs.detect-changes.outputs.chat-web }}" == "true" ]; then SERVICES="$SERVICES chat-web"; fi
|
||||
if [ "${{ needs.detect-changes.outputs.todo-backend }}" == "true" ]; then SERVICES="$SERVICES todo-backend"; fi
|
||||
|
|
|
|||
223
.github/workflows/ci.yml
vendored
223
.github/workflows/ci.yml
vendored
|
|
@ -50,6 +50,12 @@ jobs:
|
|||
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
|
||||
outputs:
|
||||
mana-auth: ${{ steps.changes.outputs.mana-auth }}
|
||||
mana-sync: ${{ steps.changes.outputs.mana-sync }}
|
||||
mana-media: ${{ steps.changes.outputs.mana-media }}
|
||||
mana-notify: ${{ steps.changes.outputs.mana-notify }}
|
||||
mana-api-gateway: ${{ steps.changes.outputs.mana-api-gateway }}
|
||||
mana-crawler: ${{ steps.changes.outputs.mana-crawler }}
|
||||
mana-credits: ${{ steps.changes.outputs.mana-credits }}
|
||||
mana-search: ${{ steps.changes.outputs.mana-search }}
|
||||
manacore-web: ${{ steps.changes.outputs.manacore-web }}
|
||||
chat-backend: ${{ steps.changes.outputs.chat-backend }}
|
||||
|
|
@ -83,6 +89,12 @@ jobs:
|
|||
if [ "${{ github.event_name }}" == "workflow_dispatch" ] && [ "${{ inputs.force_build_all }}" == "true" ]; then
|
||||
echo "Force rebuild all services requested"
|
||||
echo "mana-auth=true" >> $GITHUB_OUTPUT
|
||||
echo "mana-sync=true" >> $GITHUB_OUTPUT
|
||||
echo "mana-media=true" >> $GITHUB_OUTPUT
|
||||
echo "mana-notify=true" >> $GITHUB_OUTPUT
|
||||
echo "mana-api-gateway=true" >> $GITHUB_OUTPUT
|
||||
echo "mana-crawler=true" >> $GITHUB_OUTPUT
|
||||
echo "mana-credits=true" >> $GITHUB_OUTPUT
|
||||
echo "mana-search=true" >> $GITHUB_OUTPUT
|
||||
echo "manacore-web=true" >> $GITHUB_OUTPUT
|
||||
echo "chat-backend=true" >> $GITHUB_OUTPUT
|
||||
|
|
@ -120,6 +132,12 @@ jobs:
|
|||
# workflow_dispatch without force - build all
|
||||
echo "Workflow dispatch without force_build_all - building all"
|
||||
echo "mana-auth=true" >> $GITHUB_OUTPUT
|
||||
echo "mana-sync=true" >> $GITHUB_OUTPUT
|
||||
echo "mana-media=true" >> $GITHUB_OUTPUT
|
||||
echo "mana-notify=true" >> $GITHUB_OUTPUT
|
||||
echo "mana-api-gateway=true" >> $GITHUB_OUTPUT
|
||||
echo "mana-crawler=true" >> $GITHUB_OUTPUT
|
||||
echo "mana-credits=true" >> $GITHUB_OUTPUT
|
||||
echo "mana-search=true" >> $GITHUB_OUTPUT
|
||||
echo "manacore-web=true" >> $GITHUB_OUTPUT
|
||||
echo "chat-backend=true" >> $GITHUB_OUTPUT
|
||||
|
|
@ -187,6 +205,29 @@ jobs:
|
|||
echo "mana-search=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
# Go services (standalone — no COMMON trigger, only own path + shared-go)
|
||||
SHARED_GO_PATTERN="packages/shared-go/"
|
||||
SHARED_GO_CHANGED=$(check_pattern "$SHARED_GO_PATTERN")
|
||||
|
||||
for GO_SVC in mana-sync mana-notify mana-api-gateway mana-crawler; do
|
||||
SVC_CHANGED=$(check_pattern "services/${GO_SVC}/")
|
||||
if [ "$SVC_CHANGED" == "true" ] || [ "$SHARED_GO_CHANGED" == "true" ]; then
|
||||
echo "${GO_SVC}=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "${GO_SVC}=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
done
|
||||
|
||||
# Hono/Bun services (standalone — only own path)
|
||||
for HONO_SVC in mana-media mana-credits; do
|
||||
SVC_CHANGED=$(check_pattern "services/${HONO_SVC}/")
|
||||
if [ "$SVC_CHANGED" == "true" ]; then
|
||||
echo "${HONO_SVC}=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "${HONO_SVC}=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
done
|
||||
|
||||
# manacore-web: apps/manacore/apps/web + shared packages
|
||||
MANACORE_WEB_CHANGED=$(check_pattern "apps/manacore/apps/web/|apps/manacore/packages/")
|
||||
if [ "$COMMON_CHANGED" == "true" ] || [ "$SHARED_AUTH_CHANGED" == "true" ] || [ "$SHARED_UI_CHANGED" == "true" ] || [ "$SHARED_WEB_CHANGED" == "true" ] || [ "$MANACORE_WEB_CHANGED" == "true" ]; then
|
||||
|
|
@ -353,6 +394,12 @@ jobs:
|
|||
echo "| Service | Will Build |" >> $GITHUB_STEP_SUMMARY
|
||||
echo "|---------|------------|" >> $GITHUB_STEP_SUMMARY
|
||||
echo "| mana-auth | ${{ steps.changes.outputs.mana-auth }} |" >> $GITHUB_STEP_SUMMARY
|
||||
echo "| mana-sync | ${{ steps.changes.outputs.mana-sync }} |" >> $GITHUB_STEP_SUMMARY
|
||||
echo "| mana-media | ${{ steps.changes.outputs.mana-media }} |" >> $GITHUB_STEP_SUMMARY
|
||||
echo "| mana-notify | ${{ steps.changes.outputs.mana-notify }} |" >> $GITHUB_STEP_SUMMARY
|
||||
echo "| mana-api-gateway | ${{ steps.changes.outputs.mana-api-gateway }} |" >> $GITHUB_STEP_SUMMARY
|
||||
echo "| mana-crawler | ${{ steps.changes.outputs.mana-crawler }} |" >> $GITHUB_STEP_SUMMARY
|
||||
echo "| mana-credits | ${{ steps.changes.outputs.mana-credits }} |" >> $GITHUB_STEP_SUMMARY
|
||||
echo "| mana-search | ${{ steps.changes.outputs.mana-search }} |" >> $GITHUB_STEP_SUMMARY
|
||||
echo "| manacore-web | ${{ steps.changes.outputs.manacore-web }} |" >> $GITHUB_STEP_SUMMARY
|
||||
echo "| chat-backend | ${{ steps.changes.outputs.chat-backend }} |" >> $GITHUB_STEP_SUMMARY
|
||||
|
|
@ -498,6 +545,182 @@ jobs:
|
|||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
# Go services
|
||||
build-mana-sync:
|
||||
name: Build mana-sync
|
||||
runs-on: ubuntu-latest
|
||||
needs: detect-changes
|
||||
if: needs.detect-changes.outputs.mana-sync == 'true'
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: docker/setup-qemu-action@v3
|
||||
- uses: docker/setup-buildx-action@v3
|
||||
- uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- uses: docker/metadata-action@v5
|
||||
id: meta
|
||||
with:
|
||||
images: ghcr.io/${{ github.repository_owner }}/mana-sync
|
||||
tags: type=raw,value=latest
|
||||
- uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: services/mana-sync/Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
build-mana-notify:
|
||||
name: Build mana-notify
|
||||
runs-on: ubuntu-latest
|
||||
needs: detect-changes
|
||||
if: needs.detect-changes.outputs.mana-notify == 'true'
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: docker/setup-qemu-action@v3
|
||||
- uses: docker/setup-buildx-action@v3
|
||||
- uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- uses: docker/metadata-action@v5
|
||||
id: meta
|
||||
with:
|
||||
images: ghcr.io/${{ github.repository_owner }}/mana-notify
|
||||
tags: type=raw,value=latest
|
||||
- uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: services/mana-notify/Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
build-mana-api-gateway:
|
||||
name: Build mana-api-gateway
|
||||
runs-on: ubuntu-latest
|
||||
needs: detect-changes
|
||||
if: needs.detect-changes.outputs.mana-api-gateway == 'true'
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: docker/setup-qemu-action@v3
|
||||
- uses: docker/setup-buildx-action@v3
|
||||
- uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- uses: docker/metadata-action@v5
|
||||
id: meta
|
||||
with:
|
||||
images: ghcr.io/${{ github.repository_owner }}/mana-api-gateway
|
||||
tags: type=raw,value=latest
|
||||
- uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: services/mana-api-gateway/Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
build-mana-crawler:
|
||||
name: Build mana-crawler
|
||||
runs-on: ubuntu-latest
|
||||
needs: detect-changes
|
||||
if: needs.detect-changes.outputs.mana-crawler == 'true'
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: docker/setup-qemu-action@v3
|
||||
- uses: docker/setup-buildx-action@v3
|
||||
- uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- uses: docker/metadata-action@v5
|
||||
id: meta
|
||||
with:
|
||||
images: ghcr.io/${{ github.repository_owner }}/mana-crawler
|
||||
tags: type=raw,value=latest
|
||||
- uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: services/mana-crawler/Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
# Hono/Bun services
|
||||
build-mana-media:
|
||||
name: Build mana-media
|
||||
runs-on: ubuntu-latest
|
||||
needs: detect-changes
|
||||
if: needs.detect-changes.outputs.mana-media == 'true'
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: docker/setup-qemu-action@v3
|
||||
- uses: docker/setup-buildx-action@v3
|
||||
- uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- uses: docker/metadata-action@v5
|
||||
id: meta
|
||||
with:
|
||||
images: ghcr.io/${{ github.repository_owner }}/mana-media
|
||||
tags: type=raw,value=latest
|
||||
- uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: services/mana-media/apps/api
|
||||
file: services/mana-media/apps/api/Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
build-mana-credits:
|
||||
name: Build mana-credits
|
||||
runs-on: ubuntu-latest
|
||||
needs: detect-changes
|
||||
if: needs.detect-changes.outputs.mana-credits == 'true'
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: docker/setup-qemu-action@v3
|
||||
- uses: docker/setup-buildx-action@v3
|
||||
- uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- uses: docker/metadata-action@v5
|
||||
id: meta
|
||||
with:
|
||||
images: ghcr.io/${{ github.repository_owner }}/mana-credits
|
||||
tags: type=raw,value=latest
|
||||
- uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: services/mana-credits
|
||||
file: services/mana-credits/Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
build-manacore-web:
|
||||
name: Build manacore-web
|
||||
runs-on: ubuntu-latest
|
||||
|
|
|
|||
12
.github/workflows/docker-validate.yml
vendored
12
.github/workflows/docker-validate.yml
vendored
|
|
@ -82,11 +82,13 @@ jobs:
|
|||
# Job 2: Build representative Docker images
|
||||
# ===========================================
|
||||
# Builds a subset that covers all shared packages:
|
||||
# - mana-auth: covers auth service (Hono + Bun)
|
||||
# - mana-auth: covers Hono + Bun service pattern
|
||||
# - mana-sync: covers Go service pattern
|
||||
# - mana-media: covers Hono + Bun with Sharp/BullMQ
|
||||
# - todo-web: covers most shared-* web packages
|
||||
# - zitare-web: covers content packages, shared-pwa
|
||||
# - calendar-web: covers calendar shared packages
|
||||
# - todo-backend: covers NestJS backend pattern + shared packages
|
||||
# - todo-backend: covers app backend pattern
|
||||
# ===========================================
|
||||
build-docker-images:
|
||||
name: Build ${{ matrix.service }}
|
||||
|
|
@ -100,6 +102,12 @@ jobs:
|
|||
- service: mana-auth
|
||||
dockerfile: services/mana-auth/Dockerfile
|
||||
context: .
|
||||
- service: mana-sync
|
||||
dockerfile: services/mana-sync/Dockerfile
|
||||
context: .
|
||||
- service: mana-media
|
||||
dockerfile: services/mana-media/apps/api/Dockerfile
|
||||
context: services/mana-media/apps/api
|
||||
- service: todo-backend
|
||||
dockerfile: apps/todo/apps/backend/Dockerfile
|
||||
context: .
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue