1212 runs-on : ubuntu-latest
1313 outputs :
1414 should-test : ${{ steps.filter.outputs.code }}
15+ cpp-server : ${{ steps.filter.outputs.cpp_server }}
1516 steps :
1617 - uses : actions/checkout@v4
1718 - uses : dorny/paths-filter@v3
2324 - '**/requirements*.txt'
2425 - 'pyproject.toml'
2526 - '.github/workflows/*.yml'
27+ cpp_server:
28+ - 'tt-media-server/cpp_server/**'
2629
2730 lint :
2831 needs : detect-changes
3841 python-version : " 3.10"
3942
4043 - name : Install ruff
41- run : pip install ruff
44+ run : pip install ruff==0.15.0
4245
4346 - name : Run ruff linter
4447 run : ruff check .
@@ -434,13 +437,16 @@ jobs:
434437 pytest performance_tests/test_llm_streaming.py -sv 2>&1 | tee test_output.txt
435438 TEST_EXIT_CODE=${PIPESTATUS[0]}
436439
437- # Parse CI report metrics
438- TOKENS=$(grep 'tokens_received=' test_output.txt | cut -d= -f2 || echo "N/A")
439- TOTAL_TIME=$(grep 'total_time_ms=' test_output.txt | cut -d= -f2 || echo "N/A")
440- MEAN_INTERVAL=$(grep 'mean_interval_ms=' test_output.txt | cut -d= -f2 || echo "N/A")
441- THROUGHPUT=$(grep 'throughput_tps=' test_output.txt | cut -d= -f2 || echo "N/A")
442- OVERHEAD=$(grep 'overhead_ms=' test_output.txt | cut -d= -f2 || echo "N/A")
443- THRESHOLD=$(grep 'threshold_ms=' test_output.txt | cut -d= -f2 || echo "N/A")
440+ # Extract only the CI report section (between markers) to avoid matching source code
441+ sed -n '/::CI_REPORT_START::/,/::CI_REPORT_END::/p' test_output.txt > ci_report.txt
442+
443+ # Parse CI report metrics from the extracted section
444+ TOKENS=$(grep '^tokens_received=' ci_report.txt | cut -d= -f2 || echo "N/A")
445+ TOTAL_TIME=$(grep '^total_time_ms=' ci_report.txt | cut -d= -f2 || echo "N/A")
446+ MEAN_INTERVAL=$(grep '^mean_interval_ms=' ci_report.txt | cut -d= -f2 || echo "N/A")
447+ THROUGHPUT=$(grep '^throughput_tps=' ci_report.txt | cut -d= -f2 || echo "N/A")
448+ OVERHEAD=$(grep '^overhead_ms=' ci_report.txt | cut -d= -f2 || echo "N/A")
449+ THRESHOLD=$(grep '^threshold_ms=' ci_report.txt | cut -d= -f2 || echo "N/A")
444450
445451 # Determine status
446452 if [ $TEST_EXIT_CODE -eq 0 ]; then
@@ -463,8 +469,194 @@ jobs:
463469 echo "| **Overhead/Token** | ${OVERHEAD}ms (threshold: ${THRESHOLD}ms) |"
464470 } >> $GITHUB_STEP_SUMMARY
465471
466- exit $TEST_EXIT_CODE
472+ # Store exit code for later
473+ echo "TEST_EXIT_CODE=$TEST_EXIT_CODE" >> $GITHUB_ENV
474+
475+ - name : Show server logs
476+ if : always()
477+ run : |
478+ echo "=== Server Logs ==="
479+ if [ -f performance_tests/server.log ]; then
480+ cat performance_tests/server.log
481+ else
482+ echo "No server.log file found"
483+ fi
484+
485+ - name : Upload server logs
486+ if : always()
487+ uses : actions/upload-artifact@v4
488+ with :
489+ name : llm-streaming-server-logs
490+ path : tt-media-server/performance_tests/server.log
491+ retention-days : 1
492+ if-no-files-found : warn
493+
494+ - name : Check test result
495+ run : exit ${{ env.TEST_EXIT_CODE }}
496+
497+ cpp-server-ttnn-build :
498+ needs : detect-changes
499+ if : ${{ needs.detect-changes.outputs.cpp-server == 'true' }}
500+ name : C++ Server TTNN Build
501+ runs-on : ubuntu-latest
502+ permissions :
503+ contents : read
504+ env :
505+ PYTHONPATH : ${{ github.workspace }}/tt-media-server
506+ defaults :
507+ run :
508+ working-directory : tt-media-server
509+
510+ steps :
511+ - name : Checkout repository
512+ uses : actions/checkout@v4
513+
514+ - name : Install C++ build dependencies
515+ run : |
516+ sudo apt-get update -qq
517+ sudo apt-get install -y -qq cmake g++ pkg-config \
518+ libjsoncpp-dev uuid-dev zlib1g-dev
519+
520+ - name : Clone Drogon for build
521+ run : |
522+ mkdir -p cpp_server/deps
523+ git clone --depth 1 --branch v1.9.8 https://github.com/drogonframework/drogon.git cpp_server/deps/drogon
524+ cd cpp_server/deps/drogon
525+ git submodule update --init
526+ cd ../../..
527+
528+ - name : Build C++ server
529+ run : |
530+ cd cpp_server
531+ ./build.sh --ttnn
532+
533+ cpp-server-llm-streaming :
534+ needs : detect-changes
535+ if : ${{ needs.detect-changes.outputs.cpp-server == 'true' }}
536+ name : C++ Server LLM Streaming Performance Test
537+ runs-on : ubuntu-latest
538+ permissions :
539+ contents : read
540+ env :
541+ PYTHONPATH : ${{ github.workspace }}/tt-media-server
542+ defaults :
543+ run :
544+ working-directory : tt-media-server
545+
546+ steps :
547+ - name : Checkout repository
548+ uses : actions/checkout@v4
549+
550+ - name : Install C++ build dependencies
551+ run : |
552+ sudo apt-get update -qq
553+ sudo apt-get install -y -qq cmake g++ pkg-config \
554+ libjsoncpp-dev uuid-dev zlib1g-dev
555+
556+ - name : Clone Drogon for build
557+ run : |
558+ mkdir -p cpp_server/deps
559+ git clone --depth 1 --branch v1.9.8 https://github.com/drogonframework/drogon.git cpp_server/deps/drogon
560+ cd cpp_server/deps/drogon
561+ git submodule update --init
562+ cd ../../..
563+
564+ - name : Build C++ server
565+ run : |
566+ cd cpp_server
567+ ./build.sh --test
568+ cd ..
569+
570+ - name : Run C++ unit tests
571+ run : |
572+ cd cpp_server/build
573+ ctest --output-on-failure
574+ cd ../..
575+
576+ - name : Start C++ server (test runner mode)
577+ run : |
578+ cd cpp_server/build
579+ export TT_RUNNER_TYPE=llm_test
580+ export TEST_RUNNER_FREQUENCY_MS=1
581+ ./tt_media_server_cpp -p 8000 > ../../cpp_server.log 2>&1 &
582+ echo $! > ../../cpp_server.pid
583+ cd ../..
584+ for i in $(seq 1 30); do
585+ curl -sf http://127.0.0.1:8000/health | grep -q '"status"' && break
586+ sleep 1
587+ done
588+ curl -sf http://127.0.0.1:8000/health || exit 1
589+
590+ - name : Set up Python
591+ uses : actions/setup-python@v5
592+ with :
593+ python-version : " 3.10"
594+ cache : ' pip'
595+
596+ - name : Install Python test dependencies
597+ run : |
598+ pip install --upgrade pip
599+ pip install pytest pytest-asyncio aiohttp requests
600+
601+ - name : Run LLM Streaming test against C++ server
602+ env :
603+ EXTERNAL_LLM_SERVER : " 1"
604+ SERVER_BASE_URL : " http://127.0.0.1:8000"
605+ TEST_RUNNER_FREQUENCY_MS : " 1"
606+ run : |
607+ pytest performance_tests/test_llm_streaming.py -sv 2>&1 | tee test_output.txt
608+ TEST_EXIT_CODE=${PIPESTATUS[0]}
609+
610+ # Extract CI report and write job summary (same as llm-streaming-performance)
611+ sed -n '/::CI_REPORT_START::/,/::CI_REPORT_END::/p' test_output.txt > ci_report.txt
612+ TOKENS=$(grep '^tokens_received=' ci_report.txt | cut -d= -f2 || echo "N/A")
613+ TOTAL_TIME=$(grep '^total_time_ms=' ci_report.txt | cut -d= -f2 || echo "N/A")
614+ MEAN_INTERVAL=$(grep '^mean_interval_ms=' ci_report.txt | cut -d= -f2 || echo "N/A")
615+ THROUGHPUT=$(grep '^throughput_tps=' ci_report.txt | cut -d= -f2 || echo "N/A")
616+ OVERHEAD=$(grep '^overhead_ms=' ci_report.txt | cut -d= -f2 || echo "N/A")
617+ THRESHOLD=$(grep '^threshold_ms=' ci_report.txt | cut -d= -f2 || echo "N/A")
618+ if [ $TEST_EXIT_CODE -eq 0 ]; then STATUS="✅ PASSED"; else STATUS="❌ FAILED"; fi
619+ {
620+ echo "## 🚀 C++ Server LLM Streaming Test"
621+ echo ""
622+ echo "| Metric | Value |"
623+ echo "|--------|-------|"
624+ echo "| **Status** | $STATUS |"
625+ echo "| **Tokens Received** | $TOKENS |"
626+ echo "| **Total Time** | ${TOTAL_TIME}ms |"
627+ echo "| **Mean Interval** | ${MEAN_INTERVAL}ms |"
628+ echo "| **Throughput** | ${THROUGHPUT} tokens/s |"
629+ echo "| **Overhead/Token** | ${OVERHEAD}ms (threshold: ${THRESHOLD}ms) |"
630+ } >> $GITHUB_STEP_SUMMARY
631+
632+ echo "TEST_EXIT_CODE=$TEST_EXIT_CODE" >> $GITHUB_ENV
633+
634+ - name : Stop C++ server
635+ if : always()
636+ run : |
637+ [ -f cpp_server.pid ] && kill $(cat cpp_server.pid) 2>/dev/null || true
638+
639+ - name : Show server logs
640+ if : always()
641+ run : |
642+ echo "=== C++ Server Logs ==="
643+ if [ -f cpp_server.log ]; then
644+ cat cpp_server.log
645+ else
646+ echo "No cpp_server.log file found"
647+ fi
648+
649+ - name : Upload server logs
650+ if : always()
651+ uses : actions/upload-artifact@v4
652+ with :
653+ name : cpp-server-llm-streaming-logs
654+ path : tt-media-server/cpp_server.log
655+ retention-days : 1
656+ if-no-files-found : warn
467657
658+ - name : Check test result
659+ run : exit ${{ env.TEST_EXIT_CODE }}
468660
469661 forge-runner-changes :
470662 name : Detect Forge Runner Changes
0 commit comments