11name : CI
2+ description : |
3+ This workflow builds and tests the llama.cpp project on various platforms.
4+ It is triggered on push, pull request, or manually via workflow_dispatch.
5+ It also creates a release when a new commit is pushed to the master branch or when manually triggered.
6+ The workflow includes jobs for macOS, Linux, and Windows, with different configurations and dependencies.
7+ The workflow uses concurrency to cancel in-progress jobs if a new commit is pushed to the same branch.
8+ It uses ccache to speed up the build process by caching compiled files.
29
310on :
411 workflow_dispatch : # allows manual triggering
512 inputs :
613 create_release :
14+ default : false
715 description : ' Create new release'
8- required : true
9- type : boolean
10- push :
16+ required : true
17+ type : boolean
18+ push :
1119 branches :
1220 - master
1321 paths : ['.github/workflows/build.yml', '.github/workflows/build-linux-cross.yml', '**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu', '**/*.cuh', '**/*.swift', '**/*.m', '**/*.metal', '**/*.comp']
3139 LLAMA_LOG_COLORS : 1
3240 LLAMA_LOG_PREFIX : 1
3341 LLAMA_LOG_TIMESTAMPS : 1
42+ CREATE_RELEASE : ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.create_release == 'true' }}
3443
3544jobs :
3645 macOS-latest-cmake-arm64 :
@@ -89,13 +98,13 @@ jobs:
8998
9099 - name : Pack artifacts
91100 id : pack_artifacts
92- if : ${{ ( github.event_name == 'push ' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true ' }}
101+ if : ${{ (github.event_name == 'workflow_dispatch ' && github.event.inputs.create_release == 'true' ) || github.ref == 'refs/heads/master ' }}
93102 run : |
94103 cp LICENSE ./build/bin/
95104 zip -r llama-${{ steps.tag.outputs.name }}-bin-macos-arm64.zip ./build/bin/*
96105
97106 - name : Upload artifacts
98- if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
107+ if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || ( github.event_name == 'workflow_dispatch' && github. event.inputs.create_release == 'true' ) }}
99108 uses : actions/upload-artifact@v4
100109 with :
101110 path : llama-${{ steps.tag.outputs.name }}-bin-macos-arm64.zip
@@ -723,7 +732,6 @@ jobs:
723732 with :
724733 key : macOS-latest-swift
725734 evict-old-files : 1d
726-
727735 - name : Dependencies
728736 id : depends
729737 continue-on-error : true
@@ -782,6 +790,10 @@ jobs:
782790 mingw-w64-${{matrix.env}}-cmake
783791 mingw-w64-${{matrix.env}}-openblas
784792
793+ - name : Setup for build
794+ run : |
795+ echo "Setting up build environment"
796+
785797 - name : Build using CMake
786798 shell : msys2 {0}
787799 run : |
@@ -927,14 +939,27 @@ jobs:
927939 id : get_libcurl
928940 uses : ./.github/actions/windows-setup-curl
929941
930- - name : Build
931- id : cmake_build
942+ - name : Build with libCURL
943+ id : cmake_build_curl
944+ shell : cmd
932945 env :
933946 CURL_PATH : ${{ steps.get_libcurl.outputs.curl_path }}
934947 run : |
935- cmake -S . -B build ${{ matrix.defines }} `
936- -DCURL_LIBRARY="$env:CURL_PATH/lib/libcurl.dll.a" -DCURL_INCLUDE_DIR="$env:CURL_PATH/include"
937- cmake --build build --config Release -j ${env:NUMBER_OF_PROCESSORS}
948+ call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
949+ cmake -S . -B build -G "Ninja Multi-Config" ^
950+ -DLLAMA_BUILD_SERVER=ON ^
951+ -DGGML_NATIVE=OFF ^
952+ -DGGML_CUDA=ON ^
953+ -DGGML_RPC=ON ^
954+ -DCURL_LIBRARY="%CURL_PATH%/lib/libcurl.dll.a" -DCURL_INCLUDE_DIR="%CURL_PATH%/include"
955+ set /A NINJA_JOBS=%NUMBER_OF_PROCESSORS%-1
956+ cmake --build build --config Release -j %NINJA_JOBS% -t ggml
957+ cmake --build build --config Release
958+
959+ - name : Copy libcurl DLL
960+ id : copy_curl_dll
961+ run : |
962+ cp $env:RUNNER_TEMP/curl/bin/libcurl-x64.dll ./build/bin/Release/libcurl-x64.dll
938963
939964 - name : Add libopenblas.dll
940965 id : add_libopenblas_dll
@@ -959,14 +984,13 @@ jobs:
959984 - name : Test
960985 id : cmake_test
961986 # not all machines have native AVX-512
962- if : ${{ matrix.build != 'arm64' && matrix.build != 'clblast' && matrix.build != 'kompute' && matrix.build != 'vulkan' && (matrix.build != 'avx512' || env.HAS_AVX512F == '1') }}
987+ if : ${{ matrix.build != 'arm64' && matrix.build != 'clblast' && matrix.build != 'kompute' && matrix.build != 'vulkan' && (matrix.build != 'avx512' || steps.check_avx512f.outputs.has_avx512f == '1') }}
963988 run : |
964989 cd build
965990 ctest -L main -C Release --verbose --timeout 900
966991
967992 - name : Test (Intel SDE)
968- id : cmake_test_sde
969- if : ${{ matrix.build == 'avx512-x64' && env.HAS_AVX512F == '0' }} # use Intel SDE for AVX-512 emulation
993+ if : ${{ matrix.build == 'avx512-x64' && steps.check_avx512f.outputs.has_avx512f == '0' }} # use Intel SDE for AVX-512 emulation
970994 run : |
971995 curl.exe -o $env:RUNNER_TEMP/sde.tar.xz -L "https://downloadmirror.intel.com/813591/sde-external-${env:SDE_VERSION}-win.tar.xz"
972996 # for some weird reason windows tar doesn't like sde tar.xz
@@ -1142,10 +1166,10 @@ jobs:
11421166 - name : Copy and pack Cuda runtime
11431167 if : ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
11441168 run : |
1145- echo "Cuda install location: ${{ env. CUDA_PATH }} "
1169+ echo "Cuda install location: $CUDA_PATH"
11461170 $dst='.\build\bin\cudart\'
1147- robocopy "${{ env. CUDA_PATH}} \bin" $dst cudart64_*.dll cublas64_*.dll cublasLt64_*.dll
1148- robocopy "${{ env. CUDA_PATH}} \lib" $dst cudart64_*.dll cublas64_*.dll cublasLt64_*.dll
1171+ robocopy "$env: CUDA_PATH\bin" $dst cudart64_*.dll cublas64_*.dll cublasLt64_*.dll
1172+ robocopy "$env: CUDA_PATH\lib" $dst cudart64_*.dll cublas64_*.dll cublasLt64_*.dll
11491173 7z a cudart-llama-bin-win-cu${{ matrix.cuda }}-x64.zip $dst\*
11501174
11511175 - name : Upload Cuda runtime
@@ -1487,7 +1511,7 @@ jobs:
14871511 - ubuntu-cpu-cmake
14881512 - ubuntu-22-cmake-vulkan
14891513 - windows-latest-cmake
1490- - windows-2019 -cmake-cuda
1514+ - windows-latest -cmake-cuda
14911515 - windows-latest-cmake-sycl
14921516 - windows-latest-cmake-hip-release
14931517 - macOS-latest-cmake-arm64
0 commit comments