@@ -723,8 +723,83 @@ jobs:
723723 curl ${BASE_URL}/ping
724724 done
725725
726+ performance-test :
727+ needs :
728+ - smoke-test
729+ - deploy
730+ runs-on : ubuntu-latest
731+ if : ${{ !cancelled() && needs.smoke-test.result != 'failed' && github.event_name == 'pull_request' }}
732+ steps :
733+ - name : Install oha
734+ run : |
735+ wget https://github.com/hatoo/oha/releases/download/v0.5.8/oha-linux-amd64 -O oha
736+ chmod +x oha
737+ sudo mv oha /usr/local/bin/
738+
739+ - name : Run Performance Tests
740+ id : perf-test
741+ run : |
742+ # Create results directory
743+ mkdir -p test-results
744+
745+ # Run performance tests and save results
746+ echo "Running latency test (20 concurrent, 60s)..."
747+ oha -j --no-tui -c 20 -z 60s ${{ needs.deploy.outputs.url }}/ping > test-results/latency.json
748+
749+ echo "Running throughput test (100 concurrent, 60s)..."
750+ oha -j --no-tui -c 100 -z 60s ${{ needs.deploy.outputs.url }}/ping > test-results/throughput.json
751+
752+ # Parse results and create markdown table
753+ node -e '
754+ const fs = require("fs");
755+ const latencyResults = JSON.parse(fs.readFileSync("test-results/latency.json"));
756+ const throughputResults = JSON.parse(fs.readFileSync("test-results/throughput.json"));
757+
758+ const formatNumber = (num) => Number(num).toLocaleString(undefined, { maximumFractionDigits: 2 });
759+
760+ const table = [
761+ "### 🚀 Performance Test Results",
762+ "",
763+ "| Metric | Latency Test (20 concurrent) | Throughput Test (100 concurrent) |",
764+ "|--------|----------------------------|--------------------------------|",
765+ `| Total Requests | ${formatNumber(latencyResults.total)} | ${formatNumber(throughputResults.total)} |`,
766+ `| Requests/sec | ${formatNumber(latencyResults.rps)} | ${formatNumber(throughputResults.rps)} |`,
767+ `| Mean Latency | ${formatNumber(latencyResults.latency_percentiles["50"])}ms | ${formatNumber(throughputResults.latency_percentiles["50"])}ms |`,
768+ `| p95 Latency | ${formatNumber(latencyResults.latency_percentiles["95"])}ms | ${formatNumber(throughputResults.latency_percentiles["95"])}ms |`,
769+ `| p99 Latency | ${formatNumber(latencyResults.latency_percentiles["99"])}ms | ${formatNumber(throughputResults.latency_percentiles["99"])}ms |`,
770+ `| Max Latency | ${formatNumber(latencyResults.latency_percentiles["100"])}ms | ${formatNumber(throughputResults.latency_percentiles["100"])}ms |`,
771+ "",
772+ "_Note: Tests run against the /ping endpoint for 60 seconds each._",
773+ "",
774+ `*Last updated: ${new Date().toISOString()}*`
775+ ].join("\n");
776+
777+ fs.writeFileSync("test-results/table.md", table);
778+ '
779+
780+ # Save table content to outputs
781+ echo "performance_results<<EOF" >> $GITHUB_OUTPUT
782+ cat test-results/table.md >> $GITHUB_OUTPUT
783+ echo "EOF" >> $GITHUB_OUTPUT
784+
785+ - name : Find Performance Results Comment
786+ uses : peter-evans/find-comment@v3
787+ id : find-comment
788+ with :
789+ issue-number : ${{ github.event.pull_request.number }}
790+ comment-author : ' github-actions[bot]'
791+ body-includes : ' ### 🚀 Performance Test Results'
792+
793+ - name : Post Performance Results Comment
794+ uses : peter-evans/create-or-update-comment@v4
795+ with :
796+ comment-id : ${{ steps.find-comment.outputs.comment-id }}
797+ edit-mode : replace
798+ issue-number : ${{ github.event.pull_request.number }}
799+ body : ${{ steps.perf-test.outputs.performance_results }}
800+
726801 create-status-checks :
727- needs : [deploy, smoke-test]
802+ needs : [deploy, smoke-test, performance-test ]
728803 runs-on : ubuntu-latest
729804 if : ${{ !cancelled() && needs.deploy.result != 'failed' && github.event_name == 'pull_request' }}
730805 steps :
0 commit comments