Skip to content

Commit 525d625

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

1 file changed

Lines changed: 148 additions & 0 deletions

File tree

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

0 commit comments

Comments
 (0)