# 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)\" }] }"