Skip to content

Commit

Permalink
smarter amplify installation
Browse files Browse the repository at this point in the history
  • Loading branch information
sebsto committed Aug 2, 2024
1 parent 1251976 commit 9230ec2
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 4 deletions.
3 changes: 1 addition & 2 deletions buildspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ phases:

install:
commands:
- softwareupdate --install-rosetta
- curl -sL https://aws-amplify.github.io/amplify-cli/install | bash && $SHELL
- code/ci_actions/00_install_rosetta.sh

pre_build:
commands:
Expand Down
32 changes: 32 additions & 0 deletions code/ci_actions/00_install_rosetta.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Determine the architecture of the macOS device
processorBrand=$(/usr/sbin/sysctl -n machdep.cpu.brand_string)
if [[ "${processorBrand}" = *"Apple"* ]]; then
echo "Apple Processor is present."
else
echo "Apple Processor is not present. Rosetta not required."
exit 0
fi

# Check if Rosetta is installed
checkRosettaStatus=$(/bin/launchctl list | /usr/bin/grep "com.apple.oahd-root-helper")
RosettaFolder="/Library/Apple/usr/share/rosetta"
if [[ -e "${RosettaFolder}" && "${checkRosettaStatus}" != "" ]]; then
echo "Rosetta Folder exists and Rosetta Service is running. Exiting..."
exit 0
else
echo "Rosetta Folder does not exist or Rosetta service is not running. Installing Rosetta..."
fi

# Install Rosetta
/usr/sbin/softwareupdate --install-rosetta --agree-to-license

# Check the result of Rosetta install command
if [[ $? -eq 0 ]]; then
echo "Rosetta installed successfully."
exit 0
else
echo "Rosetta installation failed."
exit 1

fi
exit 0
9 changes: 7 additions & 2 deletions code/ci_actions/02_amplify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@ if [ -f $AMPLIFY_STANDALONE ]; then
elif [ -f $AMPLIFY_BREW ]; then
AMPLIFY_CLI=$AMPLIFY_BREW
else
echo "🛑 Amplify CLI not found"
exit 1
echo "Amplify CLI not found, installing it"
curl -sL https://aws-amplify.github.io/amplify-cli/install | bash && $SHELL
if [ -f $AMPLIFY_STANDALONE ]; then
AMPLIFY_CLI=$AMPLIFY_STANDALONE
elif
echo "🛑 Amplify CLI not found, abording"
exit 1
fi

echo "Using amplify at $AMPLIFY_CLI"
Expand Down

0 comments on commit 9230ec2

Please sign in to comment.