From 74a17d54be68e8e6a5b2a693f5ae877d4716c0af Mon Sep 17 00:00:00 2001 From: slaren Date: Thu, 8 May 2025 20:54:09 +0200 Subject: [PATCH 1/4] ci : limit write permission to only the release step --- .github/workflows/build.yml | 1 - .github/workflows/release.yml | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4e9958b8b3cc7..ae066697d9884 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,6 @@ concurrency: cancel-in-progress: true env: - BRANCH_NAME: ${{ github.head_ref || github.ref_name }} GGML_NLOOP: 3 GGML_N_THREADS: 1 LLAMA_LOG_COLORS: 1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 38c8ea439ed02..2c4f2f75ee0a3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,11 +16,6 @@ concurrency: group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }} cancel-in-progress: true -# Fine-grant permission -# https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token -permissions: - contents: write # for creating release - env: BRANCH_NAME: ${{ github.head_ref || github.ref_name }} CMAKE_ARGS: "-DLLAMA_BUILD_EXAMPLES=OFF -DLLAMA_BUILD_TESTS=OFF -DLLAMA_BUILD_TOOLS=ON -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON" @@ -646,6 +641,11 @@ jobs: release: if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} + # Fine-grant permission + # https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token + permissions: + contents: write # for creating release + runs-on: ubuntu-latest needs: From 68c1296877bdc2cd5805bc990d93b7c8269c0a73 Mon Sep 17 00:00:00 2001 From: slaren Date: Thu, 8 May 2025 21:50:30 +0200 Subject: [PATCH 2/4] fix win cuda file name --- .github/workflows/release.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2c4f2f75ee0a3..aefcd5462d4a7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -411,16 +411,15 @@ jobs: CURL_PATH: ${{ steps.get_libcurl.outputs.curl_path }} run: | cp $env:CURL_PATH\bin\libcurl-x64.dll .\build\bin\Release\libcurl-x64.dll - 7z a llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}-cu${{ matrix.cuda }}-x64.zip .\build\bin\Release\* + 7z a llama-${{ steps.tag.outputs.name }}-bin-win-cuda${{ matrix.cuda }}-x64.zip .\build\bin\Release\* - name: Upload artifacts uses: actions/upload-artifact@v4 with: - path: llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}-cu${{ matrix.cuda }}-x64.zip + path: llama-${{ steps.tag.outputs.name }}-bin-win-cuda${{ matrix.cuda }}-x64.zip name: llama-bin-win-cu${{ matrix.cuda }}-x64.zip - name: Copy and pack Cuda runtime - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} run: | echo "Cuda install location: ${{ env.CUDA_PATH }}" $dst='.\build\bin\cudart\' @@ -431,8 +430,8 @@ jobs: - name: Upload Cuda runtime uses: actions/upload-artifact@v4 with: - path: cudart-llama-bin-win-cu${{ matrix.cuda }}-x64.zip - name: cudart-llama-bin-win-cu${{ matrix.cuda }}-x64.zip + path: cudart-llama-bin-win-cuda${{ matrix.cuda }}-x64.zip + name: cudart-llama-bin-win-cuda${{ matrix.cuda }}-x64.zip windows-sycl: runs-on: windows-latest From 5f1ade98d91041162342505c32565fd73b56de64 Mon Sep 17 00:00:00 2001 From: slaren Date: Thu, 8 May 2025 21:51:02 +0200 Subject: [PATCH 3/4] fix license file copy on multi-config generators --- CMakeLists.txt | 17 ----------------- common/CMakeLists.txt | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f7e43b6e625f..ac3e9090336d9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -252,20 +252,3 @@ configure_file(cmake/llama.pc.in install(FILES "${CMAKE_CURRENT_BINARY_DIR}/llama.pc" DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) - -# -# copy the license files -# - -# Check if running in GitHub Actions -if(DEFINED ENV{GITHUB_ACTIONS} AND "$ENV{GITHUB_ACTIONS}" STREQUAL "true") - message(STATUS "Running inside GitHub Actions - copying license files") - - # Copy all files from licenses/ to build/bin/ - file(GLOB LICENSE_FILES "${CMAKE_SOURCE_DIR}/licenses/*") - foreach(LICENSE_FILE ${LICENSE_FILES}) - get_filename_component(FILENAME ${LICENSE_FILE} NAME) - configure_file(${LICENSE_FILE} "${CMAKE_BINARY_DIR}/bin/${FILENAME}" COPYONLY) - endforeach() -endif() - diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index f15e12a96b919..ccadb5d1d016f 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -144,3 +144,27 @@ endif () target_include_directories(${TARGET} PUBLIC .) target_compile_features (${TARGET} PUBLIC cxx_std_17) target_link_libraries (${TARGET} PRIVATE ${LLAMA_COMMON_EXTRA_LIBS} PUBLIC llama Threads::Threads) + + +# +# copy the license files +# + +# Check if running in GitHub Actions +if (DEFINED ENV{GITHUB_ACTIONS} AND "$ENV{GITHUB_ACTIONS}" STREQUAL "true") + message(STATUS "Running inside GitHub Actions - copying license files") + + # Copy all files from licenses/ to build/bin/ + file(GLOB LICENSE_FILES "${CMAKE_SOURCE_DIR}/licenses/*") + foreach(LICENSE_FILE ${LICENSE_FILES}) + get_filename_component(FILENAME ${LICENSE_FILE} NAME) + add_custom_command( + POST_BUILD + TARGET ${TARGET} + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "${LICENSE_FILE}" + "$/${FILENAME}" + COMMENT "Copying ${FILENAME} to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") + message(STATUS "Copying ${LICENSE_FILE} to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${FILENAME}") + endforeach() +endif() From 6dba6e93207f52263a0ab980b645e232f27826ca Mon Sep 17 00:00:00 2001 From: slaren Date: Thu, 8 May 2025 22:21:37 +0200 Subject: [PATCH 4/4] fix --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index aefcd5462d4a7..5f54909dcbd8c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -417,7 +417,7 @@ jobs: uses: actions/upload-artifact@v4 with: path: llama-${{ steps.tag.outputs.name }}-bin-win-cuda${{ matrix.cuda }}-x64.zip - name: llama-bin-win-cu${{ matrix.cuda }}-x64.zip + name: llama-bin-win-cuda${{ matrix.cuda }}-x64.zip - name: Copy and pack Cuda runtime run: | @@ -425,7 +425,7 @@ jobs: $dst='.\build\bin\cudart\' robocopy "${{env.CUDA_PATH}}\bin" $dst cudart64_*.dll cublas64_*.dll cublasLt64_*.dll robocopy "${{env.CUDA_PATH}}\lib" $dst cudart64_*.dll cublas64_*.dll cublasLt64_*.dll - 7z a cudart-llama-bin-win-cu${{ matrix.cuda }}-x64.zip $dst\* + 7z a cudart-llama-bin-win-cuda${{ matrix.cuda }}-x64.zip $dst\* - name: Upload Cuda runtime uses: actions/upload-artifact@v4