Skip to content

Commit

Permalink
ci: Update CI
Browse files Browse the repository at this point in the history
  • Loading branch information
wormtql committed May 12, 2024
1 parent cb53b41 commit ff7f235
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 54 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
'./yas/Cargo.toml'
'./yas-genshin/Cargo.toml'
'./yas-starrail/Cargo.toml'
'./yas-application/Cargo.toml'
)
[regex]$pattern = '(?<=version = ").*(?=")'
foreach ($file in $files) {
Expand All @@ -57,6 +58,7 @@ jobs:
run: |
Move-Item ./target/release/yas_artifact.exe "yas_artifact_$env:GIT_REV.exe"
Move-Item ./target/release/yas_relic.exe "yas_relic_$env:GIT_REV.exe"
Move-Item ./target/release/yas.exe "yas_$env:GIT_REV.exe"
- name: Upload yas_artifact
uses: actions/upload-artifact@v4
Expand All @@ -68,4 +70,10 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: yas_relic_${{ env.GIT_REV }}
path: yas_relic_${{ env.GIT_REV }}.exe
path: yas_relic_${{ env.GIT_REV }}.exe

- name: Upload yas
uses: actions/upload-artifact@v4
with:
name: yas_${{ env.GIT_REV }}
path: yas_${{ env.GIT_REV }}.exe
2 changes: 1 addition & 1 deletion Cargo.lock

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

13 changes: 11 additions & 2 deletions yas-application/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
name = "yas-application"
version = "0.1.0"
edition = "2021"
build = "build.rs"

[dependencies]
anyhow = "1.0"
# yas = { path = "../yas" , package = "yas_core"}
yas = { path = "../yas" , package = "yas_core" }
yas_genshin = { path = "../yas-genshin", package = "yas_scanner_genshin" }
yas_starrail = { path = "../yas-starrail", package = "yas_scanner_starrail" }
clap = { version = "4.4", features = ["derive"] }
Expand All @@ -19,3 +18,13 @@ winres = "0.1"
[[bin]]
name = "yas"
path = "src/bin/yas.rs"
# build = "build.rs"

[[bin]]
name = "yas_artifact"
path = "src/bin/yas_artifact.rs"
# build = "build.rs"

[[bin]]
name = "yas_relic"
path = "src/bin/yas_relic.rs"
26 changes: 19 additions & 7 deletions yas-application/src/bin/yas.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use anyhow::Result;
use clap::{command, Command};
use yas::utils::press_any_key_to_continue;
use yas_genshin::application::ArtifactScannerApplication;
use yas_starrail::application::RelicScannerApplication;

Expand All @@ -19,22 +19,34 @@ fn init() {
.init();
}

pub fn main() -> Result<()> {
pub fn main() {
init();
let cmd = command!()
.subcommand(get_genshin_command())
.subcommand(get_starrail_command());
let arg_matches = cmd.get_matches();

if let Some((subcommand_name, matches)) = arg_matches.subcommand() {
let res = if let Some((subcommand_name, matches)) = arg_matches.subcommand() {
if subcommand_name == "genshin" {
let application = ArtifactScannerApplication::new(matches.clone());
application.run()?;
application.run()
} else if subcommand_name == "starrail" {
let application = RelicScannerApplication::new(matches.clone());
application.run()?;
application.run()
} else {
Ok(())
}
}
} else {
Ok(())
};

Ok(())
match res {
Ok(_) => {
press_any_key_to_continue();
},
Err(e) => {
log::error!("error: {}", e);
press_any_key_to_continue();
}
}
}
23 changes: 23 additions & 0 deletions yas-application/src/bin/yas_artifact.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
use yas::utils::press_any_key_to_continue;
use yas_genshin::application::ArtifactScannerApplication;
use log::error;

pub fn main() {
env_logger::Builder::new()
.filter_level(log::LevelFilter::Info)
.init();

let command = ArtifactScannerApplication::build_command();
let matches = command.get_matches();

let application = ArtifactScannerApplication::new(matches);
match application.run() {
Err(e) => {
error!("error: {}", e);
press_any_key_to_continue();
},
_ => {
press_any_key_to_continue();
}
}
}
18 changes: 18 additions & 0 deletions yas-application/src/bin/yas_relic.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
use yas::utils::press_any_key_to_continue;
use yas_starrail::application::RelicScannerApplication;
use log::error;

pub fn main() {
let matches = RelicScannerApplication::build_command().get_matches();

let application = RelicScannerApplication::new(matches);
match application.run() {
Err(e) => {
error!("error: {}", e);
press_any_key_to_continue();
},
_ => {
press_any_key_to_continue();
}
}
}
5 changes: 0 additions & 5 deletions yas-genshin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
name = "yas_scanner_genshin"
version = "0.1.16"
edition = "2021"
# build = "build.rs"
description = "Genshin Impact item scanner"
repository = "https://github.com/wormtql/yas"
keywords = ["GenshinImpact", "artifacts", "scanner", "ocr"]
Expand Down Expand Up @@ -31,10 +30,6 @@ csv = "1.3.0"
[target.'cfg(target_os = "windows")'.dependencies]
windows-capture = "1.0.65"

[[bin]]
name = "yas_artifact"
path = "src/bin/artifact_scanner.rs"

[[bin]]
name = "yas_genshin_playground"
path = "src/bin/playground.rs"
16 changes: 0 additions & 16 deletions yas-genshin/src/bin/artifact_scanner.rs

This file was deleted.

8 changes: 0 additions & 8 deletions yas-starrail/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
name = "yas_scanner_starrail"
version = "0.1.14"
edition = "2021"
# build = "build.rs"
description = "Honkai: Star Rail item scanner"
repository = "https://github.com/wormtql/yas"
keywords = ["HonkaiStarRail", "relic", "scanner", "ocr"]
Expand All @@ -26,10 +25,3 @@ lazy_static = "1.4"
serde = { version = "1.0", features = ["derive"] }
env_logger = "0.11"
nanoid = "0.4"

[build-dependencies]
winres = "0.1"

[[bin]]
name = "yas_relic"
path = "src/bin/relic_scanner.rs"
14 changes: 0 additions & 14 deletions yas-starrail/src/bin/relic_scanner.rs

This file was deleted.

0 comments on commit ff7f235

Please sign in to comment.