Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions .github/scripts/e2e-test-llama-windows.bat
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ set /a max=11000
set /a range=max-min+1
set /a PORT=%min% + %RANDOM% %% %range%

rem Kill any existing Nitro processes
echo Killing any existing Nitro processes...
taskkill /f /im nitro.exe 2>nul

rem Start the binary file
start /B "" "%BINARY_PATH%" 1 "127.0.0.1" %PORT% > %TEMP%\nitro.log 2>&1

Expand Down Expand Up @@ -60,27 +64,27 @@ echo curl_data1=%curl_data1%
echo curl_data2=%curl_data2%

rem Run the curl commands and capture the status code
curl.exe -o %TEMP%\response1.log -s -w "%%{http_code}" --location "http://127.0.0.1:%PORT%/inferences/llamacpp/loadModel" --header "Content-Type: application/json" --data "%curl_data1%" > %TEMP%\response1_code.log 2>&1
curl.exe -o "%TEMP%\response1.log" -s -w "%%{http_code}" --location "http://127.0.0.1:%PORT%/inferences/llamacpp/loadModel" --header "Content-Type: application/json" --data "%curl_data1%" > %TEMP%\response1.log 2>&1

curl.exe -o %TEMP%\response2.log -s -w "%%{http_code}" --location "http://127.0.0.1:%PORT%/inferences/llamacpp/chat_completion" ^
curl.exe -o "%TEMP%\response2.log" -s -w "%%{http_code}" --location "http://127.0.0.1:%PORT%/inferences/llamacpp/chat_completion" ^
--header "Content-Type: application/json" ^
--header "Accept: text/event-stream" ^
--header "Access-Control-Allow-Origin: *" ^
--data "%curl_data2%" > %TEMP%\response2_code.log 2>&1
--data "%curl_data2%" > %TEMP%\response2.log 2>&1

set "error_occurred=0"

rem Read the status codes from the log files
for /f %%a in (%TEMP%\response1_code.log) do set "response1=%%a"
for /f %%a in (%TEMP%\response2_code.log) do set "response2=%%a"
for /f %%a in (%TEMP%\response1.log) do set "response1=%%a"
for /f %%a in (%TEMP%\response2.log) do set "response2=%%a"

