From fd8c8e73bf080353e934e84bcc8c9d8eb47d8bcd Mon Sep 17 00:00:00 2001 From: "Sean T. Allen" Date: Fri, 20 May 2022 10:07:47 -0400 Subject: [PATCH] Add prebuilt ponyc releases on MacOS for Apple Silicon --- .ci-scripts/arm64-release.bash | 68 +++++++++++++++++++ .cirrus.yml | 30 ++++++++ .../apple-silicon-mac-os-releases.md | 3 + RELEASE_PROCESS.md | 1 + 4 files changed, 102 insertions(+) create mode 100644 .ci-scripts/arm64-release.bash create mode 100644 .release-notes/apple-silicon-mac-os-releases.md diff --git a/.ci-scripts/arm64-release.bash b/.ci-scripts/arm64-release.bash new file mode 100644 index 0000000000..1f04adc6c8 --- /dev/null +++ b/.ci-scripts/arm64-release.bash @@ -0,0 +1,68 @@ +#!/bin/bash + +set -e + +# Verify ENV is set up correctly +# We validate all that need to be set in case, in an absolute emergency, +# we need to run this by hand. Otherwise the CI environment should +# provide all of these if properly configured +if [[ -z "${CLOUDSMITH_API_KEY}" ]]; then + echo -e "\e[31mCloudsmith API key needs to be set in CLOUDSMITH_API_KEY." + echo -e "Exiting.\e[0m" + exit 1 +fi + +if [[ -z "${TRIPLE_VENDOR}" ]]; then + echo -e "\e[31mVendor needs to be set in TRIPLE_VENDOR." + echo -e "Exiting.\e[0m" + exit 1 +fi + +if [[ -z "${TRIPLE_OS}" ]]; then + echo -e "\e[31mOperating system needs to be set in TRIPLE_OS." + echo -e "Exiting.\e[0m" + exit 1 +fi + +# Compiler target parameters +MACHINE=arm64 +PROCESSOR=armv8 + +# Triple construction +TRIPLE=${MACHINE}-${TRIPLE_VENDOR}-${TRIPLE_OS} + +# Build parameters +MAKE_PARALLELISM=8 +BUILD_PREFIX=$(mktemp -d) +DESTINATION=${BUILD_PREFIX}/lib/pony + +# Asset information +PACKAGE_DIR=$(mktemp -d) +PACKAGE=ponyc-${TRIPLE} + +# Cloudsmith configuration +CLOUDSMITH_VERSION=$(cat VERSION) +ASSET_OWNER=ponylang +ASSET_REPO=releases +ASSET_PATH=${ASSET_OWNER}/${ASSET_REPO} +ASSET_FILE=${PACKAGE_DIR}/${PACKAGE}.tar.gz +ASSET_SUMMARY="Pony compiler" +ASSET_DESCRIPTION="https://github.com/ponylang/ponyc" + +# Build pony installation +echo "Building ponyc installation..." +make configure arch=${PROCESSOR} build_flags=-j${MAKE_PARALLELISM} +make build +make install arch=${PROCESSOR} prefix="${BUILD_PREFIX}" symlink=no + +# Package it all up +echo "Creating .tar.gz of ponyc installation..." +pushd "${DESTINATION}" || exit 1 +tar -cvzf "${ASSET_FILE}" -- * +popd || exit 1 + +# Ship it off to cloudsmith +echo "Uploading package to cloudsmith..." +cloudsmith push raw --version "${CLOUDSMITH_VERSION}" \ + --api-key "${CLOUDSMITH_API_KEY}" --summary "${ASSET_SUMMARY}" \ + --description "${ASSET_DESCRIPTION}" ${ASSET_PATH} "${ASSET_FILE}" diff --git a/.cirrus.yml b/.cirrus.yml index 016e1887ab..1049220a21 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -609,6 +609,36 @@ task: - export TZ=utc - bash .ci-scripts/x86-64-release.bash +task: + only_if: $CIRRUS_TAG =~ '^\d+\.\d+\.\d+$' + + timeout_in: 120m + + macos_instance: + image: ghcr.io/cirruslabs/macos-monterey-xcode:13.3.1 + + name: "release: arm64-apple-darwin" + + environment: + TRIPLE_VENDOR: apple + TRIPLE_OS: darwin + CLOUDSMITH_API_KEY: ENCRYPTED[!2cb1e71c189cabf043ac3a9030b3c7708f9c4c983c86d07372ae58ad246a07c54e40810d038d31c3cf3ed8888350caca!] + + libs_cache: + folder: build/libs + fingerprint_script: echo "`md5 lib/CMakeLists.txt` arm64 ghcr.io/cirruslabs/macos-monterey-xcode:13.3.1 20220511" + populate_script: make libs build_flags=-j12 + upload_caches: + - libs + + install_script: + - brew install coreutils python + - pip3 install --upgrade cloudsmith-cli + + nightly_script: + - export TZ=utc + - bash .ci-scripts/arm64-release.bash + task: only_if: $CIRRUS_TAG =~ '^\d+\.\d+\.\d+$' diff --git a/.release-notes/apple-silicon-mac-os-releases.md b/.release-notes/apple-silicon-mac-os-releases.md new file mode 100644 index 0000000000..14fe6648cc --- /dev/null +++ b/.release-notes/apple-silicon-mac-os-releases.md @@ -0,0 +1,3 @@ +## Add prebuilt ponyc binaries for MacOS on Apple Silicon + +We've added prebuilt ponyc binaries specifically made to work MacOS Monterey on Apple Silicon. They can be downloaded directly from Cloudsmith. ponyup installation support will be coming in the near future. diff --git a/RELEASE_PROCESS.md b/RELEASE_PROCESS.md index cbe2d0ed43..89e60753f7 100644 --- a/RELEASE_PROCESS.md +++ b/RELEASE_PROCESS.md @@ -44,6 +44,7 @@ You can verify that the release artifacts were successfully built and uploaded b Package names will be: +* ponyc-arm64-apple-darwin.tar.gz * ponyc-x86-64-apple-darwin.tar.gz * ponyc-x86-64-unknown-freebsd-13.0.tar.gz * ponyc-x86-64-pc-windows-msvc.zip