Skip to content

Commit bf24462

Browse files
authored
Merge pull request antimatter15#5 from anzz1/master
Windows fixes for CMake & Github CI
2 parents e750735 + c8917ca commit bf24462

File tree

2 files changed

+83
-37
lines changed

2 files changed

+83
-37
lines changed

.github/workflows/build.yml

+78-32
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,98 @@
11
name: CI
2-
on: [push, pull_request]
32

4-
jobs:
5-
ubuntu-latest:
6-
runs-on: ubuntu-latest
7-
8-
steps:
9-
- name: Clone
10-
uses: actions/checkout@v1
11-
12-
- name: Dependencies
13-
run: |
14-
sudo apt-get update
15-
sudo apt-get install build-essential
16-
17-
- name: Build
18-
run: |
19-
make
20-
21-
macOS-latest:
22-
runs-on: macOS-latest
23-
24-
steps:
25-
- name: Clone
26-
uses: actions/checkout@v1
27-
28-
- name: Dependencies
29-
run: |
30-
brew update
31-
32-
- name: Build
33-
run: |
34-
make
3+
on:
4+
workflow_dispatch: # allows manual triggering
5+
inputs:
6+
create_release:
7+
description: 'Create new release'
8+
required: true
9+
type: boolean
10+
push:
11+
paths: ['.github/workflows/**', 'CMakeLists.txt', 'Makefile', '**.h', '*.c', '**.cpp']
12+
pull_request:
13+
types: [opened, synchronize, edited, reopened, review_requested, ready_for_review]
14+
paths: ['CMakeLists.txt', 'Makefile', '**.h', '*.c', '**.cpp']
3515

16+
jobs:
17+
# ubuntu-latest:
18+
# runs-on: ubuntu-latest
19+
#
20+
# steps:
21+
# - name: Clone
22+
# uses: actions/checkout@v1
23+
#
24+
# - name: Dependencies
25+
# run: |
26+
# sudo apt-get update
27+
# sudo apt-get install build-essential
28+
#
29+
# - name: Build
30+
# run: |
31+
# make
32+
#
33+
# macOS-latest:
34+
# runs-on: macOS-latest
35+
#
36+
# steps:
37+
# - name: Clone
38+
# uses: actions/checkout@v1
39+
#
40+
# - name: Dependencies
41+
# run: |
42+
# brew update
43+
#
44+
# - name: Build
45+
# run: |
46+
# make
47+
#
3648
windows-latest:
3749
runs-on: windows-latest
3850

3951
steps:
4052
- name: Clone
53+
id: checkout
4154
uses: actions/checkout@v1
4255

4356
- name: Build
57+
id: cmake_build
4458
run: |
4559
mkdir build
4660
cd build
4761
cmake ..
4862
cmake --build . --config Release
4963
64+
- name: Set commit hash variables
65+
id: commit
66+
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
67+
uses: pr-mpt/actions-commit-hash@v2
68+
69+
- name: Pack artifacts
70+
id: pack_artifacts
71+
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
72+
run: |
73+
7z a alpaca-bin-win-x64-${{ steps.commit.outputs.short }}.zip .\build\Release\*
74+
75+
- name: Create release
76+
id: create_release
77+
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
78+
uses: zendesk/action-create-release@v1
79+
env:
80+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81+
with:
82+
tag_name: ${{ steps.commit.outputs.short }}
83+
84+
- name: Upload release
85+
id: upload_release
86+
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
87+
uses: actions/upload-release-asset@v1
88+
env:
89+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
90+
with:
91+
upload_url: ${{ steps.create_release.outputs.upload_url }}
92+
asset_path: .\alpaca-bin-win-x64-${{ steps.commit.outputs.short }}.zip
93+
asset_name: alpaca-bin-win-x64-${{ steps.commit.outputs.short }}.zip
94+
asset_content_type: application/octet-stream
95+
5096
# ubuntu-latest-gcc:
5197
# runs-on: ubuntu-latest
5298
#

CMakeLists.txt

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cmake_minimum_required(VERSION 3.8)
2-
project("llama.cpp")
2+
project("alpaca.cpp")
33

44
set(CMAKE_CXX_STANDARD 20)
55
set(CMAKE_CXX_STANDARD_REQUIRED true)
@@ -104,8 +104,8 @@ endif()
104104
# set(LLAMA_EXTRA_FLAGS ${LLAMA_EXTRA_FLAGS} -DGGML_PERF)
105105
# endif()
106106

107-
add_executable(llama
108-
main.cpp
107+
add_executable(chat
108+
chat.cpp
109109
utils.cpp
110110
utils.h)
111111

@@ -119,10 +119,10 @@ add_library(ggml
119119
ggml.h)
120120

121121
target_compile_definitions(ggml PUBLIC ${LLAMA_EXTRA_FLAGS})
122-
target_compile_definitions(llama PUBLIC ${LLAMA_EXTRA_FLAGS})
122+
target_compile_definitions(chat PUBLIC ${LLAMA_EXTRA_FLAGS})
123123
target_compile_definitions(quantize PUBLIC ${LLAMA_EXTRA_FLAGS})
124124

125125
target_link_libraries(ggml PRIVATE ${LLAMA_EXTRA_LIBS})
126126
target_include_directories(ggml PUBLIC .)
127127
target_link_libraries(quantize PRIVATE ggml)
128-
target_link_libraries(llama PRIVATE ggml)
128+
target_link_libraries(chat PRIVATE ggml)

0 commit comments

Comments
 (0)