Skip to content

Commit 63ffd63

Browse files
committed
Update Rust actions workflow
- Add integration test workflow for Python client against a built server - Update udeps CI workflow to use cargo-binstall internally
1 parent b621a2a commit 63ffd63

1 file changed

Lines changed: 83 additions & 1 deletion

File tree

‎.github/workflows/rust.yml‎

Lines changed: 83 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ jobs:
4242
- name: Run Tests
4343
run: cargo test --verbose
4444

45+
- name: Upload Server binary
46+
uses: actions/upload-artifact@v4
47+
with:
48+
name: server-binary
49+
path: target/debug/server
50+
4551
udeps:
4652
name: Unused Dependencies (cargo-udeps)
4753
runs-on: ubuntu-latest
@@ -58,8 +64,11 @@ jobs:
5864
- name: Install protoc for gRPC server
5965
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
6066

67+
# Using binstall to maximise workflow speed
6168
- name: Install cargo-udeps
62-
run: cargo +nightly install cargo-udeps --locked
69+
uses: taiki-e/install-action@v2
70+
with:
71+
tool: cargo-udeps
6372

6473
- name: Run cargo-udeps
6574
run: cargo +nightly udeps --workspace --all-targets --all-features
@@ -85,3 +94,76 @@ jobs:
8594

8695
- name: Check TOML formatting with taplo
8796
run: taplo format --check
97+
98+
integration:
99+
name: Integration Test
100+
needs: build_and_test
101+
runs-on: ubuntu-latest
102+
steps:
103+
- name: Checkout Repository
104+
uses: actions/checkout@v4
105+
106+
- name: Download server binary
107+
uses: actions/download-artifact@v4
108+
with:
109+
name: server-binary
110+
path: target/debug
111+
112+
# This is very IMP. Kept crashing without it
113+
# File permissions are not maintained during artifact upload (upload-artifact@v4)
114+
- name: Make binary executable
115+
run: chmod +x target/debug/server
116+
117+
- name: Write keys file
118+
run: |
119+
cat > keys.json <<'EOF'
120+
{"keys":[{"name":"ci-admin","role":"readwrite","key":"my-secret-password"}]}
121+
EOF
122+
123+
- name: Start Server
124+
env:
125+
VORTEXDB_KEYS_FILE: keys.json
126+
DIMENSION: "3"
127+
STORAGE_TYPE: inmemory
128+
INDEX_TYPE: flat
129+
GRPC_HOST: 0.0.0.0
130+
GRPC_PORT: "50051"
131+
DISABLE_HTTP: "true"
132+
run: |
133+
./target/debug/server > server.log 2>&1 &
134+
echo $! > server.pid
135+
136+
- name: Wait for server to be ready
137+
run: |
138+
for i in {1..30}; do
139+
if (echo > /dev/tcp/127.0.0.1/50051) 2>/dev/null; then
140+
echo "Server is up"
141+
exit 0
142+
fi
143+
sleep 1
144+
done
145+
echo "Server did not start in time"
146+
cat server.log
147+
exit 1
148+
149+
- name: Set Up Python
150+
uses: actions/setup-python@v5
151+
with:
152+
python-version: '3.12'
153+
cache: 'pip'
154+
155+
- name: Install Package and Dev Deps
156+
working-directory: client/python
157+
run: pip install -e ".[dev]"
158+
159+
- name: Run example scripts
160+
working-directory: client/python
161+
run: pytest examples/all.py -v
162+
163+
- name: Dump server logs on failure
164+
if: failure()
165+
run: cat server.log
166+
167+
- name: Stop server
168+
if: always()
169+
run: kill $(cat server.pid) 2>/dev/null || true

0 commit comments

Comments
 (0)