Skip to content

Commit

Permalink
Add macOS on Intel as a fully supported platform
Browse files Browse the repository at this point in the history
  • Loading branch information
SeanTAllen committed Aug 18, 2023
1 parent 37fa7a1 commit 5f56f9f
Show file tree
Hide file tree
Showing 9 changed files with 362 additions and 1 deletion.
45 changes: 45 additions & 0 deletions .ci-scripts/macOS-x86-install-pony-tools.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

case "${1}" in
"release")
REPO=nightlies
;;
"nightly")
REPO=nightlies
;;
*)
echo "invalid ponyc version"
echo "Options:"
echo "release"
echo "nightly"
exit 1
esac

#
# Libressl is required for ponyup
#

brew update
brew install libressl

#
# Install ponyc the hard way
# It will end up in /tmp/ponyc/ with the binary at /tmp/ponyc/bin/ponyc
#

pushd /tmp || exit
mkdir ponyc
curl "https://dl.cloudsmith.io/public/ponylang/${REPO}/raw/versions/latest/ponyc-x86-64-apple-darwin.tar.gz" --output ponyc.tar.gz
tar xzf ponyc.tar.gz -C ponyc --strip-components=1
popd || exit

#
# Install corral the hard way
# It will end up in /tmp/corral/ with the binary at /tmp/corral/bin/corral
#

pushd /tmp || exit
mkdir corral
curl "https://dl.cloudsmith.io/public/ponylang/${REPO}/raw/versions/latest/corral-x86-64-apple-darwin.tar.gz" --output corral.tar.gz
tar xzf corral.tar.gz -C corral --strip-components=1
popd || exit
105 changes: 105 additions & 0 deletions .ci-scripts/release/x86-64-apple-darwin-nightly.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#!/bin/bash

# - Builds release package
# - Uploads to Cloudsmith
#
# Tools required in the environment that runs this:
#
# - bash
# - cloudsmith-cli
# - GNU coreutils
# - GNU gzip
# - GNU make
# - libressl
# - ponyc
# - corral
# - GNU tar

# add hard way installed ponyc, corral to our PATH
export PATH="/tmp/corral/bin:/tmp/ponyc/bin/:/Library/Frameworks/Python.framework/Versions/3.11/bin/:$PATH"
set -o errexit

# Pull in shared configuration specific to this repo
base=$(dirname "$0")
# shellcheck source=.ci-scripts/release/config.bash
source "${base}/config.bash"

# 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 GitHub actions 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 "${GITHUB_REPOSITORY}" ]]; then
echo -e "\e[31mName of this repository needs to be set in GITHUB_REPOSITORY."
echo -e "\e[31mShould be in the form OWNER/REPO, for example:"
echo -e "\e[31m ponylang/ponyup"
echo -e "\e[31mExiting.\e[0m"
exit 1
fi

if [[ -z "${APPLICATION_NAME}" ]]; then
echo -e "\e[31mAPPLICATION_NAME needs to be set."
echo -e "\e[31mExiting.\e[0m"
exit 1
fi

if [[ -z "${APPLICATION_SUMMARY}" ]]; then
echo -e "\e[31mAPPLICATION_SUMMARY needs to be set."
echo -e "\e[31mIt's a short description of the application that will appear in Cloudsmith."
echo -e "\e[31mExiting.\e[0m"
exit 1
fi

# no unset variables allowed from here on out
# allow above so we can display nice error messages for expected unset variables
set -o nounset

TODAY=$(date +%Y%m%d)

# Compiler target parameters
ARCH=x86-64

# Triple construction
VENDOR=apple
OS=darwin
TRIPLE=${ARCH}-${VENDOR}-${OS}

# Build parameters
BUILD_PREFIX=$(mktemp -d)
APPLICATION_VERSION="nightly-${TODAY}"
BUILD_DIR=${BUILD_PREFIX}/${APPLICATION_VERSION}

# Asset information
PACKAGE_DIR=$(mktemp -d)
PACKAGE=${APPLICATION_NAME}-${TRIPLE}

# Cloudsmith configuration
CLOUDSMITH_VERSION=${TODAY}
ASSET_OWNER=ponylang
ASSET_REPO=nightlies
ASSET_PATH=${ASSET_OWNER}/${ASSET_REPO}
ASSET_FILE=${PACKAGE_DIR}/${PACKAGE}.tar.gz
ASSET_SUMMARY="${APPLICATION_SUMMARY}"
ASSET_DESCRIPTION="https://github.com/${GITHUB_REPOSITORY}"

# Build application installation
echo -e "\e[34mBuilding ${APPLICATION_NAME}...\e[0m"
make install prefix="${BUILD_DIR}" arch=${ARCH} \
version="${APPLICATION_VERSION}"

