-
Notifications
You must be signed in to change notification settings - Fork 4
237 lines (201 loc) · 7.68 KB
/
main.yml
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
name: "Build and test"
on:
pull_request:
push:
permissions:
contents: write
jobs:
cargo-build-linux:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
target:
- "x86_64-unknown-linux-gnu"
profile:
- "debug"
- "release"
steps:
- uses: actions/checkout@v4
- name: "Cache Cargo Home"
uses: actions/cache@v4
with:
path: |
~/.cargo
nobodywho/target
key: ${{ runner.os }}-cargo-home-${{ matrix.target }}-${{ matrix.profile }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-home-${{ matrix.target }}-${{ matrix.profile }}-
- name: "Setup rust toolchain"
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
. "$HOME/.cargo/env"
rustup update stable
rustup default stable
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: "Install distro dependencies"
run: |
sudo apt-get update
sudo apt-get install -y libclang-dev cmake libshaderc-dev libvulkan-dev glslc
- name: "Compile for linux"
run: cargo build --verbose ${{ matrix.profile == 'release' && '--release' || '' }}
working-directory: ./nobodywho
- name: "Rename built file"
run: cp ./nobodywho/target/${{ matrix.profile }}/libnobodywho.so ./nobodywho-${{ matrix.target }}-${{ matrix.profile }}.so
- name: "Upload build artifact"
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}-${{ matrix.profile }}
path: ./nobodywho-${{ matrix.target }}-${{ matrix.profile }}.so
cargo-build-windows:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
target:
- "x86_64-pc-windows-msvc"
profile:
- "debug"
- "release"
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: "Cache Cargo Home"
uses: actions/cache@v4
with:
path: ~/.cargo
key: ${{ runner.os }}-cargo-home-${{ matrix.target }}-${{ matrix.profile }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-home-${{ matrix.target }}-${{ matrix.profile }}-
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
- name: Install Vulkan SDK
uses: jakoch/install-vulkan-sdk-action@v1.0.0
with:
vulkan_version: 1.3.296.0
install_runtime: true
cache: true
stripdown: true
- name: Build with Cargo
run: cargo build --verbose --target ${{ matrix.target }} ${{ matrix.profile == 'release' && '--release' || '' }}
working-directory: nobodywho
- name: "Rename built file"
run: cp ./nobodywho/target/${{ matrix.target }}/${{ matrix.profile }}/nobodywho.dll ./nobodywho-${{ matrix.target }}-${{ matrix.profile }}.dll
- name: "Upload build artifacts"
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}-${{ matrix.profile }}
path: ./nobodywho-${{ matrix.target }}-${{ matrix.profile }}.dll
cargo-build-macos:
runs-on: macos-15
strategy:
fail-fast: false
matrix:
target:
- "x86_64-apple-darwin"
- "aarch64-apple-darwin"
profile:
- "debug"
- "release"
steps:
- uses: actions/checkout@v4
- name: "Cache Cargo Home"
uses: actions/cache@v4
with:
path: ~/.cargo
key: ${{ runner.os }}-cargo-home-${{ matrix.target }}-${{ matrix.profile }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-home-${{ matrix.target }}-${{ matrix.profile }}-
- run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
. "$HOME/.cargo/env"
rustup update stable
rustup default stable
rustup target add ${{ matrix.target }}
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- run: cargo build --verbose ${{ matrix.profile == 'release' && '--release' || '' }}
working-directory: ./nobodywho
- name: "Rename built file"
run: cp ./nobodywho/target/${{ matrix.profile }}/libnobodywho.dylib ./nobodywho-${{ matrix.target }}-${{ matrix.profile }}.dylib
- name: "Upload build artifact"
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}-${{ matrix.profile }}
path: ./nobodywho-${{ matrix.target }}-${{ matrix.profile }}.dylib
cargo-test:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: "Cache Cargo Home"
uses: actions/cache@v4
with:
path: |
~/.cargo
nobodywho/target
key: ${{ runner.os }}-cargo-home-${{ matrix.target }}-${{ matrix.profile }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-home-${{ matrix.target }}-${{ matrix.profile }}-
- name: "Set up rust toolchain"
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
. "$HOME/.cargo/env"
rustup update stable
rustup default stable
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: "Install deps from distro"
run: |
sudo apt-get update
sudo apt-get install -y libclang-dev cmake libshaderc-dev libvulkan-dev glslc mesa-vulkan-drivers
- name: "Download test model"
run: wget "https://huggingface.co/bartowski/gemma-2-2b-it-GGUF/resolve/main/gemma-2-2b-it-Q5_K_M.gguf" -O ./nobodywho/model.gguf
- name: "Download embeddings model"
run: wget "https://huggingface.co/CompendiumLabs/bge-small-en-v1.5-gguf/resolve/main/bge-small-en-v1.5-q8_0.gguf" -O ./nobodywho/embeddings.gguf
- name: "Run unit tests"
run: cargo test -- --nocapture --test-threads=1
working-directory: ./nobodywho
zip-distributable:
needs: [cargo-build-linux, cargo-build-macos, cargo-build-windows]
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: "Download all build artifacts"
uses: actions/download-artifact@v4
with:
path: ./artifacts
- name: "Make directory structure for release zip"
run: |
mkdir -p nobodywho-release/bin/addons/nobodywho
# copy in nobodywho libs
cp ./artifacts/*/*nobodywho* ./nobodywho-release/bin/addons/nobodywho/
# copy in gdextension metadata
cp ./nobodywho/nobodywho.gdextension ./nobodywho-release/bin/addons/nobodywho/
cp ./assets/icon.svg ./nobodywho-release/bin/addons/nobodywho/
- name: "Upload zipped build artifacts"
uses: actions/upload-artifact@v4
with:
name: nobodywho-all-platforms
path: ./nobodywho-release
create-github-release:
needs: [zip-distributable, cargo-test]
runs-on: ubuntu-24.04
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: "Download build artifacts"
uses: actions/download-artifact@v4
with:
name: nobodywho-all-platforms
path: ./nobodywho-release
- name: "Make zip file"
working-directory: ./nobodywho-release
run: zip -r "../nobodywho-${{ github.ref_name }}.zip" ./**
- name: "Create GitHub Release"
uses: softprops/action-gh-release@v1
with:
files: "./nobodywho-${{ github.ref_name }}.zip"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}