forked from spiceai/spiceai
-
Notifications
You must be signed in to change notification settings - Fork 0
300 lines (262 loc) · 9.47 KB
/
Copy pathbuild_and_release_cuda.yml
File metadata and controls
300 lines (262 loc) · 9.47 KB
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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
name: build_and_release_cuda
on:
pull_request:
branches:
- trunk
paths:
- 'crates/llms/Cargo.toml'
push:
tags:
- v*
paths-ignore:
- '**/*.md'
- 'docs/**'
- 'README.md'
- 'Makefile'
- 'CONTRIBUTING.md'
- 'SECURITY.md'
- 'LICENSE'
- '.github/**'
- 'version.txt'
- '.schema/**'
- '.vscode/**'
- 'deploy/**'
- 'install/**'
- 'media/**'
- 'monitoring/**'
- 'acknowledgements.md'
- 'Dockerfile*'
workflow_dispatch:
inputs:
platform_option:
description: 'Which platform do you want to run on? (Default is ALL)'
required: false
type: choice
options:
- 'all'
- 'Linux x64'
default: 'all'
compute_cap:
description: 'Which CUDA compute capability to build for? (Default is ALL)'
required: false
type: choice
options:
- 'all'
- '80'
- '86'
- '87'
- '89'
- '90'
default: 'all'
profile_option:
description: 'Which Rust build profile to use? (Default is release)'
required: false
type: choice
options:
- 'release'
- 'release-lto'
default: 'release'
jobs:
setup-matrix:
name: Setup CUDA matrix
runs-on: ubuntu-24.04
outputs:
matrix: ${{ steps.setup-matrix.outputs.result }}
steps:
- name: Set up matrix
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
id: setup-matrix
with:
script: |
const isTaggedRelease = context.ref.startsWith('refs/tags/v');
const runner = isTaggedRelease ? "ubuntu-24.04-16core" : "spiceai-dev-large-runners";
const matrix = [
{
compute_cap: "80",
runner: runner,
target_os: "linux",
target_arch: "x86_64"
},
{
compute_cap: "86",
runner: runner,
target_os: "linux",
target_arch: "x86_64"
},
{
compute_cap: "87",
runner: runner,
target_os: "linux",
target_arch: "x86_64"
},
{
compute_cap: "89",
runner: runner,
target_os: "linux",
target_arch: "x86_64"
},
{
compute_cap: "90",
runner: runner,
target_os: "linux",
target_arch: "x86_64"
}
];
// If running via workflow_dispatch, filter based on input
if (context.eventName === 'workflow_dispatch') {
const platform_option = context.payload.inputs.platform_option;
const compute_cap = context.payload.inputs.compute_cap;
let filtered = matrix;
// Filter by platform if specified
if (platform_option !== 'all') {
filtered = filtered.filter(m => m.target_os === 'linux');
}
// Filter by compute capability if specified
if (compute_cap !== 'all') {
filtered = filtered.filter(m => m.compute_cap === compute_cap);
}
return filtered;
}
// For `on.pull_request`, only build 90 compute capability on Linux.
if (context.eventName === 'pull_request') {
return matrix.filter(m => m.compute_cap === "90" && m.target_os === "linux");
}
return matrix;
build:
name: Build CUDA ${{ matrix.target.compute_cap }} binaries
runs-on: ${{ matrix.target.runner }}
needs: setup-matrix
env:
RUST_PROFILE: ${{ github.event.inputs.profile_option || 'release' }}
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
CARGO_NET_GIT_FETCH_WITH_CLI: true
strategy:
fail-fast: false
matrix:
target: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
- name: Set REL_VERSION from version.txt
run: python3 ./.github/scripts/get_release_version.py
- name: Set up Rust
uses: ./.github/actions/setup-rust
- name: Set up wget
if: matrix.target.target_os == 'linux'
run: sudo apt-get update && sudo apt-get install wget -y
- name: Set up make
if: matrix.target.target_os == 'linux'
uses: ./.github/actions/setup-make
with:
os: ${{ matrix.target.target_os }}
- name: Set up cc
if: matrix.target.target_os == 'linux'
uses: ./.github/actions/setup-cc
- name: Install protoc
uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Run Spiced CUDA Build
uses: ./.github/actions/spiced-cuda-build
with:
cuda-version: '12.6.0'
cuda-compute-capability: ${{ matrix.target.compute_cap }}
artifact-tag: ${{ matrix.target.target_os }}_${{ matrix.target.target_arch }}
target_os: ${{ matrix.target.target_os }}
rust-profile: ${{ env.RUST_PROFILE }}
publish-minio:
name: Publish linux-x86_64 CUDA binaries to Minio
runs-on: spiceai-dev-runners
needs: build
env:
ARTIFACT_DIR: ./release
MINIO_ENDPOINT: ${{ secrets.MINIO_ENDPOINT }}
MINIO_ACCESS_KEY: ${{ secrets.MINIO_ACCESS_KEY }}
MINIO_SECRET_KEY: ${{ secrets.MINIO_SECRET_KEY }}
COMMIT_SHA: ${{ github.sha }}
RUST_PROFILE: ${{ github.event.inputs.profile_option || 'release' }}
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
- name: Create artifact directory
run: mkdir -p ${{ env.ARTIFACT_DIR }}
# Download all Linux CUDA artifacts
- name: Download Linux CUDA artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
continue-on-error: true
with:
pattern: spiced_cuda_*_linux_x86_64
path: ${{ env.ARTIFACT_DIR }}
merge-multiple: true
- name: Upload artifacts to Minio
run: |
sudo apt-get update
sudo apt-get install wget -y
sudo wget https://dl.min.io/client/mc/release/linux-amd64/mc -O /usr/local/bin/mc
sudo chmod +x /usr/local/bin/mc
mc alias set spice-minio ${{ env.MINIO_ENDPOINT }} ${{ env.MINIO_ACCESS_KEY }} ${{ env.MINIO_SECRET_KEY }}
# Upload any CUDA artifacts that were successfully built
for file in ${{ env.ARTIFACT_DIR }}/spiced_cuda_*_linux_x86_64.tar.gz; do
if [ -f "$file" ]; then
echo "Uploading $file to Minio..."
mc cp "$file" spice-minio/artifacts/spiced/linux-x86_64/${{ env.COMMIT_SHA }}/
fi
done
publish:
name: Publish CUDA binaries
needs: build
if: startswith(github.ref, 'refs/tags/v') && github.event_name != 'pull_request'
env:
ARTIFACT_DIR: ./release
RUST_PROFILE: ${{ github.event.inputs.profile_option || 'release' }}
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
- name: Create artifact directory
run: mkdir -p ${{ env.ARTIFACT_DIR }}
- name: Set REL_VERSION from version.txt
run: python3 ./.github/scripts/get_release_version.py
# Download all CUDA artifacts for this platform
- name: Download CUDA artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
continue-on-error: true
with:
path: ${{ env.ARTIFACT_DIR }}
merge-multiple: true
- name: List artifacts
run: ls -l ${{ env.ARTIFACT_DIR }}
- name: Publish CUDA binaries to GitHub
run: |
# Parse repository to get owner and repo names
OWNER_NAME="${GITHUB_REPOSITORY%%/*}"
REPO_NAME="${GITHUB_REPOSITORY#*/}"
export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
# First check if we have any files to upload
if [ -z "$(ls -A ${ARTIFACT_DIR})" ]; then
echo "No artifacts found in ${ARTIFACT_DIR}"
exit 1
fi
# Create an array of actual files (no globs)
RELEASE_ARTIFACTS=()
for file in ${ARTIFACT_DIR}/*; do
if [ -f "$file" ]; then
RELEASE_ARTIFACTS+=("$file")
fi
done
# Delete existing release artifact
python ./.github/scripts/github_release.py delete \
--owner $OWNER_NAME --repo $REPO_NAME \
--tag "v${{ env.REL_VERSION }}" \
"${RELEASE_ARTIFACTS[@]}"
if [ "$LATEST_RELEASE" = "true" ]; then
export RELEASE_BODY=`cat ./docs/release_notes/v${{ env.REL_VERSION }}.md`
else
export RELEASE_BODY="This is the release candidate ${{ env.REL_VERSION }}"
fi
echo "Uploading Spice.ai CUDA Binaries to GitHub Release"
python ./.github/scripts/github_release.py upload \
--owner $OWNER_NAME --repo $REPO_NAME \
--tag "v${{ env.REL_VERSION }}" \
--release-name "v${{ env.REL_VERSION }}" \
--body "${RELEASE_BODY}" \
--prerelease "$PRE_RELEASE" \
"${RELEASE_ARTIFACTS[@]}"