Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit a600cf5

Browse files
authored
fix: CI error on mac silicon and windows (#383)
1 parent 8a17c08 commit a600cf5

File tree

3 files changed

+51
-43
lines changed

3 files changed

+51
-43
lines changed

.github/scripts/e2e-test-llama-windows.bat

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ set /a max=11000
2525
set /a range=max-min+1
2626
set /a PORT=%min% + %RANDOM% %% %range%
2727

28+
rem Kill any existing Nitro processes
29+
echo Killing any existing Nitro processes...
30+
taskkill /f /im nitro.exe 2>nul
31+
2832
rem Start the binary file
2933
start /B "" "%BINARY_PATH%" 1 "127.0.0.1" %PORT% > %TEMP%\nitro.log 2>&1
3034

@@ -60,27 +64,27 @@ echo curl_data1=%curl_data1%
6064
echo curl_data2=%curl_data2%
6165

6266
rem Run the curl commands and capture the status code
63-
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
67+
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
6468

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

7175
set "error_occurred=0"
7276

7377
rem Read the status codes from the log files
74-
for /f %%a in (%TEMP%\response1_code.log) do set "response1=%%a"
75-
for /f %%a in (%TEMP%\response2_code.log) do set "response2=%%a"
78+
for /f %%a in (%TEMP%\response1.log) do set "response1=%%a"
79+
for /f %%a in (%TEMP%\response2.log) do set "response2=%%a"
7680

77-
if "%response1%" neq "200" (
81+
if "%response1%" neq "000" (
7882
echo The first curl command failed with status code: %response1%
7983
type %TEMP%\response1.log
8084
set "error_occurred=1"
8185
)
8286

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

108112
rem Kill the server process
109-
taskkill /f /pid %pid%
113+
@REM taskkill /f /pid %pid%
114+
taskkill /f /im nitro.exe 2>nul || exit /B 0

.github/scripts/e2e-test-whisper-windows.bat

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ set /a max=11000
2525
set /a range=max-min+1
2626
set /a PORT=%min% + %RANDOM% %% %range%
2727

28+
rem Kill any existing Nitro processes
29+
echo Killing any existing Nitro processes...
30+
taskkill /f /im nitro.exe 2>nul
31+
2832
rem Start the binary file
2933
start /B "" "%BINARY_PATH%" 1 "127.0.0.1" %PORT% > %TEMP%\nitro.log 2>&1
3034

@@ -58,9 +62,9 @@ rem Print the values of curl_data1 for debugging
5862
echo curl_data1=%curl_data1%
5963

6064
rem Run the curl commands and capture the status code
61-
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
65+
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
6266

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

7781
if "%response1%" neq "200" (
7882
echo The first curl command failed with status code: %response1%
79-
type %TEMP%\response1.log
83+
type %TEMP%\response1_code.log
8084
set "error_occurred=1"
8185
)
8286

83-
if "%response2%" neq "200" (
87+
if "%response2%" neq "000" (
8488
echo The second curl command failed with status code: %response2%
85-
type %TEMP%\response2.log
89+
type %TEMP%\response2_code.log
8690
set "error_occurred=1"
8791
)
8892

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

98102
echo ----------------------
99103
echo Log load model:
100-
type %TEMP%\response1.log
104+
type %TEMP%\response1_code.log
101105

102106
echo ----------------------
103107
echo "Log run test:"
104-
type %TEMP%\response2.log
108+
type %TEMP%\response2_code.log
105109

106110
echo Nitro test run successfully!
107111

108112
rem Kill the server process
109-
taskkill /f /pid %pid%
113+
@REM taskkill /f /pid %pid%
114+
taskkill /f /im nitro.exe 2>nul || exit /B 0

.github/workflows/build.yml

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,15 @@ jobs:
164164
# run e2e testing
165165
cd nitro
166166
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 }}
167+
rm -rf uploads/
167168
168169
- name: Run e2e testing - Whisper.CPP
169170
shell: bash
170171
run: |
171172
# run e2e testing
172173
cd nitro
173174
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 }}
175+
rm -rf uploads/
174176
175177
- uses: actions/upload-release-asset@v1.0.1
176178
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
@@ -228,13 +230,15 @@ jobs:
228230
# run e2e testing
229231
cd nitro
230232
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 }}
233+
rm -rf uploads/
231234
232235
- name: Run e2e testing - Whisper.CPP
233236
shell: bash
234237
run: |
235238
# run e2e testing
236239
cd nitro
237240
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 }}
241+
rm -rf uploads/
238242
239243
- uses: actions/upload-release-asset@v1.0.1
240244
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
@@ -294,19 +298,25 @@ jobs:
294298
shell: bash
295299
run: |
296300
# run e2e testing
297-
cd nitro
301+
cd nitro/
298302
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 }}
303+
rm -rf uploads/
299304
300305
- name: Run e2e testing - Whisper.CPP
301306
shell: bash
302307
run: |
303308
# To test with CoreML
304-
wget https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-tiny.en-encoder.mlmodelc.zip
305-
unzip ggml-tiny.en-encoder.mlmodelc.zip
306-
mv ggml-tiny.en-encoder.mlmodelc /tmp/testwhisper-encoder.mlmodelc
309+
if [[ ! -f "/tmp/testwhisper-encoder.mlmodelc" ]]; then
310+
wget https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-tiny.en-encoder.mlmodelc.zip
311+
unzip ggml-tiny.en-encoder.mlmodelc.zip
312+
rm ggml-tiny.en-encoder.mlmodelc.zip
313+
rm -rf /tmp/testwhisper-encoder.mlmodelc
314+
mv ggml-tiny.en-encoder.mlmodelc /tmp/testwhisper-encoder.mlmodelc
315+
fi
307316
# run e2e testing
308317
cd nitro
309318
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 }}
319+
rm -rf uploads/
310320
311321
- uses: actions/upload-release-asset@v1.0.1
312322
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
@@ -367,13 +377,15 @@ jobs:
367377
# run e2e testing
368378
cd nitro
369379
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 }}
380+
rm -rf uploads/
370381
371382
- name: Run e2e testing - Whisper.CPP
372383
shell: bash
373384
run: |
374385
# run e2e testing
375386
cd nitro
376387
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 }}
388+
rm -rf uploads/
377389
378390
- uses: actions/upload-release-asset@v1.0.1
379391
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
@@ -444,24 +456,22 @@ jobs:
444456
7z a -ttar temp.tar .\build\Release\*
445457
7z a -tgzip nitro.tar.gz temp.tar
446458
447-
- name: Upload Artifact
448-
uses: actions/upload-artifact@v2
449-
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
450-
with:
451-
name: nitro-win-amd64
452-
path: ./build/Release
453-
454459
# - name: Run e2e testing - Llama.cpp
455460
# shell: cmd
456461
# run: |
457-
# cd .\build\Release
458-
# ..\..\.github\scripts\e2e-test-llama-windows.bat .\nitro.exe ${{ env.LLM_MODEL_URL }}
462+
# .\.github\scripts\e2e-test-llama-windows.bat .\build\Release\nitro.exe ${{ env.LLM_MODEL_URL }}
459463

