Skip to content

Commit b486bf3

Browse files
committed
feat: Code cleanup, split out API to be clearer and re-enable CLI build.
1 parent eacd693 commit b486bf3

11 files changed

Lines changed: 611 additions & 422 deletions

File tree

.github/workflows/release_build.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,20 @@ jobs:
5151
- name: Install dependencies
5252
uses: awalsh128/cache-apt-pkgs-action@2c09a5e66da6c8016428a2172bd76e5e4f14bb17
5353
with:
54-
packages: protobuf-compiler
54+
packages: protobuf-compiler libclang-dev
5555
version: 1.0
5656
- name: Setup Rust toolchain
5757
uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48
5858
- name: Build
59-
# run: cargo build --all --release && strip target/release/bitpart && strip target/release/bitpart-cli
60-
run: cargo build --all --release && strip target/release/bitpart
59+
run: cargo build --all --release && strip target/release/bitpart && strip target/release/bitpart-cli
6160
- name: Release
6261
uses: softprops/action-gh-release@72f2c25fcb47643c292f7107632f7a47c1df5cd8
6362
with:
6463
body: ${{ needs.bump_version.outputs.body }}
6564
tag_name: ${{ needs.bump_version.outputs.version }}
6665
files: |
6766
target/release/bitpart
67+
target/release/bitpart-cli
6868
env:
6969
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7070
build_image:

.github/workflows/run_checks.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
ref: ${{ env.BRANCH_NAME }}
2424
- uses: awalsh128/cache-apt-pkgs-action@2c09a5e66da6c8016428a2172bd76e5e4f14bb17
2525
with:
26-
packages: protobuf-compiler
26+
packages: protobuf-compiler libclang-dev
2727
version: 1.0
2828
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48
2929
- run: cargo test --all-features
@@ -52,7 +52,7 @@ jobs:
5252
ref: ${{ env.BRANCH_NAME }}
5353
- uses: awalsh128/cache-apt-pkgs-action@2c09a5e66da6c8016428a2172bd76e5e4f14bb17
5454
with:
55-
packages: protobuf-compiler
55+
packages: protobuf-compiler libclang-dev
5656
version: 1.0
5757
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48
5858
with:

Cargo.lock

Lines changed: 157 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
resolver = "2"
33
members = [
44
"crates/bitpart",
5-
# "crates/bitpart-cli",
5+
"crates/bitpart-cli",
66
"crates/bitpart-common",
77
"crates/presage-store-bitpart",
88
]

crates/bitpart-cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ serde = { version = "1.0.204", features = ["derive"] }
2222
serde_json = "1.0.132"
2323
similar = "2.7.0"
2424
tokio = { version = "1.43.0", features = ["full"] }
25-
tokio-tungstenite = { version = "0.26.1", features = ["url", "native-tls"] }
25+
tokio-tungstenite = { version = "0.26.1", features = ["url", "rustls-tls-webpki-roots"] }
2626
tracing = "0.1.41"
2727
tracing-log = "0.2.0"
2828
tracing-subscriber = { version = "0.3.19", features = ["env-filter"] }

crates/bitpart-common/src/csml.rs

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -44,45 +44,7 @@ impl TryInto<BotOpt> for Request {
4444
type Error = BitpartError;
4545

4646
fn try_into(self) -> Result<BotOpt, Self::Error> {
47-
match self {
48-
// Bot
49-
Request {
50-
bot: Some(mut csml_bot),
51-
multibot,
52-
..
53-
} => {
54-
csml_bot.multibot = multibot;
55-
56-
Ok(BotOpt::CsmlBot(Box::new(csml_bot)))
57-
}
58-
59-
// version id
60-
Request {
61-
version_id: Some(version_id),
62-
bot_id: Some(bot_id),
63-
apps_endpoint,
64-
multibot,
65-
..
66-
} => Ok(BotOpt::Id {
67-
version_id,
68-
bot_id,
69-
apps_endpoint,
70-
multibot,
71-
}),
72-
73-
// get bot by id will search for the last version id
74-
Request {
75-
bot_id: Some(bot_id),
76-
apps_endpoint,
77-
multibot,
78-
..
79-
} => Ok(BotOpt::BotId {
80-
bot_id,
81-
apps_endpoint,
82-
multibot,
83-
}),
84-
_ => Err(BitpartErrorKind::Interpreter("Invalid bot_opt format".to_owned()).into()),
85-
}
47+
(&self).try_into()
8648
}
8749
}
8850

0 commit comments

Comments
 (0)