# Package it all up
echo -e "\e[34mCreating .tar.gz of ${APPLICATION_NAME}...\e[0m"
pushd "${BUILD_PREFIX}" || exit 1
tar -cvzf "${ASSET_FILE}" -- *
popd || exit 1

# Ship it off to cloudsmith
echo -e "\e[34mUploading package to cloudsmith...\e[0m"
cloudsmith push raw --version "${CLOUDSMITH_VERSION}" \
--api-key "${CLOUDSMITH_API_KEY}" --summary "${ASSET_SUMMARY}" \
--description "${ASSET_DESCRIPTION}" ${ASSET_PATH} "${ASSET_FILE}"
103 changes: 103 additions & 0 deletions .ci-scripts/release/x86-64-apple-darwin-release.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
#!/bin/bash

# - Builds release package
# - Uploads to Cloudsmith
#
# Tools required in the environment that runs this:
#
# - bash
# - cloudsmith-cli
# - GNU coreutils
# - GNU gzip
# - GNU make
# - libressl
# - ponyc
# - corral
# - GNU tar

# add hard way installed ponyc, corral to our PATH
export PATH="/tmp/corral/bin:/tmp/ponyc/bin/:/Library/Frameworks/Python.framework/Versions/3.11/bin/:$PATH"
set -o errexit

# Pull in shared configuration specific to this repo
base=$(dirname "$0")
# shellcheck source=.ci-scripts/release/config.bash
source "${base}/config.bash"

# 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 GitHub actions 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 "${GITHUB_REPOSITORY}" ]]; then
echo -e "\e[31mName of this repository needs to be set in GITHUB_REPOSITORY."
echo -e "\e[31mShould be in the form OWNER/REPO, for example:"
echo -e "\e[31m ponylang/ponyup"
echo -e "\e[31mExiting.\e[0m"
exit 1
fi

if [[ -z "${APPLICATION_NAME}" ]]; then
echo -e "\e[31mAPPLICATION_NAME needs to be set."
echo -e "\e[31mExiting.\e[0m"
exit 1
fi

if [[ -z "${APPLICATION_SUMMARY}" ]]; then
echo -e "\e[31mAPPLICATION_SUMMARY needs to be set."
echo -e "\e[31mIt's a short description of the application that will appear in Cloudsmith."
echo -e "\e[31mExiting.\e[0m"
exit 1
fi

# no unset variables allowed from here on out
# allow above so we can display nice error messages for expected unset variables
set -o nounset

# Compiler target parameters
ARCH=x86-64

# Triple construction
VENDOR=apple
OS=darwin
TRIPLE=${ARCH}-${VENDOR}-${OS}

# Build parameters
BUILD_PREFIX=$(mktemp -d)
APPLICATION_VERSION=$(cat VERSION)
BUILD_DIR=${BUILD_PREFIX}/${APPLICATION_VERSION}

