11name : Chat Performance Comparison
22
33on :
4+ pull_request :
5+ paths :
6+ - ' .github/workflows/chat-perf.yml'
7+ schedule :
8+ # Every Friday at 12:00 AM PT (07:00 UTC)
9+ - cron : ' 0 7 * * 5'
410 workflow_dispatch :
511 inputs :
612 baseline_commit :
@@ -34,16 +40,22 @@ concurrency:
3440 group : chat-perf-${{ github.run_id }}
3541 cancel-in-progress : true
3642
43+ env :
44+ BASELINE_COMMIT : ${{ inputs.baseline_commit || '1.115.0' }}
45+ TEST_COMMIT : ${{ inputs.test_commit || 'main' }}
46+ PERF_RUNS : ${{ inputs.runs || 7 }}
47+ PERF_THRESHOLD : ${{ inputs.threshold || 0.2 }}
48+
3749jobs :
3850 chat-perf :
39- name : Chat Perf – ${{ inputs.baseline_commit }} vs ${{ inputs.test_commit }}
51+ name : Chat Perf – ${{ inputs.baseline_commit || '1.115.0' }} vs ${{ inputs.test_commit || 'main' }}
4052 runs-on : ubuntu-latest
4153 timeout-minutes : 120
4254 steps :
4355 - name : Checkout test commit
4456 uses : actions/checkout@v6
4557 with :
46- ref : ${{ inputs.test_commit }}
58+ ref : ${{ env.TEST_COMMIT }}
4759
4860 - name : Setup Node.js
4961 uses : actions/setup-node@v6
@@ -90,10 +102,10 @@ jobs:
90102 fi
91103
92104 xvfb-run node scripts/chat-perf/test-chat-perf-regression.js \
93- --baseline-build "${{ inputs.baseline_commit }}" \
94- --build "${{ inputs.test_commit }}" \
95- --runs ${{ inputs.runs }} \
96- --threshold ${{ inputs.threshold }} \
105+ --baseline-build "${{ env.BASELINE_COMMIT }}" \
106+ --build "${{ env.TEST_COMMIT }}" \
107+ --runs ${{ env.PERF_RUNS }} \
108+ --threshold ${{ env.PERF_THRESHOLD }} \
97109 --ci \
98110 $SCENARIO_ARGS \
99111 2>&1 | tee perf-output.log
@@ -102,6 +114,19 @@ jobs:
102114 exit ${PIPESTATUS[0]}
103115 continue-on-error : true
104116
117+ - name : Run memory leak check
118+ id : leak
119+ run : |
120+ xvfb-run node scripts/chat-perf/test-chat-mem-leaks.js \
121+ --build "${{ env.TEST_COMMIT }}" \
122+ --messages 10 \
123+ --threshold 2 \
124+ --verbose \
125+ 2>&1 | tee leak-output.log
126+
127+ exit ${PIPESTATUS[0]}
128+ continue-on-error : true
129+
105130 - name : Write job summary
106131 if : always()
107132 run : |
@@ -111,6 +136,15 @@ jobs:
111136 echo "⚠️ No summary file generated. Check perf-output.log artifact." >> "$GITHUB_STEP_SUMMARY"
112137 fi
113138
139+ if [[ -f .chat-perf-data/chat-perf-leak-results.json ]]; then
140+ echo "" >> "$GITHUB_STEP_SUMMARY"
141+ echo "## Memory Leak Check" >> "$GITHUB_STEP_SUMMARY"
142+ echo "" >> "$GITHUB_STEP_SUMMARY"
143+ echo '```json' >> "$GITHUB_STEP_SUMMARY"
144+ cat .chat-perf-data/chat-perf-leak-results.json >> "$GITHUB_STEP_SUMMARY"
145+ echo '```' >> "$GITHUB_STEP_SUMMARY"
146+ fi
147+
114148 - name : Zip diagnostic outputs
115149 if : always()
116150 run : |
@@ -123,6 +157,7 @@ jobs:
123157 "$(basename "$RUN_DIR")"/ \
124158 ci-summary.md \
125159 baseline-*.json \
160+ chat-perf-leak-results.json \
126161 2>/dev/null || true
127162 cd ..
128163 fi
@@ -131,14 +166,20 @@ jobs:
131166 if : always()
132167 uses : actions/upload-artifact@v7
133168 with :
134- name : chat-perf-${{ inputs.baseline_commit }}-vs-${{ inputs.test_commit }}
169+ name : chat-perf-${{ env.BASELINE_COMMIT }}-vs-${{ env.TEST_COMMIT }}
135170 path : |
136171 chat-perf-artifacts.zip
137172 perf-output.log
173+ leak-output.log
138174 retention-days : 30
139175
140176 - name : Fail on regression
141- if : steps.perf.outcome == 'failure'
177+ if : steps.perf.outcome == 'failure' || steps.leak.outcome == 'failure'
142178 run : |
143- echo "::error::Chat performance regression detected. See job summary for details."
179+ if [[ "${{ steps.perf.outcome }}" == "failure" ]]; then
180+ echo "::error::Chat performance regression detected. See job summary for details."
181+ fi
182+ if [[ "${{ steps.leak.outcome }}" == "failure" ]]; then
183+ echo "::error::Chat memory leak detected. See leak-output.log for details."
184+ fi
144185 exit 1
0 commit comments