Skip to content

Commit

Permalink
refactor: core and cli installer
Browse files Browse the repository at this point in the history
  • Loading branch information
wangl-cc committed Nov 25, 2023
1 parent c915139 commit b054974
Show file tree
Hide file tree
Showing 17 changed files with 1,743 additions and 743 deletions.
48 changes: 39 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,10 @@ jobs:
if: matrix.arch == 'x86_64'
run: |
cargo test --package maa-cli --locked
- name: Test (maa-cli, no-default-features)
if: matrix.arch == 'x86_64'
run: |
cargo test --package maa-cli --no-default-features --locked
- name: Install MaaCore
if: matrix.arch == 'x86_64'
env:
MAA_API_URL: https://github.com/MaaAssistantArknights/MaaRelease/raw/main/MaaAssistantArknights/api/version
MAA_CONFIG_DIR: ${{ github.workspace }}/config_examples
run: |
cargo run -- install beta -t0
- name: Show installation
Expand All @@ -95,8 +91,8 @@ jobs:
env:
MAA_CONFIG_DIR: ${{ github.workspace }}/config_examples
run: |
cargo run -- version
cargo run -- run daily --dry-run --batch
cargo run -- version -vv
cargo run -- run daily --dry-run --batch -vv
- name: Run with MaaCore (relative path)
if: matrix.arch == 'x86_64'
timeout-minutes: 1
Expand All @@ -119,13 +115,47 @@ jobs:
ls -l "$local_dir/bin"
ls -l "$local_dir/lib"
ls -l "$share_dir"
$bin_dir/$MAA_EXE version
$bin_dir/$MAA_EXE run daily --dry-run --batch
$bin_dir/$MAA_EXE version -vv
$bin_dir/$MAA_EXE run daily --dry-run --batch -vv
- name: Cat MaaCore Log
if: matrix.arch == 'x86_64'
run: |
cat "$(cargo run -- dir log)/asst.log"
features:
name: Build with no default features
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
features:
- --features core_installer
- --features cli_installer
- ""

steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Rust
uses: ./.github/actions/setup
with:
os: ${{ matrix.os }}
arch: x86_64
- name: Setup Cache
uses: Swatinem/rust-cache@v2
with:
key: feature-${{ matrix.feature }}
- name: Build (maa-cli)
run: |
cargo build --package maa-cli --no-default-features ${{ matrix.features }} --locked
- name: Test (maa-cli)
run: |
cargo test --package maa-cli --no-default-features ${{ matrix.features }} --locked
coverage:
name: Coverage
needs: build
Expand Down
15 changes: 15 additions & 0 deletions config_examples/cli.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[core]
channel = "Beta"
test_time = 0
api_url = "https://github.com/MaaAssistantArknights/MaaRelease/raw/main/MaaAssistantArknights/api/version/"
[core.components]
library = true
resource = true

[cli]
channel = "Alpha"
# the double v in @vversion is necessary instead of a typo
api_url = "https://cdn.jsdelivr.net/gh/MaaAssistantArknights/maa-cli@vversion/"
download_url = "https://github.com/MaaAssistantArknights/maa-cli/releases/download/"
[cli.components]
binary = false
50 changes: 35 additions & 15 deletions maa-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,41 +9,61 @@ repository.workspace = true
license.workspace = true

[features]
default = ["self"]
self = []
default = ["cli_installer", "core_installer"]
core_installer = ["extract_helper"]
cli_installer = ["extract_helper"]
extract_helper = ["flate2", "tar", "zip"]

[[bin]]
name = "maa"
path = "src/main.rs"

[dependencies]
maa-sys = { path = "../maa-sys", features = ["runtime"] }

directories = "5"
paste = "1"
anyhow = "1"
signal-hook = "0.3.17"
dunce = "1.0.4"

clap = { version = "4.4", features = ["derive"] }
paste = "1"
clap_complete = { version = "4.4" }

toml = "0.8"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
toml = "0.8"
serde_yaml = "0.9.25"
indicatif = "0.17.7"
tokio = { version = "1.31", default-features = false, features = ["rt"] }
futures-util = "0.3.28"
flate2 = "1"
tar = "0.4.40"
zip = { version = "0.6.6", default-features = false, features = ["deflate"] }

# Dependencies used to donwload files
indicatif = { version = "0.17.7" }
futures-util = { version = "0.3.28" }
sha2 = { version = "0.10.7" }
digest = { version = "0.10.7" }
semver = { version = "1.0.19", features = ["serde"] }
sha2 = "0.10.7"
digest = "0.10.7"
signal-hook = "0.3.17"
clap_complete = { version = "4.4" }
dunce = "1.0.4"

# Dependencies used to extract files
flate2 = { version = "1", optional = true }
tar = { version = "0.4.40", optional = true }

[dependencies.chrono]
version = "0.4.31"
default-features = false
features = ["std", "clock", "serde"]

# Dependencies used to extract files
[dependencies.zip]
version = "0.6.6"
optional = true
default-features = false
features = ["deflate"]

# Dependencies used to download files
[dependencies.tokio]
version = "1.31"
default-features = false
features = ["rt"]

[dependencies.reqwest]
version = "0.11"
default-features = false
Expand Down
151 changes: 0 additions & 151 deletions maa-cli/src/config/cli.rs

This file was deleted.

Loading

0 comments on commit b054974

Please sign in to comment.