|
42 | 42 | - name: Run Tests |
43 | 43 | run: cargo test --verbose |
44 | 44 |
|
| 45 | + - name: Upload Server binary |
| 46 | + uses: actions/upload-artifact@v4 |
| 47 | + with: |
| 48 | + name: server-binary |
| 49 | + path: target/debug/server |
| 50 | + |
45 | 51 | udeps: |
46 | 52 | name: Unused Dependencies (cargo-udeps) |
47 | 53 | runs-on: ubuntu-latest |
|
58 | 64 | - name: Install protoc for gRPC server |
59 | 65 | run: sudo apt-get update && sudo apt-get install -y protobuf-compiler |
60 | 66 |
|
| 67 | + # Using binstall to maximise workflow speed |
61 | 68 | - 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 |
63 | 72 |
|
64 | 73 | - name: Run cargo-udeps |
65 | 74 | run: cargo +nightly udeps --workspace --all-targets --all-features |
|
85 | 94 |
|
86 | 95 | - name: Check TOML formatting with taplo |
87 | 96 | 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