Skip to content

Commit 05af0b8

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 05af0b8

1 file changed

Lines changed: 77 additions & 1 deletion

File tree

‎.github/workflows/rust.yml‎

Lines changed: 77 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 minimize 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,70 @@ 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: Start Server
118+
env:
119+
GRPC_ROOT_PASSWORD: my-secret-password
120+
DIMENSION: "3"
121+
STORAGE_TYPE: inmemory
122+
INDEX_TYPE: flat
123+
GRPC_HOST: 0.0.0.0
124+
GRPC_PORT: "50051"
125+
DISABLE_HTTP: "true"
126+
run: |
127+
./target/debug/server > server.log 2>&1 &
128+
echo $! > server.pid
129+
130+
- name: Wait for server to be ready
131+
run: |
132+
for i in {1..30}; do
133+
if (echo > /dev/tcp/127.0.0.1/50051) 2>/dev/null; then
134+
echo "Server is up"
135+
exit 0
136+
fi
137+
sleep 1
138+
done
139+
echo "Server did not start in time"
140+
cat server.log
141+
exit 1
142+
143+
- name: Set Up Python
144+
uses: actions/setup-python@v5
145+
with:
146+
python-version: '3.12'
147+
cache: 'pip'
148+
149+
- name: Install Package and Dev Deps
150+
working-directory: client/python
151+
run: pip install -e ".[dev]"
152+
153+
- name: Run example scripts
154+
working-directory: client/python
155+
run: pytest examples/all.py -v
156+
157+
- name: Dump server logs on failure
158+
if: failure()
159+
run: cat server.log
160+
161+
- name: Stop server
162+
if: always()
163+
run: kill $(cat server.pid) 2>/dev/null || true

0 commit comments

Comments
 (0)