Merge pull request #5 from anzz1/master

Windows fixes for CMake & Github CI
This commit is contained in:
Kevin Kwok 2023-03-16 18:26:03 -07:00 committed by GitHub
commit bf244623ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 83 additions and 37 deletions

View file

@ -1,52 +1,98 @@
name: CI name: CI
on: [push, pull_request]
on:
workflow_dispatch: # allows manual triggering
inputs:
create_release:
description: 'Create new release'
required: true
type: boolean
push:
paths: ['.github/workflows/**', 'CMakeLists.txt', 'Makefile', '**.h', '*.c', '**.cpp']
pull_request:
types: [opened, synchronize, edited, reopened, review_requested, ready_for_review]
paths: ['CMakeLists.txt', 'Makefile', '**.h', '*.c', '**.cpp']
jobs: jobs:
ubuntu-latest: # ubuntu-latest:
runs-on: ubuntu-latest # runs-on: ubuntu-latest
#
steps: # steps:
- name: Clone # - name: Clone
uses: actions/checkout@v1 # uses: actions/checkout@v1
#
- name: Dependencies # - name: Dependencies
run: | # run: |
sudo apt-get update # sudo apt-get update
sudo apt-get install build-essential # sudo apt-get install build-essential
#
- name: Build # - name: Build
run: | # run: |
make # make
#
macOS-latest: # macOS-latest:
runs-on: macOS-latest # runs-on: macOS-latest
#
steps: # steps:
- name: Clone # - name: Clone
uses: actions/checkout@v1 # uses: actions/checkout@v1
#
- name: Dependencies # - name: Dependencies
run: | # run: |
brew update # brew update
#
- name: Build # - name: Build
run: | # run: |
make # make
#
windows-latest: windows-latest:
runs-on: windows-latest runs-on: windows-latest
steps: steps:
- name: Clone - name: Clone
id: checkout
uses: actions/checkout@v1 uses: actions/checkout@v1
- name: Build - name: Build
id: cmake_build
run: | run: |
mkdir build mkdir build
cd build cd build
cmake .. cmake ..
cmake --build . --config Release cmake --build . --config Release
- name: Set commit hash variables
id: commit
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
uses: pr-mpt/actions-commit-hash@v2
- name: Pack artifacts
id: pack_artifacts
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
run: |
7z a alpaca-bin-win-x64-${{ steps.commit.outputs.short }}.zip .\build\Release\*
- name: Create release
id: create_release
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
uses: zendesk/action-create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.commit.outputs.short }}
- name: Upload release
id: upload_release
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: .\alpaca-bin-win-x64-${{ steps.commit.outputs.short }}.zip
asset_name: alpaca-bin-win-x64-${{ steps.commit.outputs.short }}.zip
asset_content_type: application/octet-stream
# ubuntu-latest-gcc: # ubuntu-latest-gcc:
# runs-on: ubuntu-latest # runs-on: ubuntu-latest
# #

View file

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.8) cmake_minimum_required(VERSION 3.8)
project("llama.cpp") project("alpaca.cpp")
set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED true) set(CMAKE_CXX_STANDARD_REQUIRED true)
@ -104,8 +104,8 @@ endif()
# set(LLAMA_EXTRA_FLAGS ${LLAMA_EXTRA_FLAGS} -DGGML_PERF) # set(LLAMA_EXTRA_FLAGS ${LLAMA_EXTRA_FLAGS} -DGGML_PERF)
# endif() # endif()
add_executable(llama add_executable(chat
main.cpp chat.cpp
utils.cpp utils.cpp
utils.h) utils.h)
@ -119,10 +119,10 @@ add_library(ggml
ggml.h) ggml.h)
target_compile_definitions(ggml PUBLIC ${LLAMA_EXTRA_FLAGS}) target_compile_definitions(ggml PUBLIC ${LLAMA_EXTRA_FLAGS})
target_compile_definitions(llama PUBLIC ${LLAMA_EXTRA_FLAGS}) target_compile_definitions(chat PUBLIC ${LLAMA_EXTRA_FLAGS})
target_compile_definitions(quantize PUBLIC ${LLAMA_EXTRA_FLAGS}) target_compile_definitions(quantize PUBLIC ${LLAMA_EXTRA_FLAGS})
target_link_libraries(ggml PRIVATE ${LLAMA_EXTRA_LIBS}) target_link_libraries(ggml PRIVATE ${LLAMA_EXTRA_LIBS})
target_include_directories(ggml PUBLIC .) target_include_directories(ggml PUBLIC .)
target_link_libraries(quantize PRIVATE ggml) target_link_libraries(quantize PRIVATE ggml)
target_link_libraries(llama PRIVATE ggml) target_link_libraries(chat PRIVATE ggml)