Skip to content

feat: user input in task definition #201

feat: user input in task definition

feat: user input in task definition #201

Workflow file for this run

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:
CARGO_TERM_COLOR: always
defaults:
run:
shell: bash
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Rust
run: rustup component add clippy rustfmt
- name: Lint (clippy)
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Lint (rustfmt)
run: cargo fmt --all --check
build:
name: Build and test
needs: lint
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
# - windows-latest
arch:
- x86_64
- aarch64
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Cross
if: matrix.os == 'ubuntu-latest' && matrix.arch == 'aarch64'
uses: taiki-e/install-action@v2
with:
tool: cross
- name: Setup environment
run: |
if [ "${{ matrix.os }}" = "macos-latest" ]; then
CARGO_CMD=cargo
CARGO_BUILD_TARGET="${{ matrix.arch }}-apple-darwin"
rustup target add $CARGO_BUILD_TARGET
else
if [ "${{ matrix.arch }}" = "aarch64" ]; then
CARGO_CMD=cross
else
CARGO_CMD=cargo
fi
CARGO_BUILD_TARGET="${{ matrix.arch }}-unknown-linux-gnu"
fi
echo "CARGO_CMD=$CARGO_CMD" >> $GITHUB_ENV
echo "CARGO_BUILD_TARGET=$CARGO_BUILD_TARGET" >> $GITHUB_ENV
- name: Build (maa-cli)
run: |
$CARGO_CMD build --package maa-cli --locked
- name: Test (maa-cli)
if: matrix.arch == 'x86_64' || matrix.os == 'ubuntu-latest'
run: |
$CARGO_CMD test --package maa-cli --locked
- name: Install MaaCore
if: matrix.arch == 'x86_64'
env:
MAA_API_URL: https://github.com/MaaAssistantArknights/MaaRelease/raw/main/MaaAssistantArknights/api/version
run: |
cargo run -- install beta -t0
- name: Show installation
if: matrix.arch == 'x86_64'
run: |
MAA_CORE_DIR="$(cargo run -- dir lib)"
RESOURCE_DIR="$(cargo run -- dir resource)"
cd "$MAA_CORE_DIR" || exit 1
ls -l "$MAA_CORE_DIR"
cd "$RESOURCE_DIR" || exit 1
ls -l "$RESOURCE_DIR"
echo "MAA_CORE_DIR=$MAA_CORE_DIR" >> $GITHUB_ENV
- name: Try run with MaaCore
if: matrix.arch == 'x86_64'
run: |
export DYLD_FALLBACK_LIBRARY_PATH="$MAA_CORE_DIR"
cargo run -- version
- name: Test (maa-sys, static)
if: matrix.arch == 'x86_64'
run: |
cargo test --package maa-sys --locked
coverage:
name: Coverage
needs: build
runs-on: ubuntu-latest
container:
image: xd009642/tarpaulin:develop-nightly
options: --security-opt seccomp=unconfined
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Generate code coverage
run: |
cargo +nightly tarpaulin --all-features --workspace --timeout 120 --out xml
- name: Upload to codecov.io
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true