refactor!: core and cli installer #413
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [ "main" ] | |
paths: | |
- "maa-cli/**" | |
- "maa-sys/**" | |
- "Cargo.toml" | |
- "Cargo.lock" | |
- ".github/workflows/ci.yml" | |
pull_request: | |
branches: [ "main" ] | |
paths: | |
- "maa-cli/**" | |
- "maa-sys/**" | |
- "Cargo.toml" | |
- "Cargo.lock" | |
- ".github/workflows/ci.yml" | |
env: | |
RUST_BACKTRACE: full | |
CARGO_TERM_COLOR: always | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build: | |
name: Build and Test | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
- macos-latest | |
- windows-latest | |
arch: | |
- x86_64 | |
- aarch64 | |
exclude: | |
# Failed to cross compile ring on Windows | |
- os: windows-latest | |
arch: aarch64 | |
env: | |
MAA_EXTRA_SHARE_NAME: maa-test | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Rust | |
uses: ./.github/actions/setup | |
with: | |
os: ${{ matrix.os }} | |
arch: ${{ matrix.arch }} | |
coverage: true | |
- name: Setup Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Build (maa-cli) | |
run: | | |
cargo build --package maa-cli --locked | |
- name: Lint (clippy) | |
if: matrix.arch == 'x86_64' | |
run: | | |
cargo clippy --all-targets --all-features -- -D warnings | |
- name: Lint (rustfmt) | |
if: matrix.arch == 'x86_64' | |
run: | | |
cargo fmt --all -- --check | |
- name: Install MaaCore | |
if: matrix.arch == 'x86_64' | |
env: | |
MAA_CONFIG_DIR: ${{ github.workspace }}/config_examples | |
run: | | |
cargo run -- install beta -t0 | |
ls -l "$(cargo run -- dir library)" | |
ls -l "$(cargo run -- dir resource)" | |
wget "$(yq -oy '.core.api_url' $MAA_CONFIG_DIR/cli.yml)/beta.json" | |
version="$(yq -oy '.version' beta.json)" | |
echo "MAA_CORE_VERSION=$version" >> $GITHUB_ENV | |
- name: Test | |
if: matrix.arch == 'x86_64' | |
run: | | |
cargo test | |
- name: Coverage | |
if: matrix.arch == 'x86_64' | |
run: | | |
cargo tarpaulin --all-features --workspace --timeout 120 --out xml ${{ github.run_attempt == 1 && '--skip-clean' || '' }} | |
features: | |
name: Build and Test (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 | |
run: | | |
cargo build --package maa-cli --no-default-features ${{ matrix.features }} --locked | |
- name: Test | |
run: | | |
cargo test |