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
69 changes: 69 additions & 0 deletions .github/workflows/build-and-test-in-memory.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
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]
bind_address = "127.0.0.1:8080"
store_type = "in-memory"
EOF

- name: Build server
working-directory: rust
run: RUSTFLAGS="--cfg noop_authorizer" cargo build --release --no-default-features --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/vss > /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: |
sudo apt-get update && sudo apt-get install -y xxd

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
109 changes: 94 additions & 15 deletions .github/workflows/ldk-node-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,14 @@ concurrency:
cancel-in-progress: true

jobs:
build-and-test:
strategy:
fail-fast: false
matrix:
platform: [ ubuntu-latest ]
toolchain: [ stable, 1.85.0 ] # 1.85.0 is the MSRV
runs-on: ${{ matrix.platform }}
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 @@ -35,20 +30,104 @@ 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]
bind_address = "127.0.0.1:8080"
store_type = "postgres"

[postgresql_config]
username = "postgres"
password = "postgres"
address = "localhost:5432"
default_database = "postgres"
vss_database = "vss"
EOF

- name: Build & Start VSS Server
working-directory: vss-server/rust
run: |
cd vss-server/rust
RUSTFLAGS="--cfg noop_authorizer" cargo build --no-default-features
./target/debug/vss-server server/vss-server-config.toml&
RUSTFLAGS="--cfg noop_authorizer" cargo build --release --no-default-features --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/server.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 -- --test-threads=1
RUSTFLAGS="--cfg vss_test" cargo test --test integration_tests_vss -- --test-threads=1

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]
bind_address = "127.0.0.1:8080"
store_type = "in-memory"
EOF

- name: Build & Start VSS Server
working-directory: vss-server/rust
run: |
RUSTFLAGS="--cfg noop_authorizer" cargo build --release --no-default-features --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/server.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 -- --test-threads=1
RUSTFLAGS="--cfg vss_test" cargo test --test integration_tests_vss -- --test-threads=1
5 changes: 5 additions & 0 deletions rust/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,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