From a59fc927e9c7836f89d7eb6de026136d06db93c4 Mon Sep 17 00:00:00 2001 From: Loong Date: Sun, 10 Dec 2023 22:41:25 +0800 Subject: [PATCH] check cc on macos --- .github/actions/setup/action.yml | 16 +++++++++++++--- .github/workflows/ci.yml | 8 +------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index e1200726..b39d928a 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -7,6 +7,10 @@ inputs: arch: description: 'Target architecture' required: true + cross: + description: 'Whether to install cross' + required: false + default: ${{ arch != 'x86_64' }} coverage: description: 'Whether to install cargo-tarpaulin' required: false @@ -37,11 +41,11 @@ runs: esac echo "CARGO_BUILD_TARGET=$target" >> $GITHUB_ENV - name: Install Target - if: inputs.arch == 'aarch64' + if: fromJson(inputs.cross) shell: bash run: rustup target add $CARGO_BUILD_TARGET - - name: Cross Compile Dependencies (Linux x86_64 to Linux aarch64) - if: inputs.arch == 'aarch64' && startsWith(inputs.os, 'ubuntu') + - name: Setup Cross Compiling Toolchain (Linux x86_64 to aarch64) + if: fromJson(inputs.cross) && inputs.arch == 'aarch64' && startsWith(inputs.os, 'ubuntu') shell: bash run: | sudo apt-get update @@ -52,6 +56,12 @@ runs: echo "AR_aarch64_unknown_linux_gnu=aarch64-linux-gnu-ar" >> $GITHUB_ENV 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 + - name: Setup Cross Compiling Toolchain (macOS x86_64 to aarch64) + if: fromJson(inputs.cross) && inputs.arch == 'aarch64' && startsWith(inputs.os, 'macos') + shell: bash + run: | + which cc + cc --version - name: Install Cargo tarpaulin if: fromJson(inputs.coverage) uses: taiki-e/install-action@v2 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8fda8f73..8c645789 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -107,16 +107,10 @@ jobs: arch: aarch64 - name: Setup Cache uses: Swatinem/rust-cache@v2 - - name: Build (Linux) - if: ${{ startsWith(matrix.os, 'ubuntu') }} + - name: Build run: | cargo build --package maa-cli --locked \ --features git2/vendored-openssl,reqwest/native-tls-vendored - - name: Build (macOS) - if: ${{ startsWith(matrix.os, 'macos') }} - run: | - cargo build --package maa-cli --locked \ - --features git2/vendored-openssl features: name: Build and Test (no default features)