Skip to content

Commit

Permalink
chore: Make backon a workspace (#124)
Browse files Browse the repository at this point in the history
Signed-off-by: Xuanwo <github@xuanwo.io>
  • Loading branch information
Xuanwo authored Aug 27, 2024
1 parent a046907 commit e731d8b
Show file tree
Hide file tree
Showing 24 changed files with 64 additions and 54 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Format
run: cargo fmt --all -- --check
- name: Clippy
run: cargo clippy --all-features --all-targets -- -D warnings
run: cargo clippy --workspace --all-features --all-targets -- -D warnings

msrv-check:
runs-on: ubuntu-latest
Expand All @@ -33,7 +33,7 @@ jobs:
- name: Install
run: rustup toolchain install ${BACKON_MSRV}
- name: Check MSRV
run: cargo +${BACKON_MSRV} build
run: cargo +${BACKON_MSRV} build --workspace
env:
RUST_LOG: DEBUG
RUST_BACKTRACE: full
Expand All @@ -49,7 +49,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Test
run: cargo test --all-features
run: cargo test --all-features --workspace
env:
RUST_LOG: DEBUG
RUST_BACKTRACE: full
Expand All @@ -60,7 +60,7 @@ jobs:
- uses: actions/checkout@v4
- run: rustup toolchain install nightly
- name: Test
run: cargo +nightly test --all-features
run: cargo +nightly test --all-features --workspace
env:
RUST_LOG: DEBUG
RUST_BACKTRACE: full
Expand All @@ -73,6 +73,7 @@ jobs:
- name: Install
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- run: wasm-pack test --node --all-features -- --skip blocking
working-directory: backon
env:
RUST_LOG: DEBUG
RUST_BACKTRACE: full
55 changes: 5 additions & 50 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,53 +1,8 @@
[package]
description = "Make retry like a built-in feature provided by Rust."
documentation = "https://docs.rs/backon"
[workspace]
members = ["backon"]
resolver = "2"

[workspace.package]
edition = "2021"
license = "Apache-2.0"
name = "backon"
repository = "https://github.com/Xuanwo/backon"
rust-version = "1.70"
version = "1.0.2"

[package.metadata.docs.rs]
all-features = true
targets = [
"x86_64-unknown-linux-gnu",
"x86_64-apple-darwin",
"x86_64-pc-windows-msvc",
"wasm32-unknown-unknown",
]

[features]
gloo-timers-sleep = ["dep:gloo-timers", "gloo-timers?/futures"]
tokio-sleep = ["dep:tokio", "tokio?/time"]

[dependencies]
fastrand = "2.0.0"

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
tokio = { version = "1", optional = true }

[target.'cfg(target_arch = "wasm32")'.dependencies]
gloo-timers = { version = "0.3", optional = true }

[dev-dependencies]
anyhow = "1"
reqwest = "0.12"

[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
tokio = { version = "1", features = [
"macros",
"rt",
"sync",
], default-features = false }
wasm-bindgen-test = "0.3"

[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
sqlx = { version = "0.8.0", features = ["runtime-tokio", "sqlite"] }
tokio = { version = "1", features = [
"time",
"rt",
"macros",
"sync",
"rt-multi-thread",
] }
54 changes: 54 additions & 0 deletions backon/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
[package]
description = "Make retry like a built-in feature provided by Rust."
documentation = "https://docs.rs/backon"
name = "backon"
rust-version = "1.70"
version = "1.0.2"

edition.workspace = true
license.workspace = true
repository.workspace = true

[package.metadata.docs.rs]
all-features = true
targets = [
"x86_64-unknown-linux-gnu",
"x86_64-apple-darwin",
"x86_64-pc-windows-msvc",
"wasm32-unknown-unknown",
]

[features]
gloo-timers-sleep = ["dep:gloo-timers", "gloo-timers?/futures"]
tokio-sleep = ["dep:tokio", "tokio?/time"]

[dependencies]
fastrand = "2.0.0"

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
tokio = { version = "1", optional = true }

[target.'cfg(target_arch = "wasm32")'.dependencies]
gloo-timers = { version = "0.3", optional = true }

[dev-dependencies]
anyhow = "1"
reqwest = "0.12"

[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
tokio = { version = "1", features = [
"macros",
"rt",
"sync",
], default-features = false }
wasm-bindgen-test = "0.3"

[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
sqlx = { version = "0.8.0", features = ["runtime-tokio", "sqlite"] }
tokio = { version = "1", features = [
"time",
"rt",
"macros",
"sync",
"rt-multi-thread",
] }
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit e731d8b

Please sign in to comment.