managarten/.github/workflows/daily-tests.yml
Till JS 774852ba2d feat(cutover): platform services build from ../mana, not from this repo
Part of the 8-Doppel-Cutover (2026-05-08, plan
~/.claude/plans/floating-swinging-flurry.md):

- docker-compose.{macmini,dev,test}.yml: build context for
  mana-{auth,credits,media,llm,notify} switched to ../mana/services/...
  so the Mac Mini stack pulls platform services from the platform repo
  (sibling clone), not from services/ in this monorepo.
- .npmrc + apps/api/{Dockerfile,package.json}: @mana/media-client now
  resolved from Verdaccio (npm.mana.how, ^0.1.0) instead of as a
  workspace COPY from services/mana-media/packages/client. Build-arg
  NPM_TOKEN flows through .npmrc for pnpm install auth. Required
  before services/mana-media/ can be deleted.
- .github/workflows/{ci,cd-macmini,daily-tests}.yml: removed the
  detect-/build-/test-jobs that targeted services/mana-{auth,credits,
  notify,media}/. Those services build out of the platform repo now —
  CI for them belongs in mana/-repo (open). cd-macmini's
  workflow_dispatch can still rebuild any of them on demand;
  auto-detect on path-change is gone for these five.
- scripts/{mac-mini/push-schemas.sh,run-integration-tests.sh}:
  rewritten to look in ../mana/ for the platform services.
- package.json dev:{auth,credits,notify,media}: paths point at
  ../mana/services/... so local dev still works post-cutover.

What this commit does NOT do: delete services/mana-{auth,credits,...}
from this repo. That waits for Phase 7 once the Mac Mini stack has
booted cleanly from the new build paths.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08 18:40:08 +02:00

155 lines
5.2 KiB
YAML

# Daily Test Execution - Simplified automated testing with Discord notifications
#
# Schedule: Runs daily at 2 AM UTC
# Manual Trigger: workflow_dispatch for on-demand test runs
# Features:
# - Integration tests (E2E flows)
# - mana-auth service tests with coverage
# - Database setup/teardown
# - Discord notifications (always sent on success or failure)
name: Daily Tests
on:
# Run daily at 2 AM UTC
schedule:
- cron: '0 2 * * *'
# Allow manual trigger
workflow_dispatch:
inputs:
coverage_threshold:
description: 'Minimum coverage percentage (default: 80)'
required: false
default: '80'
verbose:
description: 'Verbose test output'
type: boolean
required: false
default: false
concurrency:
group: daily-tests-${{ github.ref }}
cancel-in-progress: true
env:
NODE_VERSION: '20'
PNPM_VERSION: '9.15.0'
COVERAGE_THRESHOLD: ${{ github.event.inputs.coverage_threshold || '80' }}
jobs:
# NOTE 2026-05-08 — `test-mana-auth` (Coverage-Job) ist entfernt:
# mana-auth lebt seit dem 8-Doppel-Cutover im Schwester-Repo `mana/`.
# Der Coverage-Test gehört dort hin (Offener Punkt). `test-integration`
# wurde ebenfalls zur Plattform — siehe nächster Job.
# Job 2 (test-integration) ebenfalls entfernt — der frühere Job lief
# `services/mana-auth/test/integration`-Suite, die nach Phase 7 nicht
# mehr existiert. Gehört in den `mana/`-Repo-CI.
# Job 3: Always send Discord notification (success or failure)
notify:
name: Discord Notification
if: always()
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download coverage summary
uses: actions/download-artifact@v4
with:
name: coverage-mana-auth
path: coverage-mana-auth
continue-on-error: true
- name: Check test results
id: check
run: |
# Check if both jobs succeeded
AUTH_STATUS="${{ needs.test-mana-auth.result }}"
INTEGRATION_STATUS="${{ needs.test-integration.result }}"
if [ "$AUTH_STATUS" = "success" ] && [ "$INTEGRATION_STATUS" = "success" ]; then
echo "success=true" >> $GITHUB_OUTPUT
else
echo "success=false" >> $GITHUB_OUTPUT
fi
- name: Prepare notification data
id: prepare
run: |
# Get workflow run URL
RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
echo "run_url=$RUN_URL" >> $GITHUB_OUTPUT
# Get coverage if available
if [ -f "coverage-mana-auth/coverage-summary.json" ]; then
COVERAGE=$(node -e "const c = require('./coverage-mana-auth/coverage-summary.json'); console.log(c.total.lines.pct)")
echo "coverage=${COVERAGE}%" >> $GITHUB_OUTPUT
else
echo "coverage=N/A" >> $GITHUB_OUTPUT
fi
# Get date
DATE=$(date +%Y-%m-%d)
echo "date=$DATE" >> $GITHUB_OUTPUT
- name: Send Discord notification
if: env.DISCORD_WEBHOOK_URL != ''
env:
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
run: |
if [ "${{ steps.check.outputs.success }}" = "true" ]; then
TITLE="✅ Daily Tests Passed"
DESCRIPTION="All tests completed successfully!"
COLOR=3066993
else
TITLE="❌ Daily Tests Failed"
DESCRIPTION="Some tests failed. Please investigate."
COLOR=15158332
fi
curl -X POST "$DISCORD_WEBHOOK_URL" \
-H 'Content-Type: application/json' \
-d "{
\"username\": \"Mana CI/CD\",
\"avatar_url\": \"https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png\",
\"embeds\": [{
\"title\": \"$TITLE\",
\"description\": \"$DESCRIPTION\",
\"color\": $COLOR,
\"fields\": [
{
\"name\": \"📅 Date\",
\"value\": \"${{ steps.prepare.outputs.date }}\",
\"inline\": true
},
{
\"name\": \"📊 Coverage\",
\"value\": \"${{ steps.prepare.outputs.coverage }}\",
\"inline\": true
},
{
\"name\": \"🧪 mana-auth\",
\"value\": \"${{ needs.test-mana-auth.result }}\",
\"inline\": true
},
{
\"name\": \"🔗 Integration Tests\",
\"value\": \"${{ needs.test-integration.result }}\",
\"inline\": true
},
{
\"name\": \"🔗 Workflow Run\",
\"value\": \"[View Details](${{ steps.prepare.outputs.run_url }})\",
\"inline\": false
}
],
\"footer\": {
\"text\": \"Mana Monorepo\"
},
\"timestamp\": \"$(date -u +%Y-%m-%dT%H:%M:%SZ)\"
}]
}"