From 3d6e4dd5a4aadc95e31d190cf14716964bdc7611 Mon Sep 17 00:00:00 2001 From: zonyitoo Date: Wed, 29 Sep 2021 12:21:19 +0800 Subject: [PATCH] aarch64-apple-darwin release script fix --- .github/workflows/build-nightly-release.yml | 20 ++++++++++++++++---- .github/workflows/build-release.yml | 4 +++- Cargo.lock | 2 +- build/build-host-release | 12 ++++++++---- 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-nightly-release.yml b/.github/workflows/build-nightly-release.yml index 7c2ec9b3..c422b640 100644 --- a/.github/workflows/build-nightly-release.yml +++ b/.github/workflows/build-nightly-release.yml @@ -52,9 +52,10 @@ jobs: RUST_BACKTRACE: full strategy: matrix: - include: - - os: macos-latest - target: macos-native + os: [macos-latest] + target: + - x86_64-apple-darwin + - aarch64-apple-darwin steps: - uses: actions/checkout@v2 @@ -69,12 +70,21 @@ jobs: uses: actions-rs/toolchain@v1 with: profile: minimal + toolchain: nightly + target: ${{ matrix.target }} + default: true + + # https://github.com/actions/virtual-environments/issues/2557#issuecomment-769611326 + - if: ${{ matrix.target }} == 'aarch64-apple-darwin' + run: | + sudo xcode-select -s /Applications/Xcode_12.4.app && + sudo rm -Rf /Library/Developer/CommandLineTools/SDKs/* - name: Build release shell: bash run: | cd build - ./build-host-release + ./build-host-release -t ${{ matrix.target }} - name: Upload Artifacts uses: actions/upload-artifact@v2 @@ -94,6 +104,8 @@ jobs: uses: actions-rs/toolchain@v1 with: profile: minimal + toolchain: nightly + default: true - name: Build release run: | diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index e2418259..a9f48f4b 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -87,9 +87,10 @@ jobs: profile: minimal toolchain: nightly target: ${{ matrix.target }} + default: true # https://github.com/actions/virtual-environments/issues/2557#issuecomment-769611326 - - if: ${{ matrix.target }} == 'aarch-apple-darwin' + - if: ${{ matrix.target }} == 'aarch64-apple-darwin' run: | sudo xcode-select -s /Applications/Xcode_12.4.app && sudo rm -Rf /Library/Developer/CommandLineTools/SDKs/* @@ -121,6 +122,7 @@ jobs: with: profile: minimal toolchain: nightly + default: true - name: Build release run: | diff --git a/Cargo.lock b/Cargo.lock index f3f6953c..ef62984a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1592,7 +1592,7 @@ dependencies = [ [[package]] name = "shadowsocks-rust" -version = "1.12.0-alpha.6" +version = "1.12.0-alpha.7" dependencies = [ "build-time", "byte_string", diff --git a/build/build-host-release b/build/build-host-release index 4e724663..e65dc6db 100755 --- a/build/build-host-release +++ b/build/build-host-release @@ -22,7 +22,7 @@ ROOT_DIR=$( cd $( dirname $0 ) && pwd ) VERSION=$(grep -E '^version' "${ROOT_DIR}/../Cargo.toml" | awk '{print $3}' | sed 's/"//g') HOST_TRIPLE=$(rustc -Vv | grep 'host:' | awk '{print $2}') -echo "Started build release ${VERSION} for ${HOST_TRIPLE} with features \"${BUILD_FEATURES}\"..." +echo "Started build release ${VERSION} for ${HOST_TRIPLE} (target: ${BUILD_TARGET}) with features \"${BUILD_FEATURES}\"..." if [[ "${BUILD_TARGET}" != "" ]]; then if [[ "${BUILD_FEATURES}" != "" ]]; then @@ -42,15 +42,19 @@ if [[ "$?" != "0" ]]; then exit $?; fi +if [[ "${BUILD_TARGET}" == "" ]]; then + BUILD_TARGET=$HOST_TRIPLE +fi + TARGET_SUFFIX="" -if [[ "${HOST_TRIPLE}" == *"-windows-"* ]]; then +if [[ "${BUILD_TARGET}" == *"-windows-"* ]]; then TARGET_SUFFIX=".exe" fi TARGETS=("sslocal${TARGET_SUFFIX}" "ssserver${TARGET_SUFFIX}" "ssurl${TARGET_SUFFIX}" "ssmanager${TARGET_SUFFIX}") RELEASE_FOLDER="${ROOT_DIR}/release" -RELEASE_PACKAGE_NAME="shadowsocks-v${VERSION}.${HOST_TRIPLE}" +RELEASE_PACKAGE_NAME="shadowsocks-v${VERSION}.${BUILD_TARGET}" mkdir -p "${RELEASE_FOLDER}" @@ -61,7 +65,7 @@ else cd "${ROOT_DIR}/../target/release" fi -if [[ "${HOST_TRIPLE}" == *"-windows-"* ]]; then +if [[ "${BUILD_TARGET}" == *"-windows-"* ]]; then # For Windows, use zip RELEASE_PACKAGE_FILE_NAME="${RELEASE_PACKAGE_NAME}.zip"