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
18 changes: 17 additions & 1 deletion .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,20 @@ jobs:
runs-on: ubuntu-latest
env:
TOOLCHAIN: stable
services:
postgres:
image: postgres:latest
ports:
- 5432:5432
env:
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout source code
uses: actions/checkout@v6
Expand Down Expand Up @@ -42,5 +56,7 @@ jobs:
echo "BITCOIND_EXE=$( pwd )/bin/bitcoind-${{ runner.os }}-${{ runner.arch }}" >> "$GITHUB_ENV"
echo "ELECTRS_EXE=$( pwd )/bin/electrs-${{ runner.os }}-${{ runner.arch }}" >> "$GITHUB_ENV"
- name: Run benchmarks
env:
TEST_POSTGRES_URL: "host=localhost user=postgres password=postgres"
run: |
RUSTFLAGS="--cfg tokio_unstable" cargo bench
RUSTFLAGS="--cfg tokio_unstable" cargo test --benches --features "bench postgres"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ Cargo.lock
# These are backup files generated by rustfmt
**/*.rs.bk

# Env file used in benches
.env

# Ignore generated swift related files
.swiftpm/
LDKNodeFFI.*
Expand Down
11 changes: 11 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ panic = 'abort' # Abort on panic

[features]
default = []
bench = []
postgres = ["dep:tokio-postgres", "dep:native-tls", "dep:postgres-native-tls"]

[dependencies]
Expand Down Expand Up @@ -96,6 +97,7 @@ rand = { version = "0.9.2", default-features = false, features = ["std", "thread
proptest = "1.0.0"
regex = "1.5.6"
criterion = { version = "0.7.0", features = ["async_tokio"] }
dotenvy = "0.15"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should take a dependency for this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was simple way to read .env files, made doing test loops faster instead of always doing TEST_POSTGRES_URL=blah cargo test but can remove if not wanted. Figured was fine because just dev-dep

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, we're generally more lax about adding dev-dependencies, but this seems very unnecessary as reading env variables can be done via std, and reading files should be a ~5 line helper?

ldk-node-062 = { package = "ldk-node", version = "=0.6.2" }
ldk-node-070 = { package = "ldk-node", version = "=0.7.0" }

Expand Down Expand Up @@ -140,6 +142,15 @@ check-cfg = [
name = "payments"
harness = false

[[bench]]
name = "operations"
harness = false

[[bench]]
name = "database"
harness = false
required-features = ["bench"]

#[patch.crates-io]
#lightning = { path = "../rust-lightning/lightning" }
#lightning-types = { path = "../rust-lightning/lightning-types" }
Expand Down
Loading