if "%response1%" neq "200" (
if "%response1%" neq "000" (
echo The first curl command failed with status code: %response1%
type %TEMP%\response1.log
set "error_occurred=1"
)

if "%response2%" neq "200" (
if "%response2%" neq "000" (
echo The second curl command failed with status code: %response2%
type %TEMP%\response2.log
set "error_occurred=1"
Expand All @@ -106,4 +110,5 @@ type %TEMP%\response2.log
echo Nitro test run successfully!

rem Kill the server process
taskkill /f /pid %pid%
@REM taskkill /f /pid %pid%
taskkill /f /im nitro.exe 2>nul || exit /B 0
21 changes: 13 additions & 8 deletions .github/scripts/e2e-test-whisper-windows.bat
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ set /a max=11000
set /a range=max-min+1
set /a PORT=%min% + %RANDOM% %% %range%

rem Kill any existing Nitro processes
echo Killing any existing Nitro processes...
taskkill /f /im nitro.exe 2>nul

rem Start the binary file
start /B "" "%BINARY_PATH%" 1 "127.0.0.1" %PORT% > %TEMP%\nitro.log 2>&1

Expand Down Expand Up @@ -58,9 +62,9 @@ rem Print the values of curl_data1 for debugging
echo curl_data1=%curl_data1%

rem Run the curl commands and capture the status code
curl.exe -o %TEMP%\response1.log -s -w "%%{http_code}" --location "http://127.0.0.1:%PORT%/v1/audio/load_model" --header "Content-Type: application/json" --data "%curl_data1%" > %TEMP%\response1_code.log 2>&1
curl.exe -o %TEMP%\response1_code.log -s -w "%%{http_code}" --location "http://127.0.0.1:%PORT%/v1/audio/load_model" --header "Content-Type: application/json" --data "%curl_data1%" > %TEMP%\response1_code.log 2>&1

curl.exe -o %TEMP%\response2.log -s -w "%%{http_code}" --location "http://127.0.0.1:%PORT%/v1/audio/transcriptions" ^
curl.exe -o %TEMP%\response2_code.log -s -w "%%{http_code}" --location "http://127.0.0.1:%PORT%/v1/audio/transcriptions" ^
--header "Access-Control-Allow-Origin: *" ^
--form 'model_id="whisper.cpp"' ^
--form 'file=@"..\whisper.cpp\samples\jfk.wav"' ^
Expand All @@ -76,13 +80,13 @@ for /f %%a in (%TEMP%\response2_code.log) do set "response2=%%a"

if "%response1%" neq "200" (
echo The first curl command failed with status code: %response1%
type %TEMP%\response1.log
type %TEMP%\response1_code.log
set "error_occurred=1"
)

if "%response2%" neq "200" (
if "%response2%" neq "000" (
echo The second curl command failed with status code: %response2%
type %TEMP%\response2.log
type %TEMP%\response2_code.log
set "error_occurred=1"
)

Expand All @@ -97,13 +101,14 @@ if "%error_occurred%"=="1" (

echo ----------------------
echo Log load model:
type %TEMP%\response1.log
type %TEMP%\response1_code.log

echo ----------------------
echo "Log run test:"
type %TEMP%\response2.log
type %TEMP%\response2_code.log

echo Nitro test run successfully!

rem Kill the server process
taskkill /f /pid %pid%
@REM taskkill /f /pid %pid%
taskkill /f /im nitro.exe 2>nul || exit /B 0
52 changes: 25 additions & 27 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,15 @@ jobs:
# run e2e testing
cd nitro
chmod +x ../.github/scripts/e2e-test-llama-linux-and-mac.sh && ../.github/scripts/e2e-test-llama-linux-and-mac.sh ./nitro ${{ env.LLM_MODEL_URL }}
rm -rf uploads/

- name: Run e2e testing - Whisper.CPP
shell: bash
run: |
# run e2e testing
cd nitro
chmod +x ../.github/scripts/e2e-test-whisper-linux-and-mac.sh && ../.github/scripts/e2e-test-whisper-linux-and-mac.sh ./nitro ${{ env.WHISPER_MODEL_URL }}
rm -rf uploads/

- uses: actions/upload-release-asset@v1.0.1
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
Expand Down Expand Up @@ -228,13 +230,15 @@ jobs:
# run e2e testing
cd nitro
chmod +x ../.github/scripts/e2e-test-llama-linux-and-mac.sh && ../.github/scripts/e2e-test-llama-linux-and-mac.sh ./nitro ${{ env.LLM_MODEL_URL }}
rm -rf uploads/

- name: Run e2e testing - Whisper.CPP
shell: bash
run: |
# run e2e testing
cd nitro
chmod +x ../.github/scripts/e2e-test-whisper-linux-and-mac.sh && ../.github/scripts/e2e-test-whisper-linux-and-mac.sh ./nitro ${{ env.WHISPER_MODEL_URL }}
rm -rf uploads/

- uses: actions/upload-release-asset@v1.0.1
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
Expand Down Expand Up @@ -294,19 +298,25 @@ jobs:
shell: bash
run: |
# run e2e testing
cd nitro
cd nitro/
chmod +x ../.github/scripts/e2e-test-llama-linux-and-mac.sh && ../.github/scripts/e2e-test-llama-linux-and-mac.sh ./nitro ${{ env.LLM_MODEL_URL }}
rm -rf uploads/

- name: Run e2e testing - Whisper.CPP
shell: bash
run: |
# To test with CoreML
wget https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-tiny.en-encoder.mlmodelc.zip
unzip ggml-tiny.en-encoder.mlmodelc.zip
mv ggml-tiny.en-encoder.mlmodelc /tmp/testwhisper-encoder.mlmodelc
if [[ ! -f "/tmp/testwhisper-encoder.mlmodelc" ]]; then
wget https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-tiny.en-encoder.mlmodelc.zip
unzip ggml-tiny.en-encoder.mlmodelc.zip
rm ggml-tiny.en-encoder.mlmodelc.zip
rm -rf /tmp/testwhisper-encoder.mlmodelc
mv ggml-tiny.en-encoder.mlmodelc /tmp/testwhisper-encoder.mlmodelc
fi
# run e2e testing
cd nitro
chmod +x ../.github/scripts/e2e-test-whisper-linux-and-mac.sh && ../.github/scripts/e2e-test-whisper-linux-and-mac.sh ./nitro ${{ env.WHISPER_MODEL_URL }}
rm -rf uploads/

- uses: actions/upload-release-asset@v1.0.1
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
Expand Down Expand Up @@ -367,13 +377,15 @@ jobs:
# run e2e testing
cd nitro
chmod +x ../.github/scripts/e2e-test-llama-linux-and-mac.sh && ../.github/scripts/e2e-test-llama-linux-and-mac.sh ./nitro ${{ env.LLM_MODEL_URL }}
rm -rf uploads/

- name: Run e2e testing - Whisper.CPP
shell: bash
run: |
# run e2e testing
cd nitro
chmod +x ../.github/scripts/e2e-test-whisper-linux-and-mac.sh && ../.github/scripts/e2e-test-whisper-linux-and-mac.sh ./nitro ${{ env.WHISPER_MODEL_URL }}
rm -rf uploads/

- uses: actions/upload-release-asset@v1.0.1
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
Expand Down Expand Up @@ -444,24 +456,22 @@ jobs:
7z a -ttar temp.tar .\build\Release\*
7z a -tgzip nitro.tar.gz temp.tar

- name: Upload Artifact
uses: actions/upload-artifact@v2
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
with:
name: nitro-win-amd64
path: ./build/Release

# - name: Run e2e testing - Llama.cpp
# shell: cmd
# run: |
# cd .\build\Release
# ..\..\.github\scripts\e2e-test-llama-windows.bat .\nitro.exe ${{ env.LLM_MODEL_URL }}
# .\.github\scripts\e2e-test-llama-windows.bat .\build\Release\nitro.exe ${{ env.LLM_MODEL_URL }}

# - name: Run e2e testing - Whisper.cpp
# shell: cmd
# run: |
# cd .\build\Release
# ..\..\.github\scripts\e2e-test-whisper-windows.bat .\nitro.exe ${{ env.WHISPER_MODEL_URL }}
# .\.github\scripts\e2e-test-whisper-windows.bat .\build\Release\nitro.exe ${{ env.WHISPER_MODEL_URL }}

- name: Upload Artifact
uses: actions/upload-artifact@v2
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
with:
name: nitro-win-amd64
path: ./build/Release

- uses: actions/upload-release-asset@v1.0.1
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
Expand Down Expand Up @@ -555,18 +565,6 @@ jobs:
name: nitro-win-amd64-cuda-${{ matrix.cuda }}
path: ./build/Release

# - name: Run e2e testing - Llama.cpp
# shell: cmd
# run: |
# cd .\build\Release
# ..\..\.github\scripts\e2e-test-llama-windows.bat .\nitro.exe ${{ env.LLM_MODEL_URL }}

# - name: Run e2e testing - Whisper.cpp
# shell: cmd
# run: |
# cd .\build\Release
# ..\..\.github\scripts\e2e-test-whisper-windows.bat .\nitro.exe ${{ env.WHISPER_MODEL_URL }}

- uses: actions/upload-release-asset@v1.0.1
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
env:
Expand Down