From f8895f3c84227653a27461fb67a1c3bc543172a2 Mon Sep 17 00:00:00 2001 From: thewh1teagle <61390950+thewh1teagle@users.noreply.github.com> Date: Tue, 20 Aug 2024 15:46:22 +0300 Subject: [PATCH 1/4] feat: add ci test --- .github/workflows/test.yml | 89 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000000..dcc0ece585d --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,89 @@ +name: Test +on: [push, pull_request, workflow_dispatch] + +env: + MODEL_URL: https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-tiny.bin + MODEL_FILENAME: ggml-tiny.bin + AUDIO_URL: https://github.com/ggerganov/whisper.cpp/raw/master/samples/jfk.wav + AUDIO_FILENAME: jfk.wav + +jobs: + test: + permissions: + contents: write + strategy: + fail-fast: false + matrix: + include: + # macOS + + - platform: "macos-latest" + name: "MacOS (Arm) - aarch64" + cmake-args: "-DGGML_CCACHE=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DGGML_STATIC=ON" + + # Linux + - platform: "ubuntu-24.04" + name: "Ubuntu 24.04 - x86_64" + cmake-args: "-DGGML_CCACHE=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DGGML_STATIC=ON" + + - platform: "ubuntu-24.04" + name: "Ubuntu 24.04 - x86_64 - Vulkan" + cmake-args: "-DGGML_VULKAN=ON -DGGML_CCACHE=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DGGML_STATIC=ON" + + # Windows + - platform: "windows-latest" + name: "Windows - x86_64" + cmake-args: "-DGGML_CCACHE=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DGGML_STATIC=ON" + + - platform: "windows-latest" + name: "Windows - x86_64 - Vulkan" + cmake-args: "-DGGML_VULKAN=ON -DGGML_CCACHE=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DGGML_STATIC=ON" + + runs-on: ${{ matrix.platform }} + name: ${{ matrix.name }} + steps: + - uses: actions/checkout@v4 + + - name: Prepare Vulkan SDK for Windows + run: | + C:\msys64\usr\bin\wget.exe https://sdk.lunarg.com/sdk/download/1.3.290.0/windows/VulkanSDK-1.3.290.0-Installer.exe -O vulkan.exe + .\vulkan.exe --root C:\vulkan --accept-licenses --default-answer --confirm-command install + echo "VULKAN_SDK=C:\vulkan" >> $env:GITHUB_ENV + Copy-Item -Path "C:\vulkan\Bin\*.dll" -Destination "." -Recurse + if: ${{ contains(matrix.platform, 'windows') && contains(matrix.cmake-args, 'DGGML_VULKAN=ON') }} + + - name: Prepare Vulkan SDK for Linux + run: | + wget -qO- https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo tee /etc/apt/trusted.gpg.d/lunarg.asc + sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-noble.list http://packages.lunarg.com/vulkan/lunarg-vulkan-noble.list + sudo apt update + sudo apt install vulkan-sdk -y + sudo apt-get install -y mesa-vulkan-drivers + if: ${{ contains(matrix.platform, 'ubuntu') && contains(matrix.cmake-args, 'DGGML_VULKAN=ON') }} + + - name: Download assets on Windows + if: contains(matrix.platform, 'windows') + run: | + C:\msys64\usr\bin\wget.exe ${{ env.MODEL_URL }} + C:\msys64\usr\bin\wget.exe ${{ env.AUDIO_URL }} + + - name: Download assets on Linux + if: contains(matrix.platform, 'windows') == false + run: | + wget ${{ env.MODEL_URL }} + wget ${{ env.AUDIO_URL }} + + - name: Build + run: | + cmake -B build ${{ matrix.cmake-args }} + cmake --build build --target main --config Release + + - name: Test Windows + if: contains(matrix.platform, 'windows') + run: | + .\build\bin\Release\main -m ${{ env.MODEL_FILENAME }} -f ${{ env.AUDIO_FILENAME }} + + - name: Test Unix + if: ${{ contains(matrix.platform, 'ubuntu') || contains(matrix.platform, 'macos') }} + run: | + ./build/bin/main -m ${{ env.MODEL_FILENAME }} -f ${{ env.AUDIO_FILENAME }} \ No newline at end of file From ba06c350dd3b19876bf82529d2f9cce9a09cc60d Mon Sep 17 00:00:00 2001 From: thewh1teagle <61390950+thewh1teagle@users.noreply.github.com> Date: Mon, 26 Aug 2024 12:26:25 +0300 Subject: [PATCH 2/4] feat: add test workflow inputs --- .github/workflows/test.yml | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dcc0ece585d..24af4c94cf1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,5 +1,16 @@ name: Test -on: [push, pull_request, workflow_dispatch] +on: + push: + pull_request: + workflow_dispatch: + inputs: + cmake_build_type: + required: false + default: Debug + type: choice + options: + - Debug + - Release env: MODEL_URL: https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-tiny.bin @@ -19,25 +30,25 @@ jobs: - platform: "macos-latest" name: "MacOS (Arm) - aarch64" - cmake-args: "-DGGML_CCACHE=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DGGML_STATIC=ON" + cmake-args: "-DGGML_CCACHE=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=${{ inputs.cmake_build_type }} -DGGML_STATIC=ON" # Linux - platform: "ubuntu-24.04" name: "Ubuntu 24.04 - x86_64" - cmake-args: "-DGGML_CCACHE=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DGGML_STATIC=ON" + cmake-args: "-DGGML_CCACHE=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=${{ inputs.cmake_build_type }} -DGGML_STATIC=ON" - platform: "ubuntu-24.04" name: "Ubuntu 24.04 - x86_64 - Vulkan" - cmake-args: "-DGGML_VULKAN=ON -DGGML_CCACHE=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DGGML_STATIC=ON" + cmake-args: "-DGGML_VULKAN=ON -DGGML_CCACHE=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=${{ inputs.cmake_build_type }} -DGGML_STATIC=ON" # Windows - platform: "windows-latest" name: "Windows - x86_64" - cmake-args: "-DGGML_CCACHE=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DGGML_STATIC=ON" + cmake-args: "-DGGML_CCACHE=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=${{ inputs.cmake_build_type }} -DGGML_STATIC=ON" - platform: "windows-latest" name: "Windows - x86_64 - Vulkan" - cmake-args: "-DGGML_VULKAN=ON -DGGML_CCACHE=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DGGML_STATIC=ON" + cmake-args: "-DGGML_VULKAN=ON -DGGML_CCACHE=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=${{ inputs.cmake_build_type }} -DGGML_STATIC=ON" runs-on: ${{ matrix.platform }} name: ${{ matrix.name }} @@ -76,12 +87,12 @@ jobs: - name: Build run: | cmake -B build ${{ matrix.cmake-args }} - cmake --build build --target main --config Release + cmake --build build --target main --config ${{ inputs.cmake_build_type }} - name: Test Windows if: contains(matrix.platform, 'windows') run: | - .\build\bin\Release\main -m ${{ env.MODEL_FILENAME }} -f ${{ env.AUDIO_FILENAME }} + .\build\bin\${{ inputs.cmake_build_type }}\main -m ${{ env.MODEL_FILENAME }} -f ${{ env.AUDIO_FILENAME }} - name: Test Unix if: ${{ contains(matrix.platform, 'ubuntu') || contains(matrix.platform, 'macos') }} From 3641831fd6485e74b1d39735759229862f1a46ab Mon Sep 17 00:00:00 2001 From: thewh1teagle <61390950+thewh1teagle@users.noreply.github.com> Date: Mon, 26 Aug 2024 12:43:29 +0300 Subject: [PATCH 3/4] fix: set default cmake build type to test ci --- .github/workflows/test.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 24af4c94cf1..b68efb997d3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,13 +10,14 @@ on: type: choice options: - Debug - - Release + - Release env: MODEL_URL: https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-tiny.bin MODEL_FILENAME: ggml-tiny.bin AUDIO_URL: https://github.com/ggerganov/whisper.cpp/raw/master/samples/jfk.wav AUDIO_FILENAME: jfk.wav + CMAKE_BUILD_TYPE: Debug jobs: test: @@ -55,6 +56,10 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Set default env variables + run: | + echo "CMAKE_BUILD_TYPE=${{ inputs.cmake_build_type || 'Debug' }}" >> $GITHUB_ENV + - name: Prepare Vulkan SDK for Windows run: | C:\msys64\usr\bin\wget.exe https://sdk.lunarg.com/sdk/download/1.3.290.0/windows/VulkanSDK-1.3.290.0-Installer.exe -O vulkan.exe @@ -87,12 +92,12 @@ jobs: - name: Build run: | cmake -B build ${{ matrix.cmake-args }} - cmake --build build --target main --config ${{ inputs.cmake_build_type }} + cmake --build build --target main --config ${{ env.CMAKE_BUILD_TYPE }} - name: Test Windows if: contains(matrix.platform, 'windows') run: | - .\build\bin\${{ inputs.cmake_build_type }}\main -m ${{ env.MODEL_FILENAME }} -f ${{ env.AUDIO_FILENAME }} + .\build\bin\${{ env.CMAKE_BUILD_TYPE }}\main -m ${{ env.MODEL_FILENAME }} -f ${{ env.AUDIO_FILENAME }} - name: Test Unix if: ${{ contains(matrix.platform, 'ubuntu') || contains(matrix.platform, 'macos') }} From 613f938ecf3070a67003b7c994df3cbbe7b52c19 Mon Sep 17 00:00:00 2001 From: thewh1teagle <61390950+thewh1teagle@users.noreply.github.com> Date: Mon, 26 Aug 2024 12:52:22 +0300 Subject: [PATCH 4/4] fix: add vulkan runtime to ci test --- .github/workflows/test.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b68efb997d3..1ca49a4e4e1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -66,6 +66,12 @@ jobs: .\vulkan.exe --root C:\vulkan --accept-licenses --default-answer --confirm-command install echo "VULKAN_SDK=C:\vulkan" >> $env:GITHUB_ENV Copy-Item -Path "C:\vulkan\Bin\*.dll" -Destination "." -Recurse + + # Add Vulkan runtime DLL to PATH + C:\msys64\usr\bin\wget https://sdk.lunarg.com/sdk/download/1.3.290.0/windows/VulkanRT-1.3.290.0-Components.zip -O vulkan_components.exe + 7z x vulkan_components.exe + echo "$pwd\VulkanRT-1.3.290.0-Components\x64" | Out-File -FilePath $env:GITHUB_PATH -Append + if: ${{ contains(matrix.platform, 'windows') && contains(matrix.cmake-args, 'DGGML_VULKAN=ON') }} - name: Prepare Vulkan SDK for Linux