1+ name : CI
2+
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+ branches :
12+ - master
13+ paths : ['.github/workflows/**', '**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu']
14+ pull_request :
15+ types : [opened, synchronize, reopened]
16+ paths : ['**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu']
17+
18+ env :
19+ BRANCH_NAME : ${{ github.head_ref || github.ref_name }}
20+
21+ jobs :
22+ ubuntu-amd64-build :
23+ runs-on : ubuntu-20.04
24+ permissions :
25+ contents : write
26+ steps :
27+ - name : Clone
28+ id : checkout
29+ uses : actions/checkout@v3
30+ with :
31+ submodules : recursive
32+
33+ - name : Dependencies
34+ id : depends
35+ run : |
36+ sudo apt-get update
37+ sudo apt-get install build-essential gcc-8
38+
39+ - name : Build
40+ id : make_build
41+ run : |
42+ ./install_deps.sh
43+ mkdir build && cd build
44+ cmake ..
45+ CC=gcc-8 make -j $(nproc)
46+ ls -la
47+
48+ - name : Extract branch name
49+ shell : bash
50+ id : extract_branch
51+ run : echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
52+ - name : Extract commit short SHA
53+ id : extract_commit_id
54+ run : echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
55+
56+ - name : Package
57+ shell : bash
58+ run : |
59+ mkdir -p nitro && mkdir -p nitro/config
60+ cp config.json nitro/config/
61+ cp build/nitro nitro/
62+ zip -r nitro.zip nitro
63+
64+ - name : Upload binaries to release
65+ if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
66+ uses : svenstaro/upload-release-action@v2
67+ with :
68+ repo_token : ${{ secrets.GITHUB_TOKEN }}
69+ file : nitro.zip
70+ asset_name : nitro-${{ steps.extract_commit_id.outputs.sha_short }}-linux-amd64.zip
71+ tag : ${{ steps.extract_branch.outputs.branch }}-${{ steps.extract_commit_id.outputs.sha_short }}
72+
73+ ubuntu-amd64-cuda-build :
74+ runs-on : linux-gpu
75+ permissions :
76+ contents : write
77+ steps :
78+ - name : Clone
79+ id : checkout
80+ uses : actions/checkout@v3
81+ with :
82+ submodules : recursive
83+
84+ # - name: Dependencies
85+ # id: depends
86+ # run: |
87+ # sudo apt-get update
88+ # sudo apt-get install build-essential gcc-8 uuid-dev
89+
90+ - name : Build
91+ id : make_build
92+ run : |
93+ ./install_deps.sh
94+ mkdir build && cd build
95+ cmake -DLLAMA_CUBLAS=ON ..
96+ CC=gcc-8 make -j $(nproc)
97+ ls -la
98+
99+ - name : Extract branch name
100+ shell : bash
101+ id : extract_branch
102+ run : echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
103+
104+ - name : Extract commit short SHA
105+ id : extract_commit_id
106+ run : echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
107+
108+ - name : Package
109+ shell : bash
110+ run : |
111+ mkdir -p nitro && mkdir -p nitro/config
112+ cp config.json nitro/config/
113+ cp build/nitro nitro/
114+ zip -r nitro.zip nitro
115+
116+ - name : Upload binaries to release
117+ if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
118+ uses : svenstaro/upload-release-action@v2
119+ with :
120+ repo_token : ${{ secrets.GITHUB_TOKEN }}
121+ file : nitro.zip
122+ asset_name : nitro-${{ steps.extract_commit_id.outputs.sha_short }}-linux-amd64-cuda.zip
123+ tag : ${{ steps.extract_branch.outputs.branch }}-${{ steps.extract_commit_id.outputs.sha_short }}
124+
125+ macOS-M-build :
126+ runs-on : mac-silicon
127+ permissions :
128+ contents : write
129+ steps :
130+ - name : Clone
131+ id : checkout
132+ uses : actions/checkout@v3
133+ with :
134+ submodules : recursive
135+
136+ - name : Dependencies
137+ id : depends
138+ continue-on-error : true
139+ run : |
140+ brew update
141+ brew install cmake gcc@8
142+
143+ - name : Build
144+ id : cmake_build
145+ run : |
146+ ./install_deps.sh
147+ mkdir build && cd build
148+ cmake ..
149+ CC=gcc-8 make -j $(nproc)
150+ ls -la
151+
152+ - name : Extract branch name
153+ shell : bash
154+ id : extract_branch
155+ run : echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
156+
157+ - name : Extract commit short SHA
158+ id : extract_commit_id
159+ run : echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
160+
161+ - name : Package
162+ shell : bash
163+ run : |
164+ mkdir -p nitro && mkdir -p nitro/config
165+ cp config.json nitro/config/
166+ cp llama.cpp/ggml-metal.h nitro/
167+ cp build/nitro nitro/
168+ zip -r nitro.zip nitro
169+
170+ - name : Upload binaries to release
171+ if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
172+ uses : svenstaro/upload-release-action@v2
173+ with :
174+ repo_token : ${{ secrets.GITHUB_TOKEN }}
175+ file : nitro.zip
176+ asset_name : nitro-${{ steps.extract_commit_id.outputs.sha_short }}-mac-arm64.zip
177+ tag : ${{ steps.extract_branch.outputs.branch }}-${{ steps.extract_commit_id.outputs.sha_short }}
178+
179+ macOS-Intel-build :
180+ runs-on : macos-latest
181+ permissions :
182+ contents : write
183+ steps :
184+ - name : Clone
185+ id : checkout
186+ uses : actions/checkout@v3
187+ with :
188+ submodules : recursive
189+
190+ - name : Dependencies
191+ id : depends
192+ continue-on-error : true
193+ run : |
194+ brew update
195+
196+ - name : Build
197+ id : cmake_build
198+ run : |
199+ ./install_deps.sh
200+ mkdir build && cd build
201+ cmake -DLLAMA_METAL=OFF ..
202+ CC=gcc-8 make -j $(nproc)
203+ ls -la
204+
205+ - name : Extract branch name
206+ shell : bash
207+ id : extract_branch
208+ run : echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
209+
210+ - name : Extract commit short SHA
211+ id : extract_commit_id
212+ run : echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
213+
214+ - name : Package
215+ shell : bash
216+ run : |
217+ mkdir -p nitro && mkdir -p nitro/config
218+ cp config.json nitro/config/
219+ cp build/nitro nitro/
220+ zip -r nitro.zip nitro
221+
222+ - name : Upload binaries to release
223+ if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
224+ uses : svenstaro/upload-release-action@v2
225+ with :
226+ repo_token : ${{ secrets.GITHUB_TOKEN }}
227+ file : nitro.zip
228+ asset_name : nitro-${{ steps.extract_commit_id.outputs.sha_short }}-mac-amd64.zip.zip
229+ tag : ${{ steps.extract_branch.outputs.branch }}-${{ steps.extract_commit_id.outputs.sha_short }}
0 commit comments