@@ -723,8 +723,86 @@ 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 --no-tui -j -c 20 -z 60s ${{ needs.deploy.outputs.url }}/ping > test-results/latency.json
748+ cat test-results/latency.json
749+
750+ echo "Running throughput test (100 concurrent, 60s)..."
751+ oha --no-tui -j -c 100 -z 60s ${{ needs.deploy.outputs.url }}/ping > test-results/throughput.json
752+ cat test-results/throughput.json
753+
754+ # Parse results and create markdown table
755+ echo "Generating markdown table..."
756+ node -e '
757+ const fs = require("fs");
758+ const latencyResults = JSON.parse(fs.readFileSync("test-results/latency.json"));
759+ const throughputResults = JSON.parse(fs.readFileSync("test-results/throughput.json"));
760+
761+ const formatNumber = (num) => Number(num).toLocaleString(undefined, { maximumFractionDigits: 2 });
762+
763+ const table = [
764+ "### 🚀 Performance Test Results",
765+ "",
766+ "| Metric | Latency Test (20 concurrent) | Throughput Test (100 concurrent) |",
767+ "|--------|----------------------------|--------------------------------|",
768+ `| Total Requests | ${formatNumber(latencyResults.summary.total)} | ${formatNumber(throughputResults.summary.total)} |`,
769+ `| Requests/sec | ${formatNumber(latencyResults.summary.rps)} | ${formatNumber(throughputResults.summary.rps)} |`,
770+ `| Mean Latency | ${formatNumber(latencyResults.summary.average)}ms | ${formatNumber(throughputResults.summary.average)}ms |`,
771+ `| p95 Latency | ${formatNumber(latencyResults.latencyPercentiles.p95)}ms | ${formatNumber(throughputResults.latencyPercentiles.p95)}ms |`,
772+ `| p99 Latency | ${formatNumber(latencyResults.latencyPercentiles.p99)}ms | ${formatNumber(throughputResults.latencyPercentiles.p99)}ms |`,
773+ `| Max Latency | ${formatNumber(latencyResults.summary.slowest)}ms | ${formatNumber(throughputResults.summary.slowest)}ms |`,
774+ "",
775+ "_Note: Tests run against the /ping endpoint for 60 seconds each._",
776+ "",
777+ `*Last updated: ${new Date().toISOString()}*`
778+ ].join("\n");
779+
780+ fs.writeFileSync("test-results/table.md", table);
781+ '
782+
783+ # Save table content to outputs
784+ echo "performance_results<<EOF" >> $GITHUB_OUTPUT
785+ cat test-results/table.md >> $GITHUB_OUTPUT
786+ echo "EOF" >> $GITHUB_OUTPUT
787+
788+ - name : Find Performance Results Comment
789+ uses : peter-evans/find-comment@v3
790+ id : find-comment
791+ with :
792+ issue-number : ${{ github.event.pull_request.number }}
793+ comment-author : ' github-actions[bot]'
794+ body-includes : ' ### 🚀 Performance Test Results'
795+
796+ - name : Post Performance Results Comment
797+ uses : peter-evans/create-or-update-comment@v4
798+ with :
799+ comment-id : ${{ steps.find-comment.outputs.comment-id }}
800+ edit-mode : replace
801+ issue-number : ${{ github.event.pull_request.number }}
802+ body : ${{ steps.perf-test.outputs.performance_results }}
803+
726804 create-status-checks :
727- needs : [deploy, smoke-test]
805+ needs : [deploy, smoke-test, performance-test ]
728806 runs-on : ubuntu-latest
729807 if : ${{ !cancelled() && needs.deploy.result != 'failed' && github.event_name == 'pull_request' }}
730808 steps :
0 commit comments