2022-10-24 16:00:17 +03:00
#!/bin/sh
2023-02-13 14:53:01 +02:00
setup_xcode_cloud_environment ( ) {
2022-10-24 16:00:17 +03:00
# Return on failures
# Fail when expanding unset variables
# Trace each command before executing it
set -eEu
# Move to the project root
cd ..
# Prevent installing dependencies in system directories
echo 'export GEM_HOME=$HOME/.gem' >>~/.zshrc
echo 'export PATH=$GEM_HOME/bin:$PATH' >>~/.zshrc
2024-06-18 11:56:23 +01:00
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.zshrc
2022-10-26 18:06:02 +03:00
echo 'export PATH="/Users/local/Library/Python/3.9/bin:$PATH"' >> ~/.zshrc
2022-10-24 16:00:17 +03:00
export GEM_HOME = $HOME /.gem
export PATH = $GEM_HOME /bin:$PATH
2024-06-18 11:56:23 +01:00
export PATH = " /usr/local/opt/ruby/bin: $PATH "
2022-10-26 18:06:02 +03:00
export PATH = " /Users/local/Library/Python/3.9/bin: $PATH "
2022-10-24 16:00:17 +03:00
2024-06-18 11:56:23 +01:00
# Things don't work well on the default ruby version
brew install ruby
2022-10-24 16:00:17 +03:00
gem install bundler
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
2025-03-06 12:59:00 +01:00
# Xcode Cloud shallow clones the repo. We need to deepen it to fetch tags, commit history and be able to rebase main on develop at the end of releases.
2025-03-07 10:11:32 +01:00
# Check if the repository is shallow
if git rev-parse --is-shallow-repository; then
echo "Repository is shallow. Fetching full history..."
git fetch --unshallow --quiet
else
echo "Repository is already fully cloned."
fi
2022-10-24 16:00:17 +03:00
}
2023-02-13 14:53:01 +02:00
install_xcode_cloud_brew_dependencies ( ) {
2025-02-24 18:36:08 +00:00
brew update && brew install xcodegen swiftgen pkl
2022-10-24 16:00:17 +03:00
}
2023-02-13 14:53:01 +02:00
setup_github_actions_environment( ) {
2023-07-20 17:15:33 +01:00
unset HOMEBREW_NO_INSTALL_FROM_API
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK = 1
2025-02-24 18:36:08 +00:00
brew update && brew install xcodegen swiftlint swiftformat swiftgen git-lfs pkl a7ex/homebrew-formulae/xcresultparser
2023-02-13 14:53:01 +02:00
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
2023-12-19 19:50:04 +02:00
}
setup_github_actions_translations_environment( ) {
unset HOMEBREW_NO_INSTALL_FROM_API
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK = 1
brew update && brew install swiftgen mint localazy/tools/localazy
mint install Asana/locheck
2024-01-25 12:34:56 +02:00
}
generate_what_to_test_notes( ) {
if [ [ -d " $CI_APP_STORE_SIGNED_APP_PATH " ] ] ; then
TESTFLIGHT_DIR_PATH = TestFlight
TESTFLIGHT_NOTES_FILE_NAME = WhatToTest.en-US.txt
LATEST_TAG = ""
if [ " $CI_WORKFLOW " = "Release" ] ; then
# Use -v to invert grep, searching for non-nightlies
LATEST_TAG = $( git tag --sort= -creatordate | grep -v 'nightly' | head -n1)
elif [ " $CI_WORKFLOW " = "Nightly" ] ; then
LATEST_TAG = $( git tag --sort= -creatordate | grep 'nightly' | head -n1)
fi
if [ [ -z " $LATEST_TAG " ] ] ; then
echo "generate_what_to_test_notes: Failed fetching previous tag"
return 0 # Continue even though this failed
fi
echo " generate_what_to_test_notes: latest tag is $LATEST_TAG "
mkdir $TESTFLIGHT_DIR_PATH
2024-02-26 17:44:31 +02:00
NOTES = " $( git log --pretty= '- %an: %s' " $LATEST_TAG " ..HEAD) "
2024-01-25 12:34:56 +02:00
2024-02-22 11:56:12 +02:00
echo "generate_what_to_test_notes: Generated notes:\n" $NOTES ""
2024-01-25 12:34:56 +02:00
2024-02-22 11:56:12 +02:00
echo " $NOTES " > $TESTFLIGHT_DIR_PATH /$TESTFLIGHT_NOTES_FILE_NAME
2024-01-25 12:34:56 +02:00
fi
2022-10-24 16:00:17 +03:00
}