-
Notifications
You must be signed in to change notification settings - Fork 0
246 lines (216 loc) · 7.8 KB
/
build.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
name: CI
on:
workflow_dispatch: # allows manual triggering
inputs:
create_release:
description: 'Create new release'
required: true
type: boolean
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
jobs:
build-release-ubuntu-2004:
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- build: 'openblas'
defines: '-DLLAMA_BLAS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS'
- build: 'cublas'
defines: '-DLLAMA_CUBLAS=ON'
steps:
- name: Clone
id: checkout
uses: actions/checkout@v1
- name: Common dependencies
id: depends
run: |
sudo apt-get update
sudo apt-get install -y build-essential libpython3-dev
python3 -m pip install cmake
python3 -m pip install torch --index-url https://download.pytorch.org/whl/cpu
python3 -m pip install transformers==4.33.3 tiktoken pygls pyinstaller
- name: OpenBLAS dependencies
id: depends_openblas
if: ${{ matrix.build == 'openblas' }}
run: |
sudo apt-get install -y libopenblas-dev
- uses: Jimver/[email protected]
id: cuda-toolkit
if: ${{ matrix.build == 'cublas' }}
with:
cuda: '11.8.0'
- name: Build backend server
id: cmake_build_backend_server
run: |
cmake -B build_backend_server -S . -DLLAMA_NATIVE=OFF ${{ matrix.defines }}
cmake --build build_backend_server --config Release
- name: Build lsp server
id: pyinstaller_build_lsp_server
run: |
pyinstaller flatline_lsp.py \
--copy-metadata tqdm \
--copy-metadata regex \
--copy-metadata requests \
--copy-metadata packaging \
--copy-metadata filelock \
--copy-metadata numpy \
--copy-metadata tokenizers \
--copy-metadata huggingface-hub \
--copy-metadata safetensors \
--copy-metadata pyyaml \
--copy-metadata torch \
--hidden-import=tiktoken_ext.openai_public \
--hidden-import=tiktoken_ext \
;
- name: Make package
id: make_package
run: |
mkdir -p ./dist/flatline_lsp/_internal/flatline/model_data
mkdir -p ./dist/flatline_lsp/_internal/flatline/backend_server
mv build_backend_server/bin/flatline-server ./dist/flatline_lsp/_internal/flatline/backend_server/flatline-server
mkdir -p ./dist/flatline_lsp/license
find build_backend_server/bin -name \*.LICENSE.txt | xargs -I{} cp {} ./dist/flatline_lsp/license/
cd dist
zip -ry flatline_lsp_ubuntu2004_${{ matrix.build }}.zip flatline_lsp
- name: Upload package
id: upload_package
uses: actions/upload-artifact@v3
with:
name: flatline_lsp_ubuntu2004_${{ matrix.build }}.zip
path: dist/flatline_lsp_ubuntu2004_${{ matrix.build }}.zip
create-release:
runs-on: ubuntu-latest
needs: [build-release-ubuntu-2004]
steps:
- name: Get Commit ID
id: get_commit_id
run: |
COMMIT_ID=$(echo ${{ github.sha }} | head -c 7)
echo "::set-output name=commit_id::${COMMIT_ID}"
- name: Download all artifact
id: download-all-artifact
uses: actions/download-artifact@v3
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v0.0.0_${{ steps.get_commit_id.outputs.commit_id }}
release_name: Release v0.0.0_${{ steps.get_commit_id.outputs.commit_id }}
body: |
Release test
draft: false
prerelease: true
- name: Upload release openblas asset
id: upload_release_openblas_asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: flatline_lsp_ubuntu2004_openblas.zip/flatline_lsp_ubuntu2004_openblas.zip
asset_name: flatline_lsp_ubuntu2004_openblas.zip
asset_content_type: application/zip
- name: Upload release cublas asset
id: upload_release_cublas_asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: flatline_lsp_ubuntu2004_cublas.zip/flatline_lsp_ubuntu2004_cublas.zip
asset_name: flatline_lsp_ubuntu2004_cublas.zip
asset_content_type: application/zip
test-on-ubuntu-2004:
runs-on: ubuntu-20.04
needs: [create-release]
strategy:
matrix:
include:
- build: 'openblas'
- build: 'cublas'
steps:
- name: Clone
id: checkout
uses: actions/checkout@v1
- name: Get Commit ID
id: get_commit_id
run: |
COMMIT_ID=$(echo ${{ github.sha }} | head -c 7)
echo "::set-output name=commit_id::${COMMIT_ID}"
- name: Common dependencies
id: depends
run: |
sudo apt-get update
- name: OpenBLAS dependencies
id: depends_openblas
if: ${{ matrix.build == 'openblas' }}
run: |
sudo apt-get install -y libopenblas0
- uses: Jimver/[email protected]
id: cuda-toolkit
if: ${{ matrix.build == 'cublas' }}
with:
cuda: '11.8.0'
- name: Unit test
id: unit_test
run: |
python3 -m pip install torch --index-url https://download.pytorch.org/whl/cpu
python3 -m pip install transformers==4.33.3 tiktoken pygls pyinstaller
pip install pytest
python3 -m pytest tests
- name: Install and test
id: install_and_test
run: |
curl -L https://raw.githubusercontent.com/okdshin/flatline_lsp/main/install.sh | bash -s -- -b ${{ matrix.build }} -r v0.0.0_${{ steps.get_commit_id.outputs.commit_id }}
$HOME/.flatline_lsp/_internal/flatline/backend_server/flatline-server --help
$HOME/.flatline_lsp/flatline_lsp --help
test-on-ubuntu-2204:
runs-on: ubuntu-22.04
needs: [create-release]
strategy:
matrix:
include:
- build: 'openblas'
- build: 'cublas'
steps:
- name: Clone
id: checkout
uses: actions/checkout@v1
- name: Get Commit ID
id: get_commit_id
run: |
COMMIT_ID=$(echo ${{ github.sha }} | head -c 7)
echo "::set-output name=commit_id::${COMMIT_ID}"
- name: Common dependencies
id: depends
run: |
sudo apt-get update
- name: OpenBLAS dependencies
id: depends_openblas
if: ${{ matrix.build == 'openblas' }}
run: |
sudo apt-get install -y libopenblas0
- uses: Jimver/[email protected]
id: cuda-toolkit
if: ${{ matrix.build == 'cublas' }}
with:
cuda: '11.8.0'
- name: Unit test
id: unit_test
run: |
python3 -m pip install torch --index-url https://download.pytorch.org/whl/cpu
python3 -m pip install transformers==4.33.3 tiktoken pygls pyinstaller
pip install pytest
python3 -m pytest tests
- name: Install and test
id: install_and_test
run: |
curl -L https://raw.githubusercontent.com/okdshin/flatline_lsp/main/install.sh | bash -s -- -b ${{ matrix.build }} -r v0.0.0_${{ steps.get_commit_id.outputs.commit_id }}
$HOME/.flatline_lsp/_internal/flatline/backend_server/flatline-server --help
$HOME/.flatline_lsp/flatline_lsp --help