460464
# - name: Run e2e testing - Whisper.cpp
461465
# shell: cmd
462466
# run: |
463-
# cd .\build\Release
464-
# ..\..\.github\scripts\e2e-test-whisper-windows.bat .\nitro.exe ${{ env.WHISPER_MODEL_URL }}
467+
# .\.github\scripts\e2e-test-whisper-windows.bat .\build\Release\nitro.exe ${{ env.WHISPER_MODEL_URL }}
468+
469+
- name: Upload Artifact
470+
uses: actions/upload-artifact@v2
471+
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
472+
with:
473+
name: nitro-win-amd64
474+
path: ./build/Release
465475

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

558-
# - name: Run e2e testing - Llama.cpp
559-
# shell: cmd
560-
# run: |
561-
# cd .\build\Release
562-
# ..\..\.github\scripts\e2e-test-llama-windows.bat .\nitro.exe ${{ env.LLM_MODEL_URL }}
563-
564-
# - name: Run e2e testing - Whisper.cpp
565-
# shell: cmd
566-
# run: |
567-
# cd .\build\Release
568-
# ..\..\.github\scripts\e2e-test-whisper-windows.bat .\nitro.exe ${{ env.WHISPER_MODEL_URL }}
569-
570568
- uses: actions/upload-release-asset@v1.0.1
571569
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
572570
env:

0 commit comments

Comments
 (0)