refactor!: core and cli installer (#118) #45
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 (maa-sys) | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "maa-sys/**" | |
- "Cargo.toml" | |
- "Cargo.lock" | |
- ".github/workflows/ci-sys.yml" | |
pull_request: | |
branches: | |
- main | |
paths: | |
- "maa-sys/**" | |
- "Cargo.toml" | |
- "Cargo.lock" | |
- ".github/workflows/ci-sys.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 | |
steps: | |
- name: Checkout | |
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 | |
- name: Install MaaCore | |
env: | |
MAA_API_URL: https://github.com/MaaAssistantArknights/MaaRelease/raw/main/MaaAssistantArknights/api/version | |
run: | | |
cargo run -- install beta -t0 --no-resource | |
MAA_CORE_DIR="$(cargo run -- dir lib)" | |
ls -l "$MAA_CORE_DIR" | |
echo "MAA_CORE_DIR=$MAA_CORE_DIR" >> $GITHUB_ENV | |
- name: Build | |
run: cargo build --package maa-sys --locked | |
- name: Lint (clippy) | |
run: cargo clippy --package maa-sys --locked -- -D warnings | |
- name: Lint (fmt) | |
run: cargo fmt --package maa-sys -- --check | |
- name: Test | |
# It seems rust needs a static library to check the linking. | |
# Without this, we can not link maa-sys to MaaCore on Windows. | |
# https://stackoverflow.com/questions/63394094/rust-linker-seeks-a-lib-rather-than-a-dll | |
if: ${{ !startsWith(matrix.os, 'windows') }} | |
run: cargo test --package maa-sys --locked |