bump llama.cpp to b8209 #669
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build library | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| env: | |
| CUDA: 12.4.1 | |
| jobs: | |
| ################################ Linux ################################ | |
| linux-build: | |
| runs-on: ubuntu-22.04 | |
| strategy: | |
| matrix: | |
| include: | |
| - arch: linux-x64_noavx | |
| - arch: linux-x64_avx2 | |
| - arch: linux-x64_avx | |
| - arch: linux-x64_avx512 | |
| - arch: linux-x64_vulkan | |
| - arch: linux-x64_tinyblas | |
| - arch: linux-x64_cublas | |
| steps: | |
| - id: setup_libs_linux | |
| name: Dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential cmake zip libssl-dev git libcurl4-openssl-dev curl libgomp1 | |
| - id: checkout | |
| name: Clone | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - id: preparation | |
| name: Preparation | |
| run: | | |
| mkdir -p build/libs | |
| echo "CMAKE_VARS=-DARCHITECTURE=${{ matrix.arch }} -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${{ github.workspace }}/build/libs -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=${{ github.workspace }}/build/libs -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=${{ github.workspace }}/build/libs ${{ matrix.cmake_vars }}" >> $GITHUB_ENV | |
| shell: bash | |
| - id: setup_vulkan_linux | |
| if: contains(matrix.arch, 'vulkan') | |
| name: Dependencies Vulcan | |
| run: | | |
| wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add - | |
| sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-jammy.list https://packages.lunarg.com/vulkan/lunarg-vulkan-jammy.list | |
| sudo apt-get update -y | |
| sudo apt-get install -y build-essential vulkan-sdk | |
| - id: copy_vulkan_linux | |
| if: contains(matrix.arch, 'vulkan') | |
| name: Copy Vulcan | |
| run: | | |
| cp /lib/x86_64-linux-gnu/libvulkan.so.1 build/libs/ | |
| - id: setup_cuda_linux | |
| if: contains(matrix.arch, 'blas') | |
| uses: Jimver/cuda-toolkit@v0.2.15 | |
| with: | |
| cuda: ${{ env.CUDA }} | |
| linux-local-args: '["--toolkit"]' | |
| method: network | |
| - id: link_cuda_linux | |
| if: contains(matrix.arch, 'blas') | |
| name: Link Cuda | |
| run: | | |
| ln -s ${{ env.CUDA_PATH }} ${{ github.workspace }}/build/cuda | |
| echo "CUDAToolkit_ROOT=$GITHUB_WORKSPACE/build/cuda" >> $GITHUB_ENV | |
| echo "LD_LIBRARY_PATH=''" >> $GITHUB_ENV | |
| - id: cpu-cores | |
| name: Get number of CPU cores | |
| uses: SimenB/github-actions-cpu-cores@v2 | |
| - id: cmake_build | |
| name: Build | |
| run: | | |
| cd build | |
| cmake .. ${{ env.CMAKE_VARS }} | |
| cmake --build . --config Release -j ${{ steps.cpu-cores.outputs.count }} | |
| - id: test_build | |
| name: Test | |
| run: | | |
| flag=0 | |
| if [[ "$RUNNER_OS" == "macOS" ]]; then | |
| flag=1 | |
| else | |
| CPU_FLAGS=$(grep -o 'avx[^ ]*' /proc/cpuinfo | sort -u | tr '\n' ' ') | |
| ARCH="${{ matrix.arch }}" | |
| FEATURE="${ARCH##*_}" | |
| if echo "$CPU_FLAGS" | grep -qw "$FEATURE"; then | |
| flag=1 | |
| fi | |
| fi | |
| if [[ "$flag" == "1" ]]; then | |
| ./tests/download_test_models.sh | |
| cd build | |
| if [[ "$RUNNER_OS" == "Windows" ]]; then | |
| ./libs/Release/llamalib_tests.exe | |
| ./libs/Release/llamalib_tests_runtime.exe | |
| else | |
| ./libs/llamalib_tests | |
| ./libs/llamalib_tests_runtime | |
| fi | |
| fi | |
| shell: bash | |
| - id: pack_artifacts | |
| name: Pack artifacts | |
| run: | | |
| ls -R build | |
| mkdir -p artifacts | |
| mv build/Release/*llamalib* artifacts/ 2>/dev/null || true | |
| mv build/libs/*llamalib* artifacts/ 2>/dev/null || true | |
| mv build/libs/*.so* artifacts/ 2>/dev/null || true | |
| mv build/libs/Release/*llamalib* artifacts/ 2>/dev/null || true | |
| mv build/libs/Release/*.dll artifacts/ 2>/dev/null || true | |
| rm -f artifacts/*llamalib_tests* artifacts/*exp artifacts/*server*lib 2>/dev/null || true | |
| rm -r build | |
| cd artifacts | |
| if [[ "$RUNNER_OS" == "Windows" ]]; then | |
| 7z a ../${{ matrix.arch }}.zip * | |
| else | |
| zip ../${{ matrix.arch }}.zip * | |
| fi | |
| shell: bash | |
| - id: upload_llamalib | |
| name: Upload Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.arch }}.zip | |
| path: ${{ matrix.arch }}.zip | |
| ################################ macOS ################################ | |
| osx-arm64-build: | |
| runs-on: macos-15 | |
| strategy: | |
| matrix: | |
| include: | |
| - arch: osx-arm64_acc | |
| - arch: osx-arm64_no-acc | |
| steps: | |
| - continue-on-error: true | |
| id: setup_libs_macos | |
| name: Dependencies | |
| run: | | |
| echo "Architecture: $(uname -m)" | |
| echo "Operating System: $(uname -s)" | |
| brew update | |
| - id: checkout | |
| name: Clone | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - id: preparation | |
| name: Preparation | |
| run: | | |
| mkdir -p build/libs | |
| echo "CMAKE_VARS=-DARCHITECTURE=${{ matrix.arch }} -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${{ github.workspace }}/build/libs -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=${{ github.workspace }}/build/libs -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=${{ github.workspace }}/build/libs ${{ matrix.cmake_vars }}" >> $GITHUB_ENV | |
| shell: bash | |
| - id: cpu-cores | |
| name: Get number of CPU cores | |
| uses: SimenB/github-actions-cpu-cores@v2 | |
| - id: cmake_build | |
| name: Build | |
| run: | | |
| cd build | |
| cmake .. ${{ env.CMAKE_VARS }} | |
| cmake --build . --config Release -j ${{ steps.cpu-cores.outputs.count }} | |
| - id: test_build | |
| name: Test | |
| run: | | |
| flag=0 | |
| if [[ "$RUNNER_OS" == "macOS" ]]; then | |
| flag=1 | |
| else | |
| CPU_FLAGS=$(grep -o 'avx[^ ]*' /proc/cpuinfo | sort -u | tr '\n' ' ') | |
| ARCH="${{ matrix.arch }}" | |
| FEATURE="${ARCH##*_}" | |
| if echo "$CPU_FLAGS" | grep -qw "$FEATURE"; then | |
| flag=1 | |
| fi | |
| fi | |
| if [[ "$flag" == "1" ]]; then | |
| ./tests/download_test_models.sh | |
| cd build | |
| if [[ "$RUNNER_OS" == "Windows" ]]; then | |
| ./libs/Release/llamalib_tests.exe | |
| ./libs/Release/llamalib_tests_runtime.exe | |
| else | |
| ./libs/llamalib_tests | |
| ./libs/llamalib_tests_runtime | |
| fi | |
| fi | |
| shell: bash | |
| - id: pack_artifacts | |
| name: Pack artifacts | |
| run: | | |
| ls -R build | |
| mkdir -p artifacts | |
| mv build/Release/*llamalib* artifacts/ 2>/dev/null || true | |
| mv build/libs/*llamalib* artifacts/ 2>/dev/null || true | |
| mv build/libs/*.so* artifacts/ 2>/dev/null || true | |
| mv build/libs/Release/*llamalib* artifacts/ 2>/dev/null || true | |
| mv build/libs/Release/*.dll artifacts/ 2>/dev/null || true | |
| rm -f artifacts/*llamalib_tests* artifacts/*exp artifacts/*server*lib 2>/dev/null || true | |
| rm -r build | |
| cd artifacts | |
| if [[ "$RUNNER_OS" == "Windows" ]]; then | |
| 7z a ../${{ matrix.arch }}.zip * | |
| else | |
| zip ../${{ matrix.arch }}.zip * | |
| fi | |
| shell: bash | |
| - id: upload_llamalib | |
| name: Upload Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.arch }}.zip | |
| path: ${{ matrix.arch }}.zip | |
| osx-x64-build: | |
| runs-on: macos-15-intel | |
| strategy: | |
| matrix: | |
| include: | |
| - arch: osx-x64_acc | |
| - arch: osx-x64_no-acc | |
| steps: | |
| - continue-on-error: true | |
| id: setup_libs_macos | |
| name: Dependencies | |
| run: | | |
| echo "Architecture: $(uname -m)" | |
| echo "Operating System: $(uname -s)" | |
| brew update | |
| - id: checkout | |
| name: Clone | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - id: preparation | |
| name: Preparation | |
| run: | | |
| mkdir -p build/libs | |
| echo "CMAKE_VARS=-DARCHITECTURE=${{ matrix.arch }} -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${{ github.workspace }}/build/libs -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=${{ github.workspace }}/build/libs -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=${{ github.workspace }}/build/libs ${{ matrix.cmake_vars }}" >> $GITHUB_ENV | |
| shell: bash | |
| - id: cpu-cores | |
| name: Get number of CPU cores | |
| uses: SimenB/github-actions-cpu-cores@v2 | |
| - id: cmake_build | |
| name: Build | |
| run: | | |
| cd build | |
| cmake .. ${{ env.CMAKE_VARS }} | |
| cmake --build . --config Release -j ${{ steps.cpu-cores.outputs.count }} | |
| - id: test_build | |
| name: Test | |
| run: | | |
| flag=0 | |
| if [[ "$RUNNER_OS" == "macOS" ]]; then | |
| flag=1 | |
| else | |
| CPU_FLAGS=$(grep -o 'avx[^ ]*' /proc/cpuinfo | sort -u | tr '\n' ' ') | |
| ARCH="${{ matrix.arch }}" | |
| FEATURE="${ARCH##*_}" | |
| if echo "$CPU_FLAGS" | grep -qw "$FEATURE"; then | |
| flag=1 | |
| fi | |
| fi | |
| if [[ "$flag" == "1" ]]; then | |
| ./tests/download_test_models.sh | |
| cd build | |
| if [[ "$RUNNER_OS" == "Windows" ]]; then | |
| ./libs/Release/llamalib_tests.exe | |
| ./libs/Release/llamalib_tests_runtime.exe | |
| else | |
| ./libs/llamalib_tests | |
| ./libs/llamalib_tests_runtime | |
| fi | |
| fi | |
| shell: bash | |
| - id: pack_artifacts | |
| name: Pack artifacts | |
| run: | | |
| ls -R build | |
| mkdir -p artifacts | |
| mv build/Release/*llamalib* artifacts/ 2>/dev/null || true | |
| mv build/libs/*llamalib* artifacts/ 2>/dev/null || true | |
| mv build/libs/*.so* artifacts/ 2>/dev/null || true | |
| mv build/libs/Release/*llamalib* artifacts/ 2>/dev/null || true | |
| mv build/libs/Release/*.dll artifacts/ 2>/dev/null || true | |
| rm -f artifacts/*llamalib_tests* artifacts/*exp artifacts/*server*lib 2>/dev/null || true | |
| rm -r build | |
| cd artifacts | |
| if [[ "$RUNNER_OS" == "Windows" ]]; then | |
| 7z a ../${{ matrix.arch }}.zip * | |
| else | |
| zip ../${{ matrix.arch }}.zip * | |
| fi | |
| shell: bash | |
| - id: upload_llamalib | |
| name: Upload Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.arch }}.zip | |
| path: ${{ matrix.arch }}.zip | |
| osx-universal-build: | |
| runs-on: macos-15 | |
| needs: | |
| - osx-arm64-build | |
| - osx-x64-build | |
| strategy: | |
| matrix: | |
| include: | |
| - arch: osx-universal | |
| steps: | |
| - id: download_macos_artifacts | |
| name: Download Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| pattern: osx-* | |
| - id: combine_macos_libraries | |
| name: Merge macOS libraries | |
| run: | | |
| cd artifacts | |
| for d in *.zip;do | |
| unzip -o $d/$d -d `echo $d|cut -d'.' -f1` | |
| done | |
| mkdir ${{ matrix.arch }} | |
| for acc in no-acc acc;do | |
| for f in `ls osx-x64_$acc`;do | |
| output=${{ matrix.arch }}/`echo $f|sed -e "s:x64:universal:g"` | |
| if [ -f $output ];then continue;fi | |
| lipo -create -output $output osx-x64_$acc/$f osx-arm64_$acc/`echo $f|sed -e "s:x64:arm64:g"` | |
| done | |
| done | |
| zip -j ../${{ matrix.arch }}.zip ${{ matrix.arch }}/* | |
| - id: upload_llamalib | |
| name: Upload Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.arch }}.zip | |
| path: ${{ matrix.arch }}.zip | |
| ################################ Windows ################################ | |
| windows-build: | |
| runs-on: windows-2022 | |
| env: | |
| VULKAN_VERSION: 1.4.328.1 | |
| PLATFORM: windows | |
| strategy: | |
| matrix: | |
| include: | |
| - arch: win-x64_noavx | |
| - arch: win-x64_avx2 | |
| - arch: win-x64_avx | |
| - arch: win-x64_avx512 | |
| - arch: win-x64_vulkan | |
| - arch: win-x64_tinyblas | |
| - arch: win-x64_cublas | |
| steps: | |
| - id: checkout | |
| name: Clone | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - id: preparation | |
| name: Preparation | |
| run: | | |
| mkdir -p build/libs | |
| echo "CMAKE_VARS=-DARCHITECTURE=${{ matrix.arch }} -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${{ github.workspace }}/build/libs -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=${{ github.workspace }}/build/libs -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=${{ github.workspace }}/build/libs ${{ matrix.cmake_vars }}" >> $GITHUB_ENV | |
| shell: bash | |
| - id: setup_vulcan_windows | |
| if: contains(matrix.arch, 'vulkan') | |
| name: Install Vulkan SDK | |
| run: | | |
| mkdir -p .\build\libs\Release | |
| curl.exe -o $env:RUNNER_TEMP/VulkanSDK-Installer.exe -L "https://sdk.lunarg.com/sdk/download/${env:VULKAN_VERSION}/windows/vulkansdk-windows-X64-${env:VULKAN_VERSION}.exe" | |
| & "$env:RUNNER_TEMP\VulkanSDK-Installer.exe" --accept-licenses --default-answer --confirm-command install | |
| Add-Content $env:GITHUB_ENV "VULKAN_SDK=C:\VulkanSDK\${env:VULKAN_VERSION}" | |
| Add-Content $env:GITHUB_PATH "C:\VulkanSDK\${env:VULKAN_VERSION}\bin" | |
| curl.exe -o $env:RUNNER_TEMP/VulkanRT-Components.zip -L "https://sdk.lunarg.com/sdk/download/${env:VULKAN_VERSION}/windows/VulkanRT-X64-${env:VULKAN_VERSION}-Components.zip" | |
| 7z x "-o${env:RUNNER_TEMP}" $env:RUNNER_TEMP/VulkanRT-Components.zip | |
| cp ${env:RUNNER_TEMP}/VulkanRT*\x64\vulkan-1.dll .\build\libs\Release | |
| - id: setup_cuda_windows | |
| if: contains(matrix.arch, 'blas') | |
| uses: Jimver/cuda-toolkit@v0.2.15 | |
| with: | |
| cuda: ${{ env.CUDA }} | |
| method: network | |
| sub-packages: '["nvcc", "cudart", "cublas", "cublas_dev", "thrust", "visual_studio_integration"]' | |
| - id: cpu-cores | |
| name: Get number of CPU cores | |
| uses: SimenB/github-actions-cpu-cores@v2 | |
| - id: cmake_build | |
| name: Build | |
| run: | | |
| cd build | |
| cmake .. ${{ env.CMAKE_VARS }} | |
| cmake --build . --config Release -j ${{ steps.cpu-cores.outputs.count }} | |
| - id: test_build | |
| name: Test | |
| run: | | |
| flag=0 | |
| if [[ "$RUNNER_OS" == "macOS" ]]; then | |
| flag=1 | |
| else | |
| CPU_FLAGS=$(grep -o 'avx[^ ]*' /proc/cpuinfo | sort -u | tr '\n' ' ') | |
| ARCH="${{ matrix.arch }}" | |
| FEATURE="${ARCH##*_}" | |
| if echo "$CPU_FLAGS" | grep -qw "$FEATURE"; then | |
| flag=1 | |
| fi | |
| fi | |
| if [[ "$flag" == "1" ]]; then | |
| ./tests/download_test_models.sh | |
| cd build | |
| if [[ "$RUNNER_OS" == "Windows" ]]; then | |
| ./libs/Release/llamalib_tests.exe | |
| ./libs/Release/llamalib_tests_runtime.exe | |
| else | |
| ./libs/llamalib_tests | |
| ./libs/llamalib_tests_runtime | |
| fi | |
| fi | |
| shell: bash | |
| - id: copy_cuda_dlls | |
| if: contains(matrix.arch, 'cublas') | |
| name: Copy Cuda DLLs | |
| run: | | |
| mv "${{ env.CUDA_PATH }}"/bin/cudart64_*.dll build/libs/Release | |
| mv "${{ env.CUDA_PATH }}"/bin/cublas64_*.dll build/libs/Release | |
| mv "${{ env.CUDA_PATH }}"/bin/cublasLt64_*.dll build/libs/Release | |
| shell: bash | |
| - id: pack_artifacts | |
| name: Pack artifacts | |
| run: | | |
| ls -R build | |
| mkdir -p artifacts | |
| mv build/Release/*llamalib* artifacts/ 2>/dev/null || true | |
| mv build/libs/*llamalib* artifacts/ 2>/dev/null || true | |
| mv build/libs/*.so* artifacts/ 2>/dev/null || true | |
| mv build/libs/Release/*llamalib* artifacts/ 2>/dev/null || true | |
| mv build/libs/Release/*.dll artifacts/ 2>/dev/null || true | |
| rm -f artifacts/*llamalib_tests* artifacts/*exp artifacts/*server*lib 2>/dev/null || true | |
| rm -r build | |
| cd artifacts | |
| if [[ "$RUNNER_OS" == "Windows" ]]; then | |
| 7z a ../${{ matrix.arch }}.zip * | |
| else | |
| zip ../${{ matrix.arch }}.zip * | |
| fi | |
| shell: bash | |
| - id: upload_llamalib | |
| name: Upload Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.arch }}.zip | |
| path: ${{ matrix.arch }}.zip | |
| ################################ Android ################################ | |
| android-build: | |
| runs-on: ubuntu-22.04 | |
| strategy: | |
| matrix: | |
| include: | |
| - arch: android-arm64 | |
| ABI: arm64-v8a | |
| - arch: android-x64 | |
| ABI: x86_64 | |
| - arch: android-arm64-vulkan | |
| ABI: arm64-v8a | |
| steps: | |
| - id: setup_libs_linux | |
| name: Dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential cmake zip libssl-dev git libcurl4-openssl-dev curl libgomp1 | |
| - id: checkout | |
| name: Clone | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - id: preparation | |
| name: Preparation | |
| run: | | |
| mkdir -p build/libs | |
| echo "CMAKE_VARS=-DARCHITECTURE=${{ matrix.arch }} -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${{ github.workspace }}/build/libs -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=${{ github.workspace }}/build/libs -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=${{ github.workspace }}/build/libs ${{ matrix.cmake_vars }}" >> $GITHUB_ENV | |
| shell: bash | |
| - id: setup_vulkan_linux | |
| if: contains(matrix.arch, 'vulkan') | |
| name: Dependencies Vulcan | |
| run: | | |
| wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add - | |
| sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-jammy.list https://packages.lunarg.com/vulkan/lunarg-vulkan-jammy.list | |
| sudo apt-get update -y | |
| sudo apt-get install -y build-essential vulkan-sdk | |
| - id: setup_vulcan_android | |
| if: contains(matrix.arch, 'vulkan') | |
| name: Install Vulkan headers | |
| run: | | |
| git submodule add https://github.com/KhronosGroup/Vulkan-Headers.git third_party/Vulkan-Headers | |
| cd third_party/Vulkan-Headers | |
| git checkout v1.3.275 | |
| - id: cpu-cores | |
| name: Get number of CPU cores | |
| uses: SimenB/github-actions-cpu-cores@v2 | |
| - id: build_openssl | |
| name: Build OpenSSL | |
| run: | | |
| .github/scripts/build_openssl.sh ${{ matrix.arch }} | |
| - id: cmake_build_android | |
| name: Build | |
| run: | | |
| export LD_LIBRARY_PATH="" | |
| export NDK=`ls -d /usr/local/lib/android/sdk/ndk/27.*` | |
| cd build | |
| cmake .. -DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake -DANDROID_PLATFORM=android-29 -DANDROID_ABI=${{ matrix.ABI }} ${{ env.CMAKE_VARS }} | |
| cmake --build . --config Release -j ${{ steps.cpu-cores.outputs.count }} | |
| - id: pack_artifacts | |
| name: Pack artifacts | |
| run: | | |
| ls -R build | |
| mkdir -p artifacts | |
| mv build/Release/*llamalib* artifacts/ 2>/dev/null || true | |
| mv build/libs/*llamalib* artifacts/ 2>/dev/null || true | |
| mv build/libs/*.so* artifacts/ 2>/dev/null || true | |
| mv build/libs/Release/*llamalib* artifacts/ 2>/dev/null || true | |
| mv build/libs/Release/*.dll artifacts/ 2>/dev/null || true | |
| rm -f artifacts/*llamalib_tests* artifacts/*exp artifacts/*server*lib 2>/dev/null || true | |
| rm -r build | |
| cd artifacts | |
| if [[ "$RUNNER_OS" == "Windows" ]]; then | |
| 7z a ../${{ matrix.arch }}.zip * | |
| else | |
| zip ../${{ matrix.arch }}.zip * | |
| fi | |
| shell: bash | |
| - id: upload_llamalib | |
| name: Upload Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.arch }}.zip | |
| path: ${{ matrix.arch }}.zip | |
| ################################ iOS ################################ | |
| ios-build: | |
| runs-on: macos-14 | |
| strategy: | |
| matrix: | |
| include: | |
| - arch: ios-arm64 | |
| cmake_vars: '-DCMAKE_SYSTEM_NAME=iOS' | |
| - arch: visionos-arm64 | |
| cmake_vars: '-DCMAKE_SYSTEM_NAME=visionOS' | |
| steps: | |
| - continue-on-error: true | |
| id: setup_libs_macos | |
| name: Dependencies | |
| run: | | |
| echo "Architecture: $(uname -m)" | |
| echo "Operating System: $(uname -s)" | |
| brew update | |
| - id: checkout | |
| name: Clone | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - id: preparation | |
| name: Preparation | |
| run: | | |
| mkdir -p build/libs | |
| echo "CMAKE_VARS=-DARCHITECTURE=${{ matrix.arch }} -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${{ github.workspace }}/build/libs -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=${{ github.workspace }}/build/libs -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=${{ github.workspace }}/build/libs ${{ matrix.cmake_vars }}" >> $GITHUB_ENV | |
| shell: bash | |
| - id: cpu-cores | |
| name: Get number of CPU cores | |
| uses: SimenB/github-actions-cpu-cores@v2 | |
| - id: cmake_build | |
| name: Build | |
| run: | | |
| cd build | |
| cmake .. ${{ env.CMAKE_VARS }} | |
| cmake --build . --config Release -j ${{ steps.cpu-cores.outputs.count }} | |
| - id: link_libraries_ios | |
| name: Link libraries | |
| run: | | |
| cd build | |
| lib=libs/libllamalib_${{ matrix.arch }}.a | |
| libtool -static -o $lib `find . -name "*.a"` | |
| nm -u $lib | |
| - id: pack_artifacts | |
| name: Pack artifacts | |
| run: | | |
| ls -R build | |
| mkdir -p artifacts | |
| mv build/Release/*llamalib* artifacts/ 2>/dev/null || true | |
| mv build/libs/*llamalib* artifacts/ 2>/dev/null || true | |
| mv build/libs/*.so* artifacts/ 2>/dev/null || true | |
| mv build/libs/Release/*llamalib* artifacts/ 2>/dev/null || true | |
| mv build/libs/Release/*.dll artifacts/ 2>/dev/null || true | |
| rm -f artifacts/*llamalib_tests* artifacts/*exp artifacts/*server*lib 2>/dev/null || true | |
| rm -r build | |
| cd artifacts | |
| if [[ "$RUNNER_OS" == "Windows" ]]; then | |
| 7z a ../${{ matrix.arch }}.zip * | |
| else | |
| zip ../${{ matrix.arch }}.zip * | |
| fi | |
| shell: bash | |
| - id: upload_llamalib | |
| name: Upload Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.arch }}.zip | |
| path: ${{ matrix.arch }}.zip | |
| ################################ Release ################################ | |
| create_release: | |
| name: Create Release | |
| runs-on: ubuntu-22.04 | |
| needs: | |
| - linux-build | |
| - osx-arm64-build | |
| - osx-x64-build | |
| - osx-universal-build | |
| - windows-build | |
| - android-build | |
| - ios-build | |
| steps: | |
| - id: checkout | |
| name: Clone | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - id: preparation | |
| name: Preparation | |
| run: | | |
| mkdir -p build/libs | |
| echo "CMAKE_VARS=-DARCHITECTURE=${{ matrix.arch }} -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${{ github.workspace }}/build/libs -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=${{ github.workspace }}/build/libs -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=${{ github.workspace }}/build/libs ${{ matrix.cmake_vars }}" >> $GITHUB_ENV | |
| shell: bash | |
| - id: set_release_version | |
| name: Set version | |
| run: | | |
| VERSION=${GITHUB_REF_NAME#v} | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| echo "RELEASE_NAME=LlamaLib-v$VERSION" >> $GITHUB_ENV | |
| echo "$VERSION" > VERSION | |
| sed -i "s|<PackageVersion>.*</PackageVersion>|<PackageVersion>${VERSION}</PackageVersion>|g" csharp/LlamaLib.csproj | |
| sed -i "s|<LlamaLibVersion>.*</LlamaLibVersion>|<LlamaLibVersion>${VERSION}</LlamaLibVersion>|g" csharp/LlamaLib.targets | |
| sed -i "s|\(Include=\"LlamaLib\" Version=\)\"[^\"]*\"|\1\"${VERSION}\"|g" tests/csharp/LlamaLib.Test.csproj | |
| shell: bash | |
| - id: download_artifacts | |
| name: Download Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: release | |
| - id: create_release | |
| name: Create release | |
| run: | | |
| ./.github/scripts/release.sh release | |
| mv release ${{ env.RELEASE_NAME }} | |
| zip -r ${{ env.RELEASE_NAME }}.zip ${{ env.RELEASE_NAME }} | |
| sha256sum ${{ env.RELEASE_NAME }}.zip | awk '{print $1}' > ${{ env.RELEASE_NAME }}.zip.sha256 | |
| - id: test_cmake | |
| name: Test cmake | |
| run: | | |
| ./tests/download_test_models.sh | |
| cd tests/cpp-cmake | |
| cmake . -DLLAMALIB_DIR=../../${{ env.RELEASE_NAME }} | |
| cmake --build . --config Release | |
| ./test | |
| - id: pack_nuget | |
| name: Pack nuget | |
| run: | | |
| cd csharp | |
| dotnet pack -c Release | |
| - id: clean_up_release | |
| name: Clean up | |
| run: | | |
| rm -r ${{ env.RELEASE_NAME }} | |
| - id: test_nuget | |
| name: Test nuget | |
| run: | | |
| ./tests/download_test_models.sh | |
| mkdir -p ~/.nuget/packages/LlamaLib | |
| ln -s `pwd`/${{ env.RELEASE_NAME }}.zip ~/.nuget/packages/LlamaLib/${{ env.RELEASE_NAME }}.zip | |
| cd tests/csharp | |
| dotnet build -c Release | |
| dotnet test -c Release --logger "console;verbosity=detailed" | |
| - id: release | |
| name: Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| ${{ env.RELEASE_NAME }}.zip | |
| ${{ env.RELEASE_NAME }}.zip.sha256 | |
| csharp/bin/Release/LlamaLib*nupkg | |
| name: Release ${{ env.VERSION }} | |