Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .github/workflows/build-and-test-in-memory.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: In-Memory VSS Server CI

on:
push:
branches: [ main ]
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test-in-memory:
runs-on: ubuntu-latest
timeout-minutes: 6

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Create in-memory config
run: |
mkdir -p rust/server
cat > rust/server/vss-server-config.toml <<EOF
[server_config]
host = "127.0.0.1"
port = 8080
store_type = "in_memory"
EOF

- name: Build server
working-directory: rust
run: cargo build --release --bin vss-server

- name: Start VSS server
working-directory: rust
run: |
./target/release/vss-server ./server/vss-server-config.toml > server.log 2>&1 &
echo "Server PID: $!"

- name: Wait for server
run: |
for i in {1..15}; do
if curl -s http://127.0.0.1:8080 > /dev/null; then
echo "Server is up!"
exit 0
fi
sleep 1
done
echo "Server failed. Dumping log:"
cat rust/server.log
exit 1

- name: HTTP Smoke Test
run: |
curl -f \
-H "Authorization: Bearer test_user" \
--data-binary @<(echo "0A04746573741A150A026B3110FFFFFFFFFFFFFFFFFF011A046B317631" | xxd -r -p) \
http://127.0.0.1:8080/vss/putObjects

RESPONSE=$(curl -f \
-H "Authorization: Bearer test_user" \
--data-binary @<(echo "0A047465737412026B31" | xxd -r -p) \
http://127.0.0.1:8080/vss/getObject)

- name: Run In-Memory unit tests
working-directory: rust
run: cargo test --package impls --lib -- in_memory_store::tests --nocapture
104 changes: 94 additions & 10 deletions .github/workflows/ldk-node-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ concurrency:
cancel-in-progress: true

jobs:
build-and-test:
test-postgres:
runs-on: ubuntu-latest

timeout-minutes: 30
services:
postgres:
image: postgres:latest
ports:
- 5432:5432
ports: [5432:5432]
env:
POSTGRES_DB: postgres
POSTGRES_USER: postgres
Expand All @@ -30,20 +29,105 @@ jobs:
uses: actions/checkout@v3
with:
path: vss-server

- name: Checkout LDK Node
uses: actions/checkout@v3
with:
repository: lightningdevkit/ldk-node
path: ldk-node

- name: Build and Deploy VSS Server
- name: Create Postgres config
run: |
mkdir -p vss-server/rust/server
cat > vss-server/rust/server/vss-server-config.toml <<EOF
[server_config]
host = "127.0.0.1"
port = 8080
store_type = "postgres"
[postgresql_config]
host = "localhost"
port = 5432
database = "postgres"
username = "postgres"
password = "postgres"
EOF

- name: Build & Start VSS Server
working-directory: vss-server/rust
run: |
cd vss-server/rust
cargo build
cargo run server/vss-server-config.toml&
cargo build --release --bin vss-server
./target/release/vss-server ./server/vss-server-config.toml > server.log 2>&1 &
echo "Server PID: $!"

- name: Wait for VSS
run: |
for i in {1..30}; do
if curl -s http://127.0.0.1:8080/vss > /dev/null; then
echo "VSS ready"
exit 0
fi
sleep 2
done
echo "VSS failed:"
cat vss-server/rust/vss.log
exit 1

- name: Run LDK Node Integration tests
working-directory: ldk-node
run: |
cd ldk-node
export TEST_VSS_BASE_URL="http://localhost:8080/vss"
export TEST_VSS_BASE_URL="http://127.0.0.1:8080/vss"
RUSTFLAGS="--cfg vss_test" cargo test io::vss_store
RUSTFLAGS="--cfg vss_test" cargo test --test integration_tests_vss

test-in-memory:
runs-on: ubuntu-latest
timeout-minutes: 30

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
path: vss-server

- name: Checkout LDK Node
uses: actions/checkout@v3
with:
repository: lightningdevkit/ldk-node
path: ldk-node

- name: Create In-Memory config
run: |
mkdir -p vss-server/rust/server
cat > vss-server/rust/server/vss-server-config.toml <<EOF
[server_config]
host = "127.0.0.1"
port = 8080
store_type = "in_memory"
EOF

- name: Build & Start VSS Server
working-directory: vss-server/rust
run: |
cargo build --release --bin vss-server
./target/release/vss-server ./server/vss-server-config.toml > server.log 2>&1 &
echo "Server PID: $!"

- name: Wait for VSS
run: |
for i in {1..30}; do
if curl -s http://127.0.0.1:8080/vss > /dev/null; then
echo "VSS ready"
exit 0
fi
sleep 1
done
echo "VSS failed:"
cat vss-server/rust/vss.log
exit 1

- name: Run LDK Node Integration tests
working-directory: ldk-node
run: |
export TEST_VSS_BASE_URL="http://127.0.0.1:8080/vss"
RUSTFLAGS="--cfg vss_test" cargo test io::vss_store
RUSTFLAGS="--cfg vss_test" cargo test --test integration_tests_vss
5 changes: 5 additions & 0 deletions rust/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ cargo build --release
```
cargo run -- server/vss-server-config.toml
```

**Note:** For testing purposes, you can pass `--in-memory` to use in-memory instead of PostgreSQL
```
cargo run -- server/vss-server-config.toml --in-memory
```
4. VSS endpoint should be reachable at `http://localhost:8080/vss`.

### Configuration
Expand Down
Loading
Loading