Skip to content

Commit

Permalink
Apple M1 support (#92)
Browse files Browse the repository at this point in the history
* Enable Apple M1 support by adding darwin/arm64 to supported platforms.

* Enable Apple M1 support by adding darwin/arm64 to homebrew tap script.

* Fix if -> elif
  • Loading branch information
santiagocardenas authored Aug 17, 2021
1 parent 0163d37 commit e2b8d8c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ GOARCH ?= amd64
GOPROXY ?= "https://proxy.golang.org,direct"
MAKEFILE_PATH = $(dir $(realpath -s $(firstword $(MAKEFILE_LIST))))
BUILD_DIR_PATH = ${MAKEFILE_PATH}/build
SUPPORTED_PLATFORMS ?= "windows/amd64,darwin/amd64,linux/amd64,linux/arm64,linux/arm"
SUPPORTED_PLATFORMS ?= "windows/amd64,darwin/amd64,darwin/arm64,linux/amd64,linux/arm64,linux/arm"
SELECTOR_PKG_VERSION_VAR=github.com/aws/amazon-ec2-instance-selector/v2/pkg/selector.versionID
LATEST_RELEASE_TAG=$(shell git describe --tags --abbrev=0)
PREVIOUS_RELEASE_TAG=$(shell git describe --abbrev=0 --tags `git rev-list --tags --skip=1 --max-count=1`)
Expand Down
8 changes: 6 additions & 2 deletions scripts/sync-to-aws-homebrew-tap
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ mkdir -p "${DOWNLOAD_DIR}" "${SYNC_DIR}" "${BREW_CONFIG_DIR}"

BASE_ASSET_URL="https://github.com/${REPO}/releases/download/${VERSION}/${BINARY_BASE}"
MAC_HASH=""
MAC_ARM64_HASH=""
LINUX_HASH=""
LINUX_ARM64_HASH=""

Expand Down Expand Up @@ -160,8 +161,10 @@ for os_arch in "${PLATFORMS[@]}"; do
fi
fi

if [[ "${os}" == "darwin" ]]; then
if [[ "${os}" == "darwin" && "${arch}" == "amd64" ]]; then
MAC_HASH=$(hash_file "${asset_file_path}")
elif [[ "${os}" == "darwin" && "${arch}" == "arm64" ]]; then
MAC_ARM64_HASH=$(hash_file "${asset_file_path}")
elif [[ "${os}" == "linux" && "${arch}" == "amd64" ]]; then
LINUX_HASH=$(hash_file "${asset_file_path}")
elif [[ "${os}" == "linux" && "${arch}" == "arm64" ]]; then
Expand All @@ -178,6 +181,7 @@ cat << EOM > "${BREW_CONFIG_DIR}/${BINARY_BASE}.json"
"bottle": {
"root_url": "${BASE_ASSET_URL}",
"sha256": {
"arm64_big_sur": "${MAC_ARM64_HASH}",
"sierra": "${MAC_HASH}",
"linux": "${LINUX_HASH}",
"linux_arm": "${LINUX_ARM64_HASH}"
Expand All @@ -187,7 +191,7 @@ cat << EOM > "${BREW_CONFIG_DIR}/${BINARY_BASE}.json"
EOM

if [[ "${DRY_RUN}" -eq 0 ]]; then
if [[ -z "${MAC_HASH}" ]] && [[ -z "${LINUX_HASH}" ]] && [[ -z "${LINUX_ARM64_HASH}" ]]; then
if [[ -z "${MAC_HASH}" ]] && [[ -z "${MAC_ARM64_HASH}" ]] && [[ -z "${LINUX_HASH}" ]] && [[ -z "${LINUX_ARM64_HASH}" ]]; then
echo "❌ No hashes were calculated and dry-run is NOT engaged. Bailing out so we don't open a bad PR to the tap."
exit 4
fi
Expand Down

0 comments on commit e2b8d8c

Please sign in to comment.