fix(semantic): SKIP_MODEL_LOAD throws error to signal degraded mode #192
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Workflow Security Tests | ||
|
Check failure on line 1 in .github/workflows/test-workflow.yml
|
||
| on: | ||
| push: | ||
| branches: [main, develop] | ||
| paths: | ||
| - 'services/workflow/**' | ||
| - '.github/workflows/test-workflow.yml' | ||
| pull_request: | ||
| branches: [main] | ||
| paths: | ||
| - 'services/workflow/**' | ||
| workflow_dispatch: | ||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
| services: | ||
| clickhouse: | ||
| image: clickhouse/clickhouse-server:latest | ||
| env: | ||
| CLICKHOUSE_USER: admin | ||
| CLICKHOUSE_PASSWORD: ${{ secrets.CI_CLICKHOUSE_PASSWORD || 'test-clickhouse-password-min-32-chars' }} | ||
| CLICKHOUSE_DB: n8n_logs | ||
| ports: | ||
| - 8123:8123 | ||
| - 9000:9000 | ||
| options: >- | ||
| --health-cmd "clickhouse-client --user admin --password ${{ secrets.CI_CLICKHOUSE_PASSWORD || 'test-clickhouse-password-min-32-chars' }} --query 'SELECT 1'" | ||
| --health-interval 10s | ||
| --health-timeout 5s | ||
| --health-retries 5 | ||
| n8n: | ||
| image: n8nio/n8n:latest | ||
| env: | ||
| N8N_PORT: 5678 | ||
| N8N_PROTOCOL: http | ||
| N8N_HOST: localhost | ||
| EXECUTIONS_MODE: regular | ||
| ports: | ||
| - 5678:5678 | ||
| options: >- | ||
| --health-cmd "wget --no-verbose --tries=1 --spider http://localhost:5678 || exit 1" | ||
| --health-interval 10s | ||
| --health-timeout 5s | ||
| --health-retries 5 | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Check workflow directory | ||
| id: workflow_dir | ||
| run: | | ||
| if [ -d services/workflow ]; then | ||
| echo "exists=true" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "::warning::services/workflow directory not found; skipping workflow tests." | ||
| echo "exists=false" >> "$GITHUB_OUTPUT" | ||
| fi | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '18' | ||
| cache: 'npm' | ||
| cache-dependency-path: services/workflow/package-lock.json | ||
| if: steps.workflow_dir.outputs.exists == 'true' | ||
| - name: Install dependencies | ||
| working-directory: services/workflow | ||
| run: npm ci | ||
| if: steps.workflow_dir.outputs.exists == 'true' | ||
| - name: Initialize ClickHouse database | ||
| env: | ||
| CLICKHOUSE_HOST: localhost | ||
| CLICKHOUSE_PORT: 8123 | ||
| CLICKHOUSE_USER: admin | ||
| CLICKHOUSE_PASSWORD: ${{ secrets.CI_CLICKHOUSE_PASSWORD || 'test-clickhouse-password-min-32-chars' }} | ||
| run: | | ||
| # Wait for ClickHouse to be ready | ||
| sleep 5 | ||
| # Create database and tables | ||
| cat services/monitoring/sql/01-create-tables.sql | \ | ||
| curl -u admin:${{ secrets.CI_CLICKHOUSE_PASSWORD || 'test-clickhouse-password-min-32-chars' }} \ | ||
| 'http://localhost:8123/' \ | ||
| --data-binary @- | ||
| # Verify tables created | ||
| curl -u admin:${{ secrets.CI_CLICKHOUSE_PASSWORD || 'test-clickhouse-password-min-32-chars' }} \ | ||
| 'http://localhost:8123/?query=SHOW+TABLES+FROM+n8n_logs' | ||
| if: steps.workflow_dir.outputs.exists == 'true' | ||
| - name: Wait for n8n to be ready | ||
| run: | | ||
| echo "Waiting for n8n service to be ready..." | ||
| # n8n service should be healthy thanks to health check | ||
| # Just verify it's accessible | ||
| for i in {1..30}; do | ||
| if curl -s http://localhost:5678 > /dev/null; then | ||
| echo "✅ n8n is ready!" | ||
| exit 0 | ||
| fi | ||
| echo "⏳ Waiting... ($i/30)" | ||
| sleep 2 | ||
| done | ||
| echo "❌ n8n failed to start" | ||
| exit 1 | ||
| if: steps.workflow_dir.outputs.exists == 'true' | ||
| - name: Import and activate workflow | ||
| working-directory: services/workflow | ||
| run: | | ||
| # TODO: Automate workflow import via n8n API | ||
| # For now, this requires manual activation | ||
| echo "⚠️ NOTE: Workflow must be manually activated in n8n UI" | ||
| echo "Skipping automated tests that require active workflow" | ||
| if: steps.workflow_dir.outputs.exists == 'true' | ||
| - name: Run tests (without webhook dependency) | ||
| working-directory: services/workflow | ||
| env: | ||
| CLICKHOUSE_HOST: localhost | ||
| CLICKHOUSE_HTTP_PORT: 8123 | ||
| CLICKHOUSE_USERNAME: admin | ||
| CLICKHOUSE_PASSWORD: ${{ secrets.CI_CLICKHOUSE_PASSWORD || 'test-clickhouse-password-min-32-chars' }} | ||
| RUN_LANGUAGE_DETECTOR_FALLBACK_TESTS: "false" | ||
| run: | | ||
| # Run only tests that don't require active n8n workflow | ||
| npm test -- --reporter=verbose --reporter=json --outputFile=test-results.json | ||
| if: steps.workflow_dir.outputs.exists == 'true' | ||
| - name: Upload test results | ||
| if: always() && steps.workflow_dir.outputs.exists == 'true' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: test-results | ||
| path: services/workflow/test-results.json | ||
| retention-days: 30 | ||
| - name: Generate coverage report | ||
| if: always() && steps.workflow_dir.outputs.exists == 'true' | ||
| working-directory: services/workflow | ||
| run: npm run test:coverage || true | ||
| - name: Upload coverage | ||
| if: always() && steps.workflow_dir.outputs.exists == 'true' | ||
| uses: codecov/codecov-action@v4 | ||
| with: | ||
| files: ./services/workflow/coverage/coverage-final.json | ||
| flags: workflow-tests | ||
| name: workflow-coverage | ||
| - name: Comment PR with test results | ||
| if: github.event_name == 'pull_request' && steps.workflow_dir.outputs.exists == 'true' | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const fs = require('fs'); | ||
| try { | ||
| const results = JSON.parse(fs.readFileSync('services/workflow/test-results.json', 'utf8')); | ||
| const passed = results.numPassedTests || 0; | ||
| const failed = results.numFailedTests || 0; | ||
| const total = results.numTotalTests || 0; | ||
| const body = `## Workflow Tests Results\n\n` + | ||
| `- ✅ Passed: ${passed}\n` + | ||
| `- ❌ Failed: ${failed}\n` + | ||
| `- 📊 Total: ${total}\n\n` + | ||
| `**Note:** Full E2E tests require manual workflow activation in n8n UI.`; | ||
| github.rest.issues.createComment({ | ||
| issue_number: context.issue.number, | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| body: body | ||
| }); | ||
| } catch (error) { | ||
| console.log('Could not post comment:', error.message); | ||
| } | ||