mirror of
https://github.com/czlonkowski/n8n-mcp.git
synced 2026-04-04 16:43:11 +00:00
fix: delete missed benchmark-pr.yml workflow, fix flaky session test
- Remove benchmark-pr.yml that referenced deleted benchmark:ci script - Fix session-persistence round-trip test using timestamps closer to now to avoid edge cases exposed by removing retry:2 Conceived by Romuald Członkowski - www.aiadvisors.pl/en Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
176
.github/workflows/benchmark-pr.yml
vendored
176
.github/workflows/benchmark-pr.yml
vendored
@@ -1,176 +0,0 @@
|
|||||||
name: Benchmark PR Comparison
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
branches: [main]
|
|
||||||
paths-ignore:
|
|
||||||
- '**.md'
|
|
||||||
- '**.txt'
|
|
||||||
- 'docs/**'
|
|
||||||
- 'examples/**'
|
|
||||||
- '.github/FUNDING.yml'
|
|
||||||
- '.github/ISSUE_TEMPLATE/**'
|
|
||||||
- '.github/pull_request_template.md'
|
|
||||||
- '.gitignore'
|
|
||||||
- 'LICENSE*'
|
|
||||||
- 'ATTRIBUTION.md'
|
|
||||||
- 'SECURITY.md'
|
|
||||||
- 'CODE_OF_CONDUCT.md'
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
pull-requests: write
|
|
||||||
contents: read
|
|
||||||
statuses: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
benchmark-comparison:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout PR branch
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Setup Node.js
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: 20
|
|
||||||
cache: 'npm'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
# Run benchmarks on current branch
|
|
||||||
- name: Run current benchmarks
|
|
||||||
run: npm run benchmark:ci
|
|
||||||
|
|
||||||
- name: Save current results
|
|
||||||
run: cp benchmark-results.json benchmark-current.json
|
|
||||||
|
|
||||||
# Checkout and run benchmarks on base branch
|
|
||||||
- name: Checkout base branch
|
|
||||||
run: |
|
|
||||||
git checkout ${{ github.event.pull_request.base.sha }}
|
|
||||||
git status
|
|
||||||
|
|
||||||
- name: Install base dependencies
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Run baseline benchmarks
|
|
||||||
run: npm run benchmark:ci
|
|
||||||
continue-on-error: true
|
|
||||||
|
|
||||||
- name: Save baseline results
|
|
||||||
run: |
|
|
||||||
if [ -f benchmark-results.json ]; then
|
|
||||||
cp benchmark-results.json benchmark-baseline.json
|
|
||||||
else
|
|
||||||
echo '{"files":[]}' > benchmark-baseline.json
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Compare results
|
|
||||||
- name: Checkout PR branch again
|
|
||||||
run: git checkout ${{ github.event.pull_request.head.sha }}
|
|
||||||
|
|
||||||
- name: Compare benchmarks
|
|
||||||
id: compare
|
|
||||||
run: |
|
|
||||||
node scripts/compare-benchmarks.js benchmark-current.json benchmark-baseline.json || echo "REGRESSION=true" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
# Upload comparison artifacts
|
|
||||||
- name: Upload benchmark comparison
|
|
||||||
if: always()
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: benchmark-comparison-${{ github.run_number }}
|
|
||||||
path: |
|
|
||||||
benchmark-current.json
|
|
||||||
benchmark-baseline.json
|
|
||||||
benchmark-comparison.json
|
|
||||||
benchmark-comparison.md
|
|
||||||
retention-days: 30
|
|
||||||
|
|
||||||
# Post comparison to PR
|
|
||||||
- name: Post benchmark comparison to PR
|
|
||||||
if: always()
|
|
||||||
uses: actions/github-script@v7
|
|
||||||
continue-on-error: true
|
|
||||||
with:
|
|
||||||
script: |
|
|
||||||
try {
|
|
||||||
const fs = require('fs');
|
|
||||||
let comment = '## ⚡ Benchmark Comparison\n\n';
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (fs.existsSync('benchmark-comparison.md')) {
|
|
||||||
const comparison = fs.readFileSync('benchmark-comparison.md', 'utf8');
|
|
||||||
comment += comparison;
|
|
||||||
} else {
|
|
||||||
comment += 'Benchmark comparison could not be generated.';
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
comment += `Error reading benchmark comparison: ${error.message}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
comment += '\n\n---\n';
|
|
||||||
comment += `*[View full benchmark results](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})*`;
|
|
||||||
|
|
||||||
// Find existing comment
|
|
||||||
const { data: comments } = await github.rest.issues.listComments({
|
|
||||||
owner: context.repo.owner,
|
|
||||||
repo: context.repo.repo,
|
|
||||||
issue_number: context.issue.number,
|
|
||||||
});
|
|
||||||
|
|
||||||
const botComment = comments.find(comment =>
|
|
||||||
comment.user.type === 'Bot' &&
|
|
||||||
comment.body.includes('## ⚡ Benchmark Comparison')
|
|
||||||
);
|
|
||||||
|
|
||||||
if (botComment) {
|
|
||||||
await github.rest.issues.updateComment({
|
|
||||||
owner: context.repo.owner,
|
|
||||||
repo: context.repo.repo,
|
|
||||||
comment_id: botComment.id,
|
|
||||||
body: comment
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
await github.rest.issues.createComment({
|
|
||||||
owner: context.repo.owner,
|
|
||||||
repo: context.repo.repo,
|
|
||||||
issue_number: context.issue.number,
|
|
||||||
body: comment
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Failed to create/update PR comment:', error.message);
|
|
||||||
console.log('This is likely due to insufficient permissions for external PRs.');
|
|
||||||
console.log('Benchmark comparison has been saved to artifacts instead.');
|
|
||||||
}
|
|
||||||
|
|
||||||
# Add status check
|
|
||||||
- name: Set benchmark status
|
|
||||||
if: always()
|
|
||||||
uses: actions/github-script@v7
|
|
||||||
continue-on-error: true
|
|
||||||
with:
|
|
||||||
script: |
|
|
||||||
try {
|
|
||||||
const hasRegression = '${{ steps.compare.outputs.REGRESSION }}' === 'true';
|
|
||||||
const state = hasRegression ? 'failure' : 'success';
|
|
||||||
const description = hasRegression
|
|
||||||
? 'Performance regressions detected'
|
|
||||||
: 'No performance regressions';
|
|
||||||
|
|
||||||
await github.rest.repos.createCommitStatus({
|
|
||||||
owner: context.repo.owner,
|
|
||||||
repo: context.repo.repo,
|
|
||||||
sha: context.sha,
|
|
||||||
state: state,
|
|
||||||
target_url: `https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}`,
|
|
||||||
description: description,
|
|
||||||
context: 'benchmarks/regression-check'
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Failed to create commit status:', error.message);
|
|
||||||
console.log('This is likely due to insufficient permissions for external PRs.');
|
|
||||||
}
|
|
||||||
@@ -177,8 +177,8 @@ describe('N8NMCPEngine - Session Persistence', () => {
|
|||||||
const serverAny = server as any;
|
const serverAny = server as any;
|
||||||
|
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const createdAt = new Date(now.getTime() - 10 * 60 * 1000); // 10 minutes ago
|
const createdAt = new Date(now.getTime() - 60 * 1000); // 1 minute ago
|
||||||
const lastAccess = new Date(now.getTime() - 5 * 60 * 1000); // 5 minutes ago
|
const lastAccess = new Date(now.getTime() - 30 * 1000); // 30 seconds ago
|
||||||
|
|
||||||
serverAny.sessionMetadata['engine-session'] = {
|
serverAny.sessionMetadata['engine-session'] = {
|
||||||
createdAt,
|
createdAt,
|
||||||
|
|||||||
Reference in New Issue
Block a user