Skip to content

Commit

Permalink
don't use cross for aarch64
Browse files Browse the repository at this point in the history
  • Loading branch information
wangl-cc committed Oct 16, 2023
1 parent a04c899 commit faaf27b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 24 deletions.
21 changes: 9 additions & 12 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
22 changes: 11 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -92,16 +92,16 @@ 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
continue-on-error: ${{ matrix.os == 'windows-latest' }}
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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit faaf27b

Please sign in to comment.