forked from spiceai/spiceai
-
Notifications
You must be signed in to change notification settings - Fork 0
173 lines (155 loc) · 5.48 KB
/
integration_llms.yml
File metadata and controls
173 lines (155 loc) · 5.48 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
---
name: integration tests (llms)
on:
push:
branches:
- trunk
- release-*
- release/*
paths:
- 'crates/llms/**'
pull_request:
branches:
- trunk
- release-*
- release/*
paths:
- 'crates/llms/**'
merge_group:
branches:
- trunk
- release-*
- release/*
workflow_dispatch:
inputs:
run:
description: 'Which groups of models to run'
required: true
default: all
type: choice
options:
- all
- hosted
- self-hosted
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.ref_name == 'trunk' && github.sha || 'any-sha' }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
CARGO_NET_GIT_FETCH_WITH_CLI: true
# CI performance optimizations
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
CARGO_NET_RETRY: 10
CARGO_HTTP_TIMEOUT: 60
jobs:
setup-matrix:
name: Setup strategy matrix
runs-on: spiceai-dev-runners
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 matrix = [
{
name: 'self-hosted',
needs_env: false,
runner: 'spiceai-macos',
model_allowlist: 'local_phi3,hf_phi3'
},
{
name: 'hosted',
needs_env: true,
runner: 'spiceai-macos',
model_allowlist: 'anthropic,bedrock,openai,xai'
}
];
if (context.eventName === 'workflow_dispatch') {
const name = context.payload.inputs.run;
if (name === 'all') {
return matrix;
}
return matrix.filter(m => m.name === name);
}
// On pull_request, only run tests that don't require secrets
if (context.eventName === 'pull_request') {
return matrix.filter(m => !m.needs_env);
}
return matrix;
build:
name: Build Test Binary
runs-on: spiceai-macos
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
with:
fetch-depth: 1 # Shallow clone for faster checkout
- name: Set up Rust
uses: ./.github/actions/setup-rust
- name: Build LLMs integration test binary
env:
# Metal runners do not have `xcrun metal`
# See `https://github.com/EricLBuehler/mistral.rs/pull/1311`
MISTRALRS_METAL_PRECOMPILE: 0
run: |
TEST_BINARY_PATH=$(cargo test -p llms --test integration --features metal --no-run --message-format=json | jq -r 'select(.reason == "compiler-artifact" and (.target.kind | contains(["test"])) and .executable != null) | .executable')
cp $TEST_BINARY_PATH ./llms_integration_test
- name: Upload test binary
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: llms-integration-test-binary
path: ./llms_integration_test
retention-days: 1
test:
runs-on: ${{ matrix.target.runner }}
needs: [build, setup-matrix]
strategy:
matrix:
target: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
permissions: read-all
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
- name: Download test binary
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: llms-integration-test-binary
path: ./integration_test
- name: Mark test binary as executable
run: chmod +x ./integration_test/llms_integration_test
- name: Run integration test
env:
MODEL_ALLOWLIST: ${{ matrix.target.model_allowlist }}
SPICE_OPENAI_API_KEY: ${{ secrets.SPICE_SECRET_OPENAI_API_KEY }}
SPICE_ANTHROPIC_API_KEY: ${{ secrets.SPICE_SECRET_ANTHROPIC_API_KEY }}
SPICE_XAI_API_KEY: ${{ secrets.SPICE_SECRET_XAI_API_KEY }}
SPICE_BEDROCK_ACCESS_KEY: ${{ secrets.AWS_BEDROCK_KEY }}
SPICE_BEDROCK_SECRET_KEY: ${{ secrets.AWS_BEDROCK_SECRET }}
run: |
if [ "${{ matrix.target.needs_env }}" == "true" ]; then
if [ -z "$SPICE_OPENAI_API_KEY" ]; then
echo "Error: 'SPICE_OPENAI_API_KEY' is not defined."
exit 1
fi
if [ -z "$SPICE_ANTHROPIC_API_KEY" ]; then
echo "Error: 'SPICE_ANTHROPIC_API_KEY' is not defined."
exit 1
fi
if [ -z "$SPICE_XAI_API_KEY" ]; then
echo "Error: 'SPICE_XAI_API_KEY' is not defined."
exit 1
fi
export SPICE_BEDROCK_REGION="us-east-1"
if [ -z "$SPICE_BEDROCK_ACCESS_KEY" ]; then
echo "Error: 'SPICE_BEDROCK_ACCESS_KEY' is not defined."
exit 1
fi
if [ -z "$SPICE_BEDROCK_SECRET_KEY" ]; then
echo "Error: 'SPICE_BEDROCK_SECRET_KEY' is not defined."
exit 1
fi
fi
# `--test-threads` to reduce possible rate limiting/ connection issues for hosted models.
INSTA_WORKSPACE_ROOT="${PWD}" CARGO_MANIFEST_DIR="${PWD}" ./integration_test/llms_integration_test --nocapture -- llms::tests --test-threads=2