Skip to content

Commit

Permalink
Adds native binary support for Darwin Arm64 (e.g. M1 Mac) (#826)
Browse files Browse the repository at this point in the history
* Add Darwin ARM64 binaries

* Update install script for Darwin Arm64
  • Loading branch information
berndverst authored Nov 10, 2021
1 parent 55e18e9 commit 78db31a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 8 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/dapr_cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ jobs:
target_arch: arm64
- os: macOS-latest
target_arch: arm
- os: macOS-latest
target_arch: arm64
steps:
- name: Set up Go ${{ env.GOVER }}
uses: actions/setup-go@v2
Expand Down
37 changes: 31 additions & 6 deletions install/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,16 @@ verifySupported() {
done

if [ "$current_osarch" == "darwin-arm64" ]; then
echo "The darwin_arm64 arch has no native binary, however you can use the amd64 version so long as you have rosetta installed"
echo "Use 'softwareupdate --install-rosetta' to install rosetta if you don't already have it"
ARCH="amd64"
return
if isReleaseAvailable; then
return
else
echo "The darwin_arm64 arch has no native binary for this version of Dapr, however you can use the amd64 version so long as you have rosetta installed"
echo "Use 'softwareupdate --install-rosetta' to install rosetta if you don't already have it"
ARCH="amd64"
return
fi
fi


echo "No prebuilt binary for ${current_osarch}"
exit 1
}
Expand Down Expand Up @@ -133,6 +136,28 @@ downloadFile() {
fi
}

isReleaseAvailable() {
LATEST_RELEASE_TAG=$1

DAPR_CLI_ARTIFACT="${DAPR_CLI_FILENAME}_${OS}_${ARCH}.tar.gz"
DOWNLOAD_BASE="https://github.com/${GITHUB_ORG}/${GITHUB_REPO}/releases/download"
DOWNLOAD_URL="${DOWNLOAD_BASE}/${LATEST_RELEASE_TAG}/${DAPR_CLI_ARTIFACT}"

if [ "$DAPR_HTTP_REQUEST_CLI" == "curl" ]; then
httpstatus=$(curl -sSLI -o /dev/null -w "%{http_code}" "$DOWNLOAD_URL")
if [ "$httpstatus" == "200" ]; then
return 0
fi
else
wget -q --spider "$DOWNLOAD_URL"
exitstatus=$?
if [ $exitstatus -eq 0 ]; then
return 0
fi
fi
return 1
}

installFile() {
tar xf "$ARTIFACT_TMP_FILE" -C "$DAPR_TMP_ROOT"
local tmp_root_dapr_cli="$DAPR_TMP_ROOT/$DAPR_CLI_FILENAME"
Expand Down Expand Up @@ -181,9 +206,9 @@ installCompleted() {
trap "fail_trap" EXIT

getSystemInfo
checkHttpRequestCLI
verifySupported
checkExistingDapr
checkHttpRequestCLI


if [ -z "$1" ]; then
Expand Down

0 comments on commit 78db31a

Please sign in to comment.