# Asset information
PACKAGE_DIR=$(mktemp -d)
PACKAGE=${APPLICATION_NAME}-${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="${APPLICATION_SUMMARY}"
ASSET_DESCRIPTION="https://github.com/${GITHUB_REPOSITORY}"

# Build application installation
echo -e "\e[34mBuilding ${APPLICATION_NAME}...\e[0m"
make install prefix="${BUILD_DIR}" arch=${ARCH} \
version="${APPLICATION_VERSION}"

# Package it all up
echo -e "\e[34mCreating .tar.gz of ${APPLICATION_NAME}...\e[0m"
pushd "${BUILD_PREFIX}" || exit 1
tar -cvzf "${ASSET_FILE}" -- *
popd || exit 1

# Ship it off to cloudsmith
echo -e "\e[34mUploading package to cloudsmith...\e[0m"
cloudsmith push raw --version "${CLOUDSMITH_VERSION}" \
--api-key "${CLOUDSMITH_API_KEY}" --summary "${ASSET_SUMMARY}" \
--description "${ASSET_DESCRIPTION}" ${ASSET_PATH} "${ASSET_FILE}"
31 changes: 31 additions & 0 deletions .github/workflows/breakage-against-macOS-x86-ponyc-latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: x86-64 macOS ponyc update breakage test

on:
repository_dispatch:
types: [ponyc-x86_64-macos-nightly-released]

jobs:
vs-ponyc-main-macos:
name: Verify main against ponyc main on x86-64 macOS
runs-on: macos-13
steps:
- uses: actions/checkout@v2
- name: install pony tools
run: bash .ci-scripts/macOS-x86-install-pony-tools.bash nightly
# we can't turn this on until we are able to pass the tests
# that requires a couple of macos on intel ponyc releases
# - name: Test with the most recent ponyc release
# run: |
# export PATH=/tmp/corral/bin/:/tmp/ponyc/bin/:$PATH
# make test
- name: Send alert on failure
if: ${{ failure() }}
uses: zulip/github-actions-zulip/send-message@b62d5a0e48a4d984ea4fce5dd65ba691963d4db4
with:
api-key: ${{ secrets.ZULIP_SCHEDULED_JOB_FAILURE_API_KEY }}
email: ${{ secrets.ZULIP_SCHEDULED_JOB_FAILURE_EMAIL }}
organization-url: 'https://ponylang.zulipchat.com/'
to: notifications
type: stream
topic: ${{ github.repository }} scheduled job failure
content: ${{ github.server_url}}/${{ github.repository }}/actions/runs/${{ github.run_id }} failed.
27 changes: 27 additions & 0 deletions .github/workflows/nightlies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,30 @@ jobs:
type: stream
topic: ${{ github.repository }} scheduled job failure
content: ${{ github.server_url}}/${{ github.repository }}/actions/runs/${{ github.run_id }} failed.

x86-64-apple-darwin-nightly:
name: Build and upload x86-64-apple-darwin-nightly to Cloudsmith
runs-on: macos-13
steps:
- uses: actions/checkout@v2
- name: install pony tools
run: bash .ci-scripts/macOS-x86-install-pony-tools.bash nightly
- name: brew install dependencies
run: brew install coreutils
- name: pip install dependencies
run: pip3 install --upgrade cloudsmith-cli
- name: Build and upload
run: bash .ci-scripts/release/x86-64-apple-darwin-nightly.bash
env:
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}
- name: Send alert on failure
if: ${{ failure() }}
uses: zulip/github-actions-zulip/send-message@b62d5a0e48a4d984ea4fce5dd65ba691963d4db4
with:
api-key: ${{ secrets.ZULIP_SCHEDULED_JOB_FAILURE_API_KEY }}
email: ${{ secrets.ZULIP_SCHEDULED_JOB_FAILURE_EMAIL }}
organization-url: 'https://ponylang.zulipchat.com/'
to: notifications
type: stream
topic: ${{ github.repository }} scheduled job failure
content: ${{ github.server_url}}/${{ github.repository }}/actions/runs/${{ github.run_id }} failed.
27 changes: 27 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,33 @@ jobs:
- name: Bootstrap test
run: SSL=3.0.x .ci-scripts/test-bootstrap.sh

# This won't pass until we have a few ponyc versions that have macos on intel
# and we update the versions we test with. This is off for now.
# macos:
# name: Verify PR builds on x86-64 macOS with most recent ponyc release
# runs-on: macos-13
# steps:
# - uses: actions/checkout@v2
# - name: install pony tools
# run: bash .ci-scripts/macOS-x86-install-pony-tools.bash nightly
# - name: Test with the most recent ponyc release
# run: |
# export PATH="/tmp/corral/bin:/tmp/ponyc/bin/:$PATH"
# make test

x86-64-macos-bootstrap:
name: Test bootstrapping on macOS x86-64
runs-on: macos-13
steps:
- uses: actions/checkout@v2
- name: update homebrew
run: brew update
- name: brew install dependencies
run:
brew install coreutils libressl
- name: Bootstrap test
run: SSL=0.9.0 .ci-scripts/test-bootstrap.sh

windows:
name: Verify PR builds with most recent ponyc release on Windows
runs-on: windows-2022
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,24 @@ jobs:
env:
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}

x86-64-apple-darwin-release:
name: Build and upload x86-64-apple-darwin to Cloudsmith
runs-on: macos-13
needs:
- pre-artefact-creation
steps:
- uses: actions/checkout@v2
- name: install pony tools
run: bash .ci-scripts/macOS-x86-install-pony-tools.bash nightly
- name: brew install dependencies
run: brew install coreutils
- name: pip install dependencies
run: pip3 install --upgrade cloudsmith-cli
- name: Build and upload
run: bash .ci-scripts/release/x86-64-apple-darwin-release.bash
env:
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}

x86-64-pc-windows-msvc-release:
name: Build and upload x86-64-pc-windows-msvc-release to Cloudsmith
runs-on: windows-2022
Expand Down
5 changes: 5 additions & 0 deletions .release-notes/intel-macos.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Add macOS on Intel as fully supported platform

We've added macOS on Intel as a fully supported platform. This means that we test ponyup using macOS on Intel and provide nightly and release builds of ponyup for macOS on Intel.

We plan to maintain ponyup as fully supported on macOS on Intel as long as we have a macOS on Intel environment or until Apple stops supporting new macOS releases on Intel CPUs.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This project is currently beta software.

### Install dependencies

#### macOS (on Apple Silicon)
#### macOS

```bash
brew install libressl
Expand Down

0 comments on commit 5f56f9f

Please sign in to comment.