Skip to content

Commit 416f5bf

Browse files
committed
Merge branch 'remote_dev' into dev
2 parents 6fffc56 + 959a822 commit 416f5bf

File tree

22 files changed

+402
-0
lines changed

22 files changed

+402
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Bug Report
2+
description: File a bug report
3+
labels: ['bug']
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: Thanks for taking the time to fill out this bug report!
8+
- type: input
9+
id: version
10+
attributes:
11+
label: "Project version"
12+
placeholder: "1.2.3"
13+
validations:
14+
required: true
15+
- type: textarea
16+
id: what-happened
17+
attributes:
18+
label: What happened?
19+
description: A brief description of what happened and what you expected to happen
20+
validations:
21+
required: true
22+
- type: textarea
23+
id: reproduction-steps
24+
attributes:
25+
label: "Minimal reproduction steps"
26+
description: "The minimal steps needed to reproduce the bug"
27+
validations:
28+
required: true
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: Feature request
2+
description: Suggest a new feature
3+
labels: ['feature']
4+
body:
5+
- type: textarea
6+
id: feature-description
7+
attributes:
8+
label: "Describe the feature"
9+
description: "A description of what you would like to see in the project"
10+
validations:
11+
required: true
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
name: Other issue
3+
about: Other kind of issue
4+
---

.github/workflows/ci.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Linting Checks and Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- dev
8+
pull_request:
9+
10+
permissions:
11+
contents: read
12+
13+
concurrency:
14+
group: ci-${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
lint-and-test:
19+
name: Lint and Test (Ubuntu)
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Setup Rust toolchain
26+
uses: actions-rust-lang/setup-rust-toolchain@v1
27+
with:
28+
components: clippy, rustfmt
29+
30+
- name: Cache cargo registry, git and target
31+
uses: actions/cache@v4
32+
with:
33+
path: |
34+
~/.cargo/registry
35+
~/.cargo/git
36+
target
37+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
38+
restore-keys: |
39+
${{ runner.os }}-cargo-
40+
41+
- name: Run Rust fmt
42+
run: cargo fmt --all --check
43+
44+
- name: Run clippy
45+
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
46+
47+
- name: Run tests
48+
run: cargo test --workspace --all-features --locked --no-fail-fast

.gitignore

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Generated by Cargo
2+
# will have compiled files and executables
3+
debug/
4+
target/
5+
6+
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
7+
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
8+
Cargo.lock
9+
10+
# These are backup files generated by rustfmt
11+
**/*.rs.bk
12+
13+
# MSVC Windows builds of rustc generate these, which store debugging information
14+
*.pdb
15+
16+
# Ignoring .js files, as typescript firstly compiles into it
17+
/tests/*.js
18+
19+
# Disable logs that have obtained during run
20+
/logs
21+
*.log
22+
.env
23+
24+
# RustRover
25+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
26+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
27+
# and can be added to the global gitignore or merged into this file. For a more nuclear
28+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
29+
.idea/
30+
.vscode/
31+
32+
# frontend code
33+
node_modules/
34+
dist/
35+
36+
# Mac OSX temporary files
37+
.DS_Store
38+
**/.DS_Store
39+
40+
# Logs
41+
logs/*

Cargo.toml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
[workspace]
2+
resolver = "3"
3+
members = [
4+
"nostr_options_cli",
5+
"crates/*"
6+
]
7+
8+
[workspace.package]
9+
version = "0.1.0"
10+
edition = "2024"
11+
rust-version = "1.91.0"
12+
authors = ["Blockstream"]
13+
readme = "README.md"
14+
15+
16+
[workspace.dependencies]
17+
anyhow = { version = "1.0.100" }
18+
clap = { version = "4.5.49", features = ["derive"] }
19+
config = { version = "0.15.16", default-features = true }
20+
dotenvy = { version = "0.15" }
21+
global_utils = { path = "./crates/global_utils" }
22+
hex = { version = "0.4.3" }
23+
itertools = { version = "0.14.0" }
24+
reqwest = { version = "0.12.23", features = ["blocking", "json"] }
25+
ring = { version = "0.17.14" }
26+
serde = { version = "1.0.228", features = ["derive"] }
27+
serde_json = { version = "1.0.145" }
28+
sha2 = { version = "0.10.9", features = ["compress"] }
29+
simplicity-lang = { version = "0.5.0" }
30+
simplicityhl = { version = "0.2.0", features = ["serde"] }
31+
simplicityhl-core = { version = "0.1.1" }
32+
state_change_types = { path = "./crates/state_change_types" }
33+
thiserror = { version = "2.0.17" }
34+
tracing = { version = "0.1.41" }
35+
tracing-appender = { version = "0.2.3" }
36+
tracing-subscriber = { version = "0.3.19", features = ["env-filter"] }
37+
nostr = { version = "0.43.1" }
38+
tokio-tungstenite = { version = "0.28.0", features = ["native-tls"] }
39+
futures-util = "0.3.31"
40+
tokio = {version = "1.48.0", features = ["full"] }
41+

Makefile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
## This help screen
2+
help:
3+
@printf "Available targets:\n\n"
4+
@awk '/^[a-zA-Z\-\_0-9%:\\]+/ { \
5+
helpMessage = match(lastLine, /^## (.*)/); \
6+
if (helpMessage) { \
7+
helpCommand = $$1; \
8+
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
9+
gsub("\\\\", "", helpCommand); \
10+
gsub(":+$$", "", helpCommand); \
11+
printf " \x1b[32;01m%-35s\x1b[0m %s\n", helpCommand, helpMessage; \
12+
} \
13+
} \
14+
{ lastLine = $$0 }' $(MAKEFILE_LIST) | sort -u
15+
@printf "\n"
16+
17+
## Format code
18+
fmt:
19+
cargo +nightly fmt --all
20+
21+
## Show lints
22+
clippy:
23+
cargo clippy -- -Dclippy::pedantic
24+
25+
## Show lints for all features
26+
clippy_all_features:
27+
cargo clippy --workspace --all-targets --all-features -- -D warnings

crates/global_utils/Cargo.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[package]
2+
name = "global_utils"
3+
version.workspace = true
4+
edition.workspace = true
5+
rust-version.workspace = true
6+
authors.workspace = true
7+
readme.workspace = true
8+
9+
[dependencies]
10+
thiserror = { workspace = true }
11+
tracing = { workspace = true }
12+
tracing-appender = { workspace = true }
13+
tracing-subscriber = { workspace = true }
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
use std::env::VarError;
2+
use thiserror::Error;
3+
use tracing::instrument;
4+
5+
#[derive(Debug, Error)]
6+
pub enum EnvParserError {
7+
#[error("Failed to parse env variable {missing_var_name}, err: {err}, check if it exists and is valid")]
8+
ConfigEnvParseError { missing_var_name: String, err: VarError },
9+
}
10+
11+
pub trait EnvParser {
12+
const ENV_NAME: &'static str;
13+
fn obtain_env_value() -> Result<String, EnvParserError> {
14+
obtain_env_value(Self::ENV_NAME)
15+
}
16+
}
17+
18+
#[instrument(level = "trace", skip(name), fields(name = name.as_ref()), ret)]
19+
pub fn obtain_env_value(name: impl AsRef<str>) -> Result<String, EnvParserError> {
20+
std::env::var(name.as_ref()).map_err(|err| EnvParserError::ConfigEnvParseError {
21+
missing_var_name: name.as_ref().to_string(),
22+
err,
23+
})
24+
}

crates/global_utils/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pub mod env_parser;
2+
pub mod logger;

0 commit comments

Comments
 (0)