Skip to content

Commit

Permalink
ci: add some CLI options
Browse files Browse the repository at this point in the history
  • Loading branch information
bczhc committed Mar 24, 2024
1 parent 4fe9917 commit cebe8b1
Show file tree
Hide file tree
Showing 6 changed files with 136 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > install && \
RUN . ~/.cargo/env && \
RIME_LIB_DIR=/usr/lib/x86_64-linux-gnu \
cargo build -r --manifest-path=/rime-config/ci/Cargo.toml && \
ci/target/release/ci
ci/target/release/ci . /usr/share/rime-data ci-build
117 changes: 115 additions & 2 deletions ci/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion ci/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ version = "0.1.0"
edition = "2021"

[dependencies]
rime-api = "0.11.0"
rime-api = "=0.12.1"
clap = { version = "4.5.3", features = ["derive"] }
8 changes: 8 additions & 0 deletions ci/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
use std::path::PathBuf;

#[derive(clap::Parser, Debug)]
pub struct Args {
pub user_data_dir: PathBuf,
pub rime_data_dir: PathBuf,
pub staging_dir: Option<PathBuf>,
}
16 changes: 9 additions & 7 deletions ci/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
use rime_api::{create_session, DeployResult, full_deploy_and_wait, initialize, setup, Traits};
use ci::Args;
use clap::Parser;

fn main() {
let rime_data_dir = "/usr/share/rime-data";
let user_data_dir = ".";
let args = Args::parse();

let mut traits = Traits::new();
traits.set_shared_data_dir(rime_data_dir);
traits.set_user_data_dir(user_data_dir);
traits.set_shared_data_dir(args.rime_data_dir.to_str().unwrap());
traits.set_user_data_dir(args.user_data_dir.to_str().unwrap());
traits.set_distribution_name("Rime");
traits.set_distribution_code_name("Rime");
traits.set_distribution_version("0.0.0");
traits.set_app_name("rime-tester");
traits.set_staging_dir("./ci-build");
if let Some(d) = args.staging_dir {
traits.set_staging_dir(d.to_str().unwrap());
}

setup(&mut traits);
initialize(&mut traits);

let deploy_result = full_deploy_and_wait();
assert!(deploy_result == DeployResult::Success);
assert_eq!(deploy_result, DeployResult::Success);

let session = create_session().unwrap();
session.select_schema("092wubi").unwrap();
Expand Down
1 change: 1 addition & 0 deletions symbols.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ punctuator:
'{' : [【, 「, 〔, [, 〘, 〖, 『, {]
'}' : [】, 」, 〕, ], 〙, 〗, 』, }]
symbols:
'/btc' : ₿
'/hl' : [ '──', '─' ]
'/tab' : ' '
'/zxh' : [ '*', *, ·, ‧, ・, ・, ×, ※, ❂, ⁂, ☮, ☯, ☣ ] #星号
Expand Down

0 comments on commit cebe8b1

Please sign in to comment.