Skip to content

Commit f6a7c52

Browse files
add lightspeed evaluation e2e tests
1 parent 6d7c76a commit f6a7c52

1 file changed

Lines changed: 143 additions & 0 deletions

File tree

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
name: E2E Tests for Lightspeed Evaluation
2+
3+
on: [push, pull_request_target]
4+
5+
jobs:
6+
e2e_tests:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
fail-fast: false
10+
11+
name: "E2E Tests for Lightspeed Evaluation job"
12+
13+
env:
14+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
15+
E2E_OPENAI_MODEL: ${{ vars.E2E_OPENAI_MODEL }}
16+
FAISS_VECTOR_STORE_ID: ${{ vars.FAISS_VECTOR_STORE_ID }}
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
with:
22+
# On PR_TARGET → the fork (or same repo) that opened the PR.
23+
# On push → falls back to the current repository.
24+
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
25+
26+
# On PR_TARGET → the PR head *commit* (reproducible).
27+
# On push → the pushed commit that triggered the workflow.
28+
ref: ${{ github.event.pull_request.head.ref || github.sha }}
29+
30+
# Don’t keep credentials when running untrusted PR code under PR_TARGET.
31+
persist-credentials: ${{ github.event_name != 'pull_request_target' }}
32+
33+
- name: Verify actual git checkout result
34+
run: |
35+
echo "=== Git Status After Checkout ==="
36+
echo "Remote URLs:"
37+
git remote -v
38+
echo ""
39+
echo "Current branch: $(git branch --show-current 2>/dev/null || echo 'detached HEAD')"
40+
echo "Current commit: $(git rev-parse HEAD)"
41+
echo "Current commit message: $(git log -1 --oneline)"
42+
echo ""
43+
echo "=== Recent commits ==="
44+
git log --oneline -5
45+
46+
- name: Checkout lightspeed-Evaluation
47+
uses: actions/checkout@v4
48+
with:
49+
repository: lightspeed-core/lightspeed-evaluation
50+
path: lightspeed-evaluation
51+
52+
- name: Load lightspeed-stack.yaml configuration
53+
run: |
54+
CONFIG_FILE="./lightspeed-evaluation/tests/integration/lightspeed-stack.yaml"
55+
56+
if [ ! -f "${CONFIG_FILE}" ]; then
57+
echo "❌ Configuration file not found: ${CONFIG_FILE}"
58+
exit 1
59+
fi
60+
61+
cp "${CONFIG_FILE}" lightspeed-stack.yaml
62+
echo "✅ Configuration loaded successfully"
63+
64+
- name: Select and configure run.yaml
65+
run: |
66+
CONFIG_FILE="./lightspeed-evaluation/tests/integration/run.yaml"
67+
68+
if [ ! -f "${CONFIG_FILE}" ]; then
69+
echo "❌ Configuration file not found: ${CONFIG_FILE}"
70+
exit 1
71+
fi
72+
73+
cp "$CONFIG_FILE" run.yaml
74+
75+
- name: Show final configuration
76+
run: |
77+
echo "=== Configuration Preview ==="
78+
echo "Providers: $(grep -c "provider_id:" run.yaml)"
79+
echo "Models: $(grep -c "model_id:" run.yaml)"
80+
echo ""
81+
echo "=== lightspeed-stack.yaml ==="
82+
grep -A 3 "llama_stack:" lightspeed-stack.yaml
83+
84+
- name: Run services (Library Mode)
85+
env:
86+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
87+
run: |
88+
echo "Starting service in library mode (1 container)"
89+
docker compose -f docker-compose-library.yaml up -d
90+
91+
if docker compose -f docker-compose-library.yaml ps | grep -E 'Exit|exited|stopped'; then
92+
echo "Service failed to start - showing logs:"
93+
docker compose -f docker-compose-library.yaml logs
94+
exit 1
95+
else
96+
echo "Service started successfully"
97+
fi
98+
99+
- name: Wait for the LSC
100+
run: |
101+
echo "Waiting for service on port 8080..."
102+
for i in {1..30}; do
103+
if curl --output /dev/null --fail http://localhost:8080/v1/models ; then
104+
echo "Service is up!"
105+
exit 0
106+
fi
107+
docker compose -f docker-compose-library.yaml logs --tail=30
108+
echo "Still waiting..."
109+
sleep 2
110+
done
111+
112+
echo "Service did not start in time"
113+
exit 1
114+
115+
- name: Run lightspeed evaluation e2e tests
116+
env:
117+
TERM: xterm-256color
118+
FORCE_COLOR: 1
119+
run: |
120+
cd lightspeed-evaluation
121+
echo "Installing e2e tests dependencies"
122+
pip install --break-system-packages uv
123+
uv sync
124+
125+
echo "Running e2e test suite..."
126+
make e2e_tests_lcore
127+
128+
- name: Show logs on failure
129+
if: failure()
130+
run: |
131+
echo "=== Test failure logs ==="
132+
echo "=== lightspeed-stack (library mode) logs ==="
133+
docker compose -f docker-compose-library.yaml logs lightspeed-stack
134+
135+
136+
# Cleanup
137+
- name: Stop the LSC if in local devel
138+
if: ${{ always() && env.ACT }}
139+
run: |
140+
echo "Stopping containers"
141+
echo "++++++++++++++++++++++"
142+
sleep 2
143+
docker compose -f docker-compose-library.yaml down --rmi all

0 commit comments

Comments
 (0)