Skip to content

Commit f571b29

Browse files
Harsh Dev PathakHarshdev098
authored andcommitted
feat: Added CI for in_memory_testing
1 parent f48d8d6 commit f571b29

3 files changed

Lines changed: 53 additions & 28 deletions

File tree

.github/workflows/build-and-test-in-memory.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,24 @@ jobs:
2323
mkdir -p rust/server
2424
cat > rust/server/vss-server-config.toml <<EOF
2525
[server_config]
26-
host = "127.0.0.1"
27-
port = 8080
26+
bind_address = "127.0.0.1:8080"
2827
store_type = "in-memory"
2928
EOF
3029
3130
- name: Build server
3231
working-directory: rust
33-
run: cargo build --release --bin vss-server
32+
run: RUSTFLAGS="--cfg noop_authorizer" cargo build --release --no-default-features --bin vss-server
3433

3534
- name: Start VSS server
3635
working-directory: rust
3736
run: |
38-
./target/release/vss-server ./server/vss-server-config.toml --in-memory > server.log 2>&1 &
37+
./target/release/vss-server ./server/vss-server-config.toml > server.log 2>&1 &
3938
echo "Server PID: $!"
4039
4140
- name: Wait for server
4241
run: |
4342
for i in {1..15}; do
44-
if curl -s http://127.0.0.1:8080 > /dev/null; then
43+
if curl -s http://127.0.0.1:8080/vss > /dev/null; then
4544
echo "Server is up!"
4645
exit 0
4746
fi

.github/workflows/ldk-node-integration.yml

Lines changed: 48 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,14 @@ concurrency:
77
cancel-in-progress: true
88

99
jobs:
10-
build-and-test:
11-
strategy:
12-
fail-fast: false
13-
matrix:
14-
platform: [ ubuntu-latest ]
15-
toolchain: [ stable, 1.85.0 ] # 1.85.0 is the MSRV
16-
runs-on: ${{ matrix.platform }}
10+
test-postgres:
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 30
1713

1814
services:
1915
postgres:
2016
image: postgres:latest
21-
ports:
22-
- 5432:5432
17+
ports: [5432:5432]
2318
env:
2419
POSTGRES_DB: postgres
2520
POSTGRES_USER: postgres
@@ -35,21 +30,53 @@ jobs:
3530
uses: actions/checkout@v3
3631
with:
3732
path: vss-server
33+
3834
- name: Checkout LDK Node
3935
uses: actions/checkout@v3
4036
with:
4137
repository: lightningdevkit/ldk-node
4238
path: ldk-node
4339

44-
- name: Build and Deploy VSS Server
40+
- name: Create Postgres config
41+
run: |
42+
mkdir -p vss-server/rust/server
43+
cat > vss-server/rust/server/vss-server-config.toml <<EOF
44+
[server_config]
45+
bind_address = "127.0.0.1:8080"
46+
store_type = "postgres"
47+
48+
[postgresql_config]
49+
username = "postgres"
50+
password = "postgres"
51+
address = "localhost:5432"
52+
default_database = "postgres"
53+
vss_database = "vss"
54+
EOF
55+
56+
- name: Build & Start VSS Server
57+
working-directory: vss-server/rust
58+
run: |
59+
RUSTFLAGS="--cfg noop_authorizer" cargo build --release --no-default-features --bin vss-server
60+
./target/release/vss-server ./server/vss-server-config.toml > server.log 2>&1 &
61+
echo "Server PID: $!"
62+
63+
- name: Wait for VSS
4564
run: |
46-
cd vss-server/rust
47-
RUSTFLAGS="--cfg noop_authorizer" cargo build --no-default-features
48-
./target/debug/vss-server server/vss-server-config.toml&
65+
for i in {1..30}; do
66+
if curl -s http://127.0.0.1:8080/vss > /dev/null; then
67+
echo "VSS ready"
68+
exit 0
69+
fi
70+
sleep 2
71+
done
72+
echo "VSS failed:"
73+
cat vss-server/rust/server.log
74+
exit 1
75+
4976
- name: Run LDK Node Integration tests
77+
working-directory: ldk-node
5078
run: |
51-
cd ldk-node
52-
export TEST_VSS_BASE_URL="http://localhost:8080/vss"
79+
export TEST_VSS_BASE_URL="http://127.0.0.1:8080/vss"
5380
RUSTFLAGS="--cfg vss_test" cargo test io::vss_store -- --test-threads=1
5481
RUSTFLAGS="--cfg vss_test" cargo test --test integration_tests_vss -- --test-threads=1
5582
@@ -74,16 +101,15 @@ jobs:
74101
mkdir -p vss-server/rust/server
75102
cat > vss-server/rust/server/vss-server-config.toml <<EOF
76103
[server_config]
77-
host = "127.0.0.1"
78-
port = 8080
104+
bind_address = "127.0.0.1:8080"
79105
store_type = "in-memory"
80106
EOF
81107
82108
- name: Build & Start VSS Server
83109
working-directory: vss-server/rust
84110
run: |
85-
cargo build --release --bin vss-server
86-
./target/release/vss-server ./server/vss-server-config.toml --in-memory > server.log 2>&1 &
111+
RUSTFLAGS="--cfg noop_authorizer" cargo build --release --no-default-features --bin vss-server
112+
./target/release/vss-server ./server/vss-server-config.toml > server.log 2>&1 &
87113
echo "Server PID: $!"
88114
89115
- name: Wait for VSS
@@ -96,12 +122,12 @@ jobs:
96122
sleep 1
97123
done
98124
echo "VSS failed:"
99-
cat vss-server/rust/vss.log
125+
cat vss-server/rust/server.log
100126
exit 1
101127
102128
- name: Run LDK Node Integration tests
103129
working-directory: ldk-node
104130
run: |
105131
export TEST_VSS_BASE_URL="http://127.0.0.1:8080/vss"
106-
RUSTFLAGS="--cfg vss_test" cargo test io::vss_store
107-
RUSTFLAGS="--cfg vss_test" cargo test --test integration_tests_vss
132+
RUSTFLAGS="--cfg vss_test" cargo test io::vss_store -- --test-threads=1
133+
RUSTFLAGS="--cfg vss_test" cargo test --test integration_tests_vss -- --test-threads=1

rust/server/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,4 +222,4 @@ fn main() {
222222
}
223223
}
224224
});
225-
}
225+
}

0 commit comments

Comments
 (0)