From faaf27bce5bc78655988991f29f590d9650777bc Mon Sep 17 00:00:00 2001 From: Loong Date: Tue, 17 Oct 2023 01:50:19 +0800 Subject: [PATCH] don't use cross for aarch64 --- .github/actions/setup/action.yml | 21 +++++++++------------ .github/workflows/ci.yml | 22 +++++++++++----------- .github/workflows/release.yml | 2 +- 3 files changed, 21 insertions(+), 24 deletions(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index e8cfddaf..7df674b3 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -36,18 +36,15 @@ runs: if: inputs.arch == 'aarch64' shell: bash run: rustup target add $CARGO_BUILD_TARGET - - name: Install Cross + - name: Cross Compile Dependencies if: inputs.arch == 'aarch64' && inputs.os == 'ubuntu-latest' - uses: taiki-e/install-action@v2 - with: - tool: cross - - name: Set Cargo Command shell: bash run: | - if command -v cross >/dev/null 2>&1; then - cargo="cross" - else - cargo="cargo" - fi - echo "CARGO_CMD=$cargo" >> $GITHUB_ENV - + sudo apt-get update + sudo apt-get install -y \ + qemu-user \ + gcc-aarch64-linux-gnu \ + libc6-dev-arm64-cross + echo "CFLAGS_aarch64_unknown_linux_gnu='--sysroot=/usr/aarch64-linux-gnu'" >> $GITHUB_ENV + echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV + echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER=qemu-aarch64" >> $GITHUB_ENV diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c9c6097b..d92d1791 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,11 +55,11 @@ jobs: - name: Lint (clippy) if: matrix.arch == 'x86_64' run: | - $CARGO_CMD clippy --all-targets --all-features -- -D warnings + cargo clippy --all-targets --all-features -- -D warnings - name: Lint (rustfmt) if: matrix.arch == 'x86_64' run: | - $CARGO_CMD fmt --all -- --check + cargo fmt --all -- --check - name: Build (maa-cli) run: | cargo build --package maa-cli --locked @@ -76,12 +76,12 @@ jobs: env: MAA_API_URL: https://github.com/MaaAssistantArknights/MaaRelease/raw/main/MaaAssistantArknights/api/version run: | - $CARGO_CMD run -- install beta -t0 + cargo run -- install beta -t0 - name: Show installation if: matrix.arch == 'x86_64' run: | - MAA_CORE_DIR="$($CARGO_CMD run -- dir lib)" - MAA_RESOURCE_DIR="$($CARGO_CMD run -- dir resource)" + MAA_CORE_DIR="$(cargo run -- dir lib)" + MAA_RESOURCE_DIR="$(cargo run -- dir resource)" ls -l "$MAA_CORE_DIR" ls -l "$MAA_RESOURCE_DIR" echo "MAA_CORE_DIR=$MAA_CORE_DIR" >> $GITHUB_ENV @@ -92,7 +92,7 @@ jobs: # https://stackoverflow.com/questions/63394094/rust-linker-seeks-a-lib-rather-than-a-dll if: matrix.arch == 'x86_64' && matrix.os != 'windows-latest' run: | - $CARGO_CMD test --package maa-sys --locked + cargo test --package maa-sys --locked - name: Run with MaaCore (default path) if: matrix.arch == 'x86_64' timeout-minutes: 1 @@ -100,8 +100,8 @@ jobs: env: MAA_CONFIG_DIR: ${{ github.workspace }}/config_examples run: | - $CARGO_CMD run -- version - $CARGO_CMD run -- run daily --dry-run --batch + cargo run -- version + cargo run -- run daily --dry-run --batch - name: Run with MaaCore (relative path) if: matrix.arch == 'x86_64' timeout-minutes: 1 @@ -117,12 +117,12 @@ jobs: mkdir -p "$share_dir" mv "$MAA_RESOURCE_DIR" "$share_dir/resource" ls -l "$share_dir" - $CARGO_CMD run -- version - $CARGO_CMD run -- run daily --dry-run --batch + cargo run -- version + cargo run -- run daily --dry-run --batch - name: Cat MaaCore Log if failed if: failure() run: | - cat "$($CARGO_CMD run -- dir log)/asst.log" + cat "$(cargo run -- dir log)/asst.log" coverage: name: Coverage diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ba6a1430..7d786a29 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -88,7 +88,7 @@ jobs: arch: ${{ matrix.arch }} - name: Build run: | - $CARGO_CMD build --release --locked --package maa-cli + cargo build --release --locked --package maa-cli - name: Tar Artifact run: | tar -cvf "$CARGO_BUILD_TARGET.tar" -C target/$CARGO_BUILD_TARGET/release maa