mirror of
https://github.com/actions/runner-images.git
synced 2025-12-11 11:37:00 +00:00
[macOS] refactor utils.sh and related scripts (#8998)
* Update Software Report to support azcopy output * Update util.sh and related scripts * Remove rosetta test from the script * Update mono script * clean up * remove condition from install pipx script * Update scripts according to comments --------- Co-authored-by: Alexey Ayupov <“alexey.ayupov@akvelon.com”>
This commit is contained in:
@@ -7,9 +7,7 @@
|
||||
################################################################################
|
||||
|
||||
echo "Enabling automatic GUI login for the '$USERNAME' user.."
|
||||
|
||||
python3 $HOME/bootstrap/kcpassword.py "$PASSWORD"
|
||||
|
||||
/usr/bin/defaults write /Library/Preferences/com.apple.loginwindow autoLoginUser "$USERNAME"
|
||||
|
||||
: '
|
||||
|
||||
@@ -43,7 +43,6 @@ defaults write com.apple.VoiceOver4/default SCREnableAppleScript -bool YES
|
||||
|
||||
swiftc -suppress-warnings "${HOME}/image-generation/add-certificate.swift"
|
||||
|
||||
|
||||
certs=(
|
||||
AppleWWDRCAG3.cer
|
||||
DeveloperIDG2CA.cer
|
||||
@@ -52,9 +51,7 @@ for cert in ${certs[@]}; do
|
||||
echo "Adding ${cert} certificate"
|
||||
cert_path="${HOME}/${cert}"
|
||||
curl -fsSL "https://www.apple.com/certificateauthority/${cert}" --output ${cert_path}
|
||||
|
||||
sudo ./add-certificate ${cert_path}
|
||||
|
||||
rm ${cert_path}
|
||||
done
|
||||
|
||||
|
||||
@@ -41,5 +41,4 @@ echo "limit.maxfiles.plist permissions changing"
|
||||
chown root:wheel "${Launch_Daemons}/limit.maxfiles.plist"
|
||||
chmod 0644 "${Launch_Daemons}/limit.maxfiles.plist"
|
||||
|
||||
|
||||
echo "Done, limit.maxfiles has been updated"
|
||||
|
||||
@@ -30,7 +30,6 @@ EOF
|
||||
/bin/chmod 644 "${PLIST}"
|
||||
/usr/sbin/chown root:wheel "${PLIST}"
|
||||
|
||||
|
||||
: '
|
||||
The MIT License (MIT)
|
||||
Copyright (c) 2013-2017 Timothy Sutton
|
||||
|
||||
@@ -13,11 +13,10 @@ if is_Arm64; then
|
||||
fi
|
||||
|
||||
retry=10
|
||||
while [ $retry -gt 0 ]; do
|
||||
while [[ $retry -gt 0 ]]; do
|
||||
openwindows=$(osascript -e 'tell application "System Events" to get every window of (every process whose class of windows contains window)') && break
|
||||
|
||||
retry=$((retry-1))
|
||||
if [ $retry -eq 0 ]; then
|
||||
if [[ $retry -eq 0 ]]; then
|
||||
echo "No retry attempts left"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
################################################################################
|
||||
|
||||
source ~/utils/utils.sh
|
||||
|
||||
XCODE_LIST=($(get_toolset_value '.xcode.versions | reverse | .[].link'))
|
||||
DEFAULT_XCODE_VERSION=$(get_toolset_value '.xcode.default')
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ if [ ! -d $ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE ]; then
|
||||
mkdir -p $ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE
|
||||
fi
|
||||
|
||||
download_url=$(get_github_package_download_url "actions/action-versions" "contains(\"action-versions.tar.gz\")" "latest")
|
||||
download_url=$(resolve_github_release_asset_url "actions/action-versions" "contains(\"action-versions.tar.gz\")" "latest")
|
||||
echo "Downloading action-versions $download_url"
|
||||
archive_path=$(download_with_retry "$download_url")
|
||||
tar -xzf "$archive_path" -C "$ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE"
|
||||
|
||||
@@ -11,40 +11,40 @@ echo "Installing Google Chrome..."
|
||||
brew install --cask google-chrome
|
||||
|
||||
# Parse Google Chrome version
|
||||
FULL_CHROME_VERSION=$("/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --version)
|
||||
FULL_CHROME_VERSION=${FULL_CHROME_VERSION#Google Chrome }
|
||||
CHROME_VERSION=${FULL_CHROME_VERSION%.*}
|
||||
echo "Google Chrome version is $FULL_CHROME_VERSION"
|
||||
full_chrome_version=$("/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --version)
|
||||
full_chrome_version=${full_chrome_version#Google Chrome }
|
||||
chrome_version=${full_chrome_version%.*}
|
||||
echo "Google Chrome version is $full_chrome_version"
|
||||
|
||||
# Get Google Chrome versions information
|
||||
CHROME_PLATFORM="mac-$arch"
|
||||
chrome_platform="mac-$arch"
|
||||
CHROME_VERSIONS_URL="https://googlechromelabs.github.io/chrome-for-testing/latest-patch-versions-per-build-with-downloads.json"
|
||||
CHROME_VERSIONS_JSON="$(cat "$(download_with_retry "$CHROME_VERSIONS_URL")")"
|
||||
chrome_versions_json="$(cat "$(download_with_retry "$CHROME_VERSIONS_URL")")"
|
||||
|
||||
# Download and unpack the latest release of Chrome Driver
|
||||
CHROMEDRIVER_VERSION=$(echo "${CHROME_VERSIONS_JSON}" | jq -r '.builds["'"$CHROME_VERSION"'"].version')
|
||||
echo "Installing Chrome Driver version $CHROMEDRIVER_VERSION"
|
||||
chromedriver_version=$(echo "${chrome_versions_json}" | jq -r '.builds["'"$chrome_version"'"].version')
|
||||
echo "Installing Chrome Driver version $chromedriver_version"
|
||||
|
||||
CHROMEDRIVER_URL=$(echo "${CHROME_VERSIONS_JSON}" | jq -r '.builds["'"$CHROME_VERSION"'"].downloads.chromedriver[] | select(.platform=="'"${CHROME_PLATFORM}"'").url')
|
||||
CHROMEDRIVER_DIR="/usr/local/share/chromedriver-${CHROME_PLATFORM}"
|
||||
CHROMEDRIVER_BIN="$CHROMEDRIVER_DIR/chromedriver"
|
||||
chromedriver_url=$(echo "${chrome_versions_json}" | jq -r '.builds["'"$chrome_version"'"].downloads.chromedriver[] | select(.platform=="'"${chrome_platform}"'").url')
|
||||
chromedriver_dir="/usr/local/share/chromedriver-${chrome_platform}"
|
||||
chromedriver_bin="$chromedriver_dir/chromedriver"
|
||||
|
||||
CHROMEDRIVER_ARCHIVE_PATH=$(download_with_retry "$CHROMEDRIVER_URL")
|
||||
unzip -qq "$CHROMEDRIVER_ARCHIVE_PATH" -d /tmp/
|
||||
sudo mv "/tmp/chromedriver-${CHROME_PLATFORM}" "$CHROMEDRIVER_DIR"
|
||||
ln -s "$CHROMEDRIVER_BIN" /usr/local/bin/chromedriver
|
||||
echo "export CHROMEWEBDRIVER=$CHROMEDRIVER_DIR" >> "${HOME}/.bashrc"
|
||||
chromedriver_archive_path=$(download_with_retry "$chromedriver_url")
|
||||
unzip -qq "$chromedriver_archive_path" -d /tmp/
|
||||
sudo mv "/tmp/chromedriver-${chrome_platform}" "$chromedriver_dir"
|
||||
ln -s "$chromedriver_bin" /usr/local/bin/chromedriver
|
||||
echo "export CHROMEWEBDRIVER=$chromedriver_dir" >> "${HOME}/.bashrc"
|
||||
|
||||
# Download and unpack the latest release of Google Chrome for Testing
|
||||
CHROME_FOR_TESTING_VERSION=$(echo "${CHROME_VERSIONS_JSON}" | jq -r '.builds["'"$CHROME_VERSION"'"].version')
|
||||
echo "Installing Google Chrome for Testing version $CHROME_FOR_TESTING_VERSION"
|
||||
chrome_for_testing_version=$(echo "${chrome_versions_json}" | jq -r '.builds["'"$chrome_version"'"].version')
|
||||
echo "Installing Google Chrome for Testing version $chrome_for_testing_version"
|
||||
|
||||
CHROME_FOR_TESTING_URL=$(echo "${CHROME_VERSIONS_JSON}" | jq -r '.builds["'"$CHROME_VERSION"'"].downloads.chrome[] | select(.platform=="'"${CHROME_PLATFORM}"'").url')
|
||||
CHROME_FOR_TESTING_APP="Google Chrome for Testing.app"
|
||||
chrome_for_testing_url=$(echo "${chrome_versions_json}" | jq -r '.builds["'"$chrome_version"'"].downloads.chrome[] | select(.platform=="'"${chrome_platform}"'").url')
|
||||
chrome_for_testing_app="Google Chrome for Testing.app"
|
||||
|
||||
CHROME_FOR_TESTING_ARCHIVE_PATH=$(download_with_retry "$CHROME_FOR_TESTING_URL")
|
||||
unzip -qq "$CHROME_FOR_TESTING_ARCHIVE_PATH" -d /tmp/
|
||||
mv "/tmp/chrome-${CHROME_PLATFORM}/${CHROME_FOR_TESTING_APP}" "/Applications/${CHROME_FOR_TESTING_APP}"
|
||||
chrome_for_testing_archive_path=$(download_with_retry "$chrome_for_testing_url")
|
||||
unzip -qq "$chrome_for_testing_archive_path" -d /tmp/
|
||||
mv "/tmp/chrome-${chrome_platform}/${chrome_for_testing_app}" "/Applications/${chrome_for_testing_app}"
|
||||
|
||||
echo "Installing Selenium"
|
||||
brew_smart_install "selenium-server"
|
||||
|
||||
@@ -51,7 +51,7 @@ if is_Monterey; then
|
||||
osascript $HOME/utils/confirm-identified-developers.scpt $USER_PASSWORD
|
||||
} && break
|
||||
|
||||
if [ "$retry" -eq 0 ]; then
|
||||
if [[ "$retry" -eq 0 ]]; then
|
||||
echo "Executing AppleScript failed. No retries left"
|
||||
exit 1
|
||||
fi
|
||||
@@ -75,14 +75,14 @@ if is_Monterey; then
|
||||
dbQuery="SELECT * FROM kext_policy WHERE bundle_id LIKE 'com.parallels.kext.%';"
|
||||
kext=$(sudo sqlite3 $dbName "$dbQuery")
|
||||
|
||||
if [ -z "$kext" ]; then
|
||||
if [[ -z "$kext" ]]; then
|
||||
echo "Parallels International GmbH not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create env variable
|
||||
url=$(brew info --json=v2 --installed | jq -r '.casks[] | select(.name[] == "Parallels Desktop").url')
|
||||
if [ -z "$url" ]; then
|
||||
if [[ -z "$url" ]]; then
|
||||
echo "Unable to parse url for Parallels Desktop cask"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -15,21 +15,21 @@ DOTNET_INSTALL_SCRIPT="https://dot.net/v1/dotnet-install.sh"
|
||||
install_script_path=$(download_with_retry $DOTNET_INSTALL_SCRIPT)
|
||||
chmod +x "$install_script_path"
|
||||
|
||||
ARGS_LIST=()
|
||||
args_list=()
|
||||
echo "Parsing dotnet SDK (except rc and preview versions) from .json..."
|
||||
|
||||
DOTNET_VERSIONS=($(get_toolset_value ".dotnet.arch[\"$arch\"].versions | .[]"))
|
||||
dotnet_versions=($(get_toolset_value ".dotnet.arch[\"$arch\"].versions | .[]"))
|
||||
|
||||
for DOTNET_VERSION in "${DOTNET_VERSIONS[@]}"; do
|
||||
RELEASE_URL="https://raw.githubusercontent.com/dotnet/core/main/release-notes/${DOTNET_VERSION}/releases.json"
|
||||
releases_json_file=$(download_with_retry "$RELEASE_URL")
|
||||
for dotnet_version in "${dotnet_versions[@]}"; do
|
||||
release_url="https://raw.githubusercontent.com/dotnet/core/main/release-notes/${dotnet_version}/releases.json"
|
||||
releases_json_file=$(download_with_retry "$release_url")
|
||||
|
||||
if [[ $DOTNET_VERSION == "6.0" ]]; then
|
||||
ARGS_LIST+=(
|
||||
if [[ $dotnet_version == "6.0" ]]; then
|
||||
args_list+=(
|
||||
$(cat "$releases_json_file" | jq -r 'first(.releases[].sdks[]?.version | select(contains("preview") or contains("rc") | not))')
|
||||
)
|
||||
else
|
||||
ARGS_LIST+=(
|
||||
args_list+=(
|
||||
$(cat "$releases_json_file" | \
|
||||
jq -r '.releases[].sdk."version"' | grep -v -E '\-(preview|rc)\d*' | \
|
||||
sort -r | rev | uniq -s 2 | rev)
|
||||
@@ -37,7 +37,7 @@ for DOTNET_VERSION in "${DOTNET_VERSIONS[@]}"; do
|
||||
fi
|
||||
done
|
||||
|
||||
for ARGS in "${ARGS_LIST[@]}"; do
|
||||
for ARGS in "${args_list[@]}"; do
|
||||
"$install_script_path" --version $ARGS -NoPath --arch $arch
|
||||
done
|
||||
|
||||
|
||||
@@ -10,27 +10,27 @@ echo "Installing Microsoft Edge..."
|
||||
brew install --cask microsoft-edge
|
||||
|
||||
EDGE_INSTALLATION_PATH="/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge"
|
||||
EDGE_VERSION=$("$EDGE_INSTALLATION_PATH" --version | cut -d' ' -f 3)
|
||||
EDGE_VERSION_MAJOR=$(echo $EDGE_VERSION | cut -d'.' -f 1)
|
||||
edge_version=$("$EDGE_INSTALLATION_PATH" --version | cut -d' ' -f 3)
|
||||
edge_version_major=$(echo $edge_version | cut -d'.' -f 1)
|
||||
|
||||
echo "Version of Microsoft Edge: ${EDGE_VERSION}"
|
||||
echo "Version of Microsoft Edge: ${edge_version}"
|
||||
|
||||
echo "Installing Microsoft Edge WebDriver..."
|
||||
|
||||
EDGE_DRIVER_VERSION_FILE_PATH=$(download_with_retry "https://msedgedriver.azureedge.net/LATEST_RELEASE_${EDGE_VERSION_MAJOR}_MACOS")
|
||||
EDGE_DRIVER_LATEST_VERSION=$(iconv -f utf-16 -t utf-8 "$EDGE_DRIVER_VERSION_FILE_PATH" | tr -d '\r')
|
||||
EDGE_DRIVER_URL="https://msedgedriver.azureedge.net/${EDGE_DRIVER_LATEST_VERSION}/edgedriver_mac64.zip"
|
||||
edge_driver_version_file_path=$(download_with_retry "https://msedgedriver.azureedge.net/LATEST_RELEASE_${edge_version_major}_MACOS")
|
||||
edge_driver_latest_version=$(iconv -f utf-16 -t utf-8 "$edge_driver_version_file_path" | tr -d '\r')
|
||||
edge_driver_url="https://msedgedriver.azureedge.net/${edge_driver_latest_version}/edgedriver_mac64.zip"
|
||||
|
||||
echo "Compatible version of WebDriver: ${EDGE_DRIVER_LATEST_VERSION}"
|
||||
echo "Compatible version of WebDriver: ${edge_driver_latest_version}"
|
||||
|
||||
EDGE_DRIVER_ARCHIVE_PATH=$(download_with_retry "$EDGE_DRIVER_URL")
|
||||
edge_driver_archive_path=$(download_with_retry "$edge_driver_url")
|
||||
|
||||
# Move webdriver to the separate directory to be consistent with the docs
|
||||
# https://docs.microsoft.com/en-us/azure/devops/pipelines/test/continuous-test-selenium?view=azure-devops#decide-how-you-will-deploy-and-test-your-app
|
||||
|
||||
EDGE_DRIVER_DIR="/usr/local/share/edge_driver"
|
||||
mkdir -p $EDGE_DRIVER_DIR
|
||||
unzip -qq "$EDGE_DRIVER_ARCHIVE_PATH" -d "$EDGE_DRIVER_DIR"
|
||||
unzip -qq "$edge_driver_archive_path" -d "$EDGE_DRIVER_DIR"
|
||||
ln -s "$EDGE_DRIVER_DIR/msedgedriver" "/usr/local/bin/msedgedriver"
|
||||
|
||||
echo "export EDGEWEBDRIVER=${EDGE_DRIVER_DIR}" >> "${HOME}/.bashrc"
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
|
||||
source ~/utils/utils.sh
|
||||
|
||||
DEFAULT_GO_VERSION=$(get_toolset_value '.go.default')
|
||||
default_go_version=$(get_toolset_value '.go.default')
|
||||
echo "Installing Go..."
|
||||
brew_smart_install "go@${DEFAULT_GO_VERSION}"
|
||||
brew_smart_install "go@${default_go_version}"
|
||||
|
||||
# Create symlinks to preserve backward compatibility. Symlinks are not created when non-latest go is being installed
|
||||
ln -sf $(brew --prefix go@${DEFAULT_GO_VERSION})/bin/* /usr/local/bin/
|
||||
ln -sf $(brew --prefix go@${default_go_version})/bin/* /usr/local/bin/
|
||||
|
||||
invoke_tests "Common" "Go"
|
||||
|
||||
@@ -4,50 +4,48 @@
|
||||
## Desc: Install Mono Framework
|
||||
################################################################################
|
||||
|
||||
# Source utility functions
|
||||
source ~/utils/utils.sh
|
||||
|
||||
# Install Mono Framework
|
||||
MONO_VERSION_FULL=$(get_toolset_value '.mono.framework.version')
|
||||
MONO_PKG_SHA256=$(get_toolset_value '.mono.framework.sha256')
|
||||
MONO_VERSION=$(echo "$MONO_VERSION_FULL" | cut -d. -f 1,2,3)
|
||||
MONO_VERSION_SHORT=$(echo $MONO_VERSION_FULL | cut -d. -f 1,2)
|
||||
MONO_PKG_URL="https://download.mono-project.com/archive/${MONO_VERSION}/macos-10-universal/MonoFramework-MDK-${MONO_VERSION_FULL}.macos10.xamarin.universal.pkg"
|
||||
mono_version_full=$(get_toolset_value '.mono.framework.version')
|
||||
mono_pkg_sha256=$(get_toolset_value '.mono.framework.sha256')
|
||||
mono_version=$(echo "$mono_version_full" | cut -d. -f 1,2,3)
|
||||
mono_version_short=$(echo $mono_version_full | cut -d. -f 1,2)
|
||||
mono_pkg_url="https://download.mono-project.com/archive/${mono_version}/macos-10-universal/MonoFramework-MDK-${mono_version_full}.macos10.xamarin.universal.pkg"
|
||||
MONO_VERSIONS_PATH='/Library/Frameworks/Mono.framework/Versions'
|
||||
|
||||
MONO_PKG_PATH=$(download_with_retry "$MONO_PKG_URL")
|
||||
use_checksum_comparison "$MONO_PKG_PATH" "$MONO_PKG_SHA256"
|
||||
|
||||
echo "Installing Mono Framework ${MONO_VERSION_FULL}..."
|
||||
sudo installer -pkg "$MONO_PKG_PATH" -target /
|
||||
mono_pkg_path=$(download_with_retry "$mono_pkg_url")
|
||||
use_checksum_comparison "$mono_pkg_path" "$mono_pkg_sha256"
|
||||
echo "Installing Mono Framework ${mono_version_full}..."
|
||||
sudo installer -pkg "$mono_pkg_path" -target /
|
||||
|
||||
# Download and install NUnit console
|
||||
NUNIT_VERSION=$(get_toolset_value '.mono.nunit.version')
|
||||
NUNIT_ARCHIVE_URL="https://github.com/nunit/nunit-console/releases/download/${NUNIT_VERSION}/NUnit.Console-${NUNIT_VERSION}.zip"
|
||||
NUNIT_ARCHIVE_SHA256=$(get_toolset_value '.mono.nunit.sha256')
|
||||
nunit_version=$(get_toolset_value '.mono.nunit.version')
|
||||
nunit_archive_url="https://github.com/nunit/nunit-console/releases/download/${nunit_version}/NUnit.Console-${nunit_version}.zip"
|
||||
nunit_archive_sha256=$(get_toolset_value '.mono.nunit.sha256')
|
||||
NUNIT_PATH="/Library/Developer/nunit"
|
||||
NUNIT_VERSION_PATH="$NUNIT_PATH/$NUNIT_VERSION"
|
||||
nunit_version_path="$NUNIT_PATH/$nunit_version"
|
||||
|
||||
NUNIT_ARCHIVE_PATH=$(download_with_retry "$NUNIT_ARCHIVE_URL")
|
||||
use_checksum_comparison "$NUNIT_ARCHIVE_PATH" "$NUNIT_ARCHIVE_SHA256"
|
||||
echo "Installing NUnit ${NUNIT_VERSION}..."
|
||||
sudo mkdir -p "$NUNIT_VERSION_PATH"
|
||||
sudo unzip -q "$NUNIT_ARCHIVE_PATH" -d "$NUNIT_VERSION_PATH"
|
||||
nunit_archive_path=$(download_with_retry "$nunit_archive_url")
|
||||
use_checksum_comparison "$nunit_archive_path" "$nunit_archive_sha256"
|
||||
echo "Installing NUnit ${nunit_version}..."
|
||||
sudo mkdir -p "$nunit_version_path"
|
||||
sudo unzip -q "$nunit_archive_path" -d "$nunit_version_path"
|
||||
|
||||
# Create a wrapper script for nunit3-console
|
||||
echo "Creating nunit3-console wrapper..."
|
||||
NUNIT3_CONSOLE_WRAPPER=$(mktemp)
|
||||
cat <<EOF > "$NUNIT3_CONSOLE_WRAPPER"
|
||||
nunit3_console_wrapper=$(mktemp)
|
||||
cat <<EOF > "$nunit3_console_wrapper"
|
||||
#!/bin/bash -e -o pipefail
|
||||
exec ${MONO_VERSIONS_PATH}/${MONO_VERSION}/bin/mono --debug \$MONO_OPTIONS $NUNIT_VERSION_PATH/nunit3-console.exe "\$@"
|
||||
exec ${MONO_VERSIONS_PATH}/${mono_version}/bin/mono --debug \$MONO_OPTIONS $nunit_version_path/nunit3-console.exe "\$@"
|
||||
EOF
|
||||
cat "$NUNIT3_CONSOLE_WRAPPER"
|
||||
sudo chmod +x "$NUNIT3_CONSOLE_WRAPPER"
|
||||
sudo mv "$NUNIT3_CONSOLE_WRAPPER" "${MONO_VERSIONS_PATH}/${MONO_VERSION}/Commands/nunit3-console"
|
||||
cat "$nunit3_console_wrapper"
|
||||
sudo chmod +x "$nunit3_console_wrapper"
|
||||
sudo mv "$nunit3_console_wrapper" "${MONO_VERSIONS_PATH}/${mono_version}/Commands/nunit3-console"
|
||||
|
||||
# Create a symlink for the short version of Mono (e.g., 6.12)
|
||||
echo "Creating short symlink '${MONO_VERSION_SHORT}'..."
|
||||
sudo ln -s "${MONO_VERSIONS_PATH}/${MONO_VERSION}" "${MONO_VERSIONS_PATH}/${MONO_VERSION_SHORT}"
|
||||
echo "Creating short symlink '${mono_version_short}'..."
|
||||
sudo ln -s "${MONO_VERSIONS_PATH}/${mono_version}" "${MONO_VERSIONS_PATH}/${mono_version_short}"
|
||||
|
||||
# Invoke tests for Xamarin and Mono
|
||||
invoke_tests "Xamarin" "Mono"
|
||||
|
||||
@@ -19,7 +19,6 @@ if bash "$nvm_installer_path"; then
|
||||
|
||||
# set system node as default
|
||||
nvm alias default system
|
||||
|
||||
echo "Node version manager has been installed successfully"
|
||||
else
|
||||
echo "Node version manager installation failed"
|
||||
|
||||
@@ -8,19 +8,11 @@ source ~/utils/utils.sh
|
||||
|
||||
export PATH="$PATH:/opt/pipx_bin"
|
||||
|
||||
toolset=$(get_toolset_path)
|
||||
pipx_packages=$(jq -r ".pipx[] .package" $toolset)
|
||||
pipx_packages=$(get_toolset_value '.pipx[].package')
|
||||
|
||||
for package in $pipx_packages; do
|
||||
python_version=$(jq -r ".pipx[] | select(.package == \"$package\") .python" $toolset)
|
||||
if [ "$python_version" != "null" ]; then
|
||||
python_path="$HOME/hostedtoolcache/Python/$python_version*/x64/bin/python$python_version"
|
||||
echo "Install $package into python $python_path"
|
||||
pipx install $package --python $python_path
|
||||
else
|
||||
echo "Install $package into default python"
|
||||
pipx install $package
|
||||
fi
|
||||
echo "Install $package into default python"
|
||||
pipx install $package
|
||||
done
|
||||
|
||||
invoke_tests "PipxPackages"
|
||||
|
||||
@@ -11,7 +11,7 @@ arch=$(get_arch)
|
||||
|
||||
metadata_json_path=$(download_with_retry "https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/metadata.json")
|
||||
version=$(jq -r '.LTSReleaseTag[0]' "$metadata_json_path")
|
||||
download_url=$(get_github_package_download_url "PowerShell/PowerShell" "contains(\"osx-$arch.pkg\")" "$version" "$API_PAT")
|
||||
download_url=$(resolve_github_release_asset_url "PowerShell/PowerShell" "contains(\"osx-$arch.pkg\")" "$version" "$API_PAT")
|
||||
pkg_path=$(download_with_retry "$download_url")
|
||||
|
||||
# Work around the issue on macOS Big Sur 11.5 or higher for possible error message ("can't be opened because Apple cannot check it for malicious software") when installing the package
|
||||
|
||||
@@ -8,33 +8,33 @@ source ~/utils/utils.sh
|
||||
source ~/utils/xamarin-utils.sh
|
||||
|
||||
install_vsmac() {
|
||||
local VSMAC_VERSION=$1
|
||||
local VSMAC_DEFAULT=$2
|
||||
if [ $VSMAC_VERSION == "2019" ]; then
|
||||
VSMAC_DOWNLOAD_URL=$(curl -fsSL "https://aka.ms/manifest/stable" | jq -r '.items[] | select(.genericName=="VisualStudioMac").url')
|
||||
elif [ $VSMAC_VERSION == "2022" ]; then
|
||||
VSMAC_DOWNLOAD_URL=$(curl -fsSL "https://aka.ms/manifest/stable-2022" | jq -r '.items[] | select(.genericName=="VisualStudioMac").url')
|
||||
elif [ $VSMAC_VERSION == "preview" ]; then
|
||||
VSMAC_DOWNLOAD_URL=$(curl -fsSL "https://aka.ms/manifest/preview" | jq -r '.items[] | select(.genericName=="VisualStudioMac").url')
|
||||
local vsmac_version=$1
|
||||
local vsmac_default=$2
|
||||
if [[ $vsmac_version == "2019" ]]; then
|
||||
vsmac_download_url=$(curl -fsSL "https://aka.ms/manifest/stable" | jq -r '.items[] | select(.genericName=="VisualStudioMac").url')
|
||||
elif [[ $vsmac_version == "2022" ]]; then
|
||||
vsmac_download_url=$(curl -fsSL "https://aka.ms/manifest/stable-2022" | jq -r '.items[] | select(.genericName=="VisualStudioMac").url')
|
||||
elif [[ $vsmac_version == "preview" ]]; then
|
||||
vsmac_download_url=$(curl -fsSL "https://aka.ms/manifest/preview" | jq -r '.items[] | select(.genericName=="VisualStudioMac").url')
|
||||
else
|
||||
VSMAC_DOWNLOAD_URL=$(buildVSMacDownloadUrl $VSMAC_VERSION)
|
||||
vsmac_download_url=$(buildVSMacDownloadUrl $vsmac_version)
|
||||
fi
|
||||
|
||||
echo "Installing Visual Studio ${VSMAC_VERSION} for Mac"
|
||||
echo "Installing Visual Studio ${vsmac_version} for Mac"
|
||||
TMPMOUNT=$(/usr/bin/mktemp -d /tmp/visualstudio.XXXX)
|
||||
mkdir -p "$TMPMOUNT/downloads"
|
||||
|
||||
VSMAC_INSTALLER=$(download_with_retry "$VSMAC_DOWNLOAD_URL" "$TMPMOUNT/downloads/${VSMAC_DOWNLOAD_URL##*/}")
|
||||
vsmac_installer=$(download_with_retry "$vsmac_download_url" "$TMPMOUNT/downloads/${vsmac_download_url##*/}")
|
||||
|
||||
echo "Mounting Visual Studio..."
|
||||
hdiutil attach "$VSMAC_INSTALLER" -mountpoint "$TMPMOUNT"
|
||||
hdiutil attach "$vsmac_installer" -mountpoint "$TMPMOUNT"
|
||||
|
||||
echo "Moving Visual Studio to /Applications/..."
|
||||
pushd "$TMPMOUNT"
|
||||
tar cf - "./Visual Studio.app" | tar xf - -C /Applications/
|
||||
|
||||
if [ $VSMAC_VERSION != $VSMAC_DEFAULT ]; then
|
||||
mv "/Applications/Visual Studio.app" "/Applications/Visual Studio ${VSMAC_VERSION}.app"
|
||||
if [[ $vsmac_version != $vsmac_default ]]; then
|
||||
mv "/Applications/Visual Studio.app" "/Applications/Visual Studio ${vsmac_version}.app"
|
||||
fi
|
||||
|
||||
popd
|
||||
@@ -42,11 +42,11 @@ install_vsmac() {
|
||||
sudo rm -rf "$TMPMOUNT"
|
||||
}
|
||||
|
||||
VSMAC_VERSIONS=($(get_toolset_value '.xamarin.vsmac.versions[]'))
|
||||
DEFAULT_VSMAC_VERSION=$(get_toolset_value '.xamarin.vsmac.default')
|
||||
vsmac_versions=($(get_toolset_value '.xamarin.vsmac.versions[]'))
|
||||
default_vsmac_version=$(get_toolset_value '.xamarin.vsmac.default')
|
||||
|
||||
for VERSION in "${VSMAC_VERSIONS[@]}"; do
|
||||
install_vsmac $VERSION $DEFAULT_VSMAC_VERSION
|
||||
for version in "${vsmac_versions[@]}"; do
|
||||
install_vsmac $version $default_vsmac_version
|
||||
done
|
||||
|
||||
invoke_tests "Common" "VSMac"
|
||||
|
||||
@@ -7,16 +7,16 @@
|
||||
source ~/utils/utils.sh
|
||||
source ~/utils/xamarin-utils.sh
|
||||
|
||||
MONO_VERSIONS=($(get_toolset_value '.xamarin."mono_versions" | reverse | .[]'))
|
||||
XAMARIN_IOS_VERSIONS=($(get_toolset_value '.xamarin."ios_versions" | reverse | .[]'))
|
||||
XAMARIN_MAC_VERSIONS=($(get_toolset_value '.xamarin."mac_versions" | reverse | .[]'))
|
||||
XAMARIN_ANDROID_VERSIONS=($(get_toolset_value '.xamarin."android_versions" | reverse | .[]'))
|
||||
LATEST_SDK_SYMLINK=$(get_toolset_value '.xamarin.bundles[0].symlink')
|
||||
CURRENT_SDK_SYMLINK=$(get_toolset_value '.xamarin."bundle_default"')
|
||||
DEFAULT_XCODE_VERSION=$(get_toolset_value '.xcode.default')
|
||||
mono_versions=($(get_toolset_value '.xamarin."mono_versions" | reverse | .[]'))
|
||||
xamarin_ios_versions=($(get_toolset_value '.xamarin."ios_versions" | reverse | .[]'))
|
||||
xamarin_mac_versions=($(get_toolset_value '.xamarin."mac_versions" | reverse | .[]'))
|
||||
xamarin_android_versions=($(get_toolset_value '.xamarin."android_versions" | reverse | .[]'))
|
||||
latest_sdk_symlink=$(get_toolset_value '.xamarin.bundles[0].symlink')
|
||||
current_sdk_symlink=$(get_toolset_value '.xamarin."bundle_default"')
|
||||
default_xcode_version=$(get_toolset_value '.xcode.default')
|
||||
|
||||
if [ "$CURRENT_SDK_SYMLINK" == "latest" ]; then
|
||||
CURRENT_SDK_SYMLINK=$LATEST_SDK_SYMLINK
|
||||
if [ "$current_sdk_symlink" == "latest" ]; then
|
||||
current_sdk_symlink=$latest_sdk_symlink
|
||||
fi
|
||||
|
||||
MONO_VERSIONS_PATH='/Library/Frameworks/Mono.framework/Versions'
|
||||
@@ -34,36 +34,36 @@ pushd $TMPMOUNT
|
||||
downloadNUnitConsole
|
||||
|
||||
# Install Mono sdks
|
||||
for VERSION in "${MONO_VERSIONS[@]}"; do installMono $VERSION; done
|
||||
for version in "${mono_versions[@]}"; do installMono $version; done
|
||||
sudo mv -v $TMPMOUNT_FRAMEWORKS/mono/* $MONO_VERSIONS_PATH/
|
||||
|
||||
# Install Xamarin.iOS sdks
|
||||
for VERSION in "${XAMARIN_IOS_VERSIONS[@]}"; do installXamarinIOS $VERSION; done
|
||||
for version in "${xamarin_ios_versions[@]}"; do installXamarinIOS $version; done
|
||||
sudo mv -v $TMPMOUNT_FRAMEWORKS/ios/* $IOS_VERSIONS_PATH/
|
||||
|
||||
# Install Xamarin.Mac sdks
|
||||
for VERSION in "${XAMARIN_MAC_VERSIONS[@]}"; do installXamarinMac $VERSION; done
|
||||
for version in "${xamarin_mac_versions[@]}"; do installXamarinMac $version; done
|
||||
sudo mv -v $TMPMOUNT_FRAMEWORKS/mac/* $MAC_VERSIONS_PATH/
|
||||
|
||||
# Install Xamarin.Android sdks
|
||||
for VERSION in "${XAMARIN_ANDROID_VERSIONS[@]}"; do installXamarinAndroid $VERSION; done
|
||||
for version in "${xamarin_android_versions[@]}"; do installXamarinAndroid $version; done
|
||||
sudo mv -v $TMPMOUNT_FRAMEWORKS/android/* $ANDROID_VERSIONS_PATH/
|
||||
|
||||
|
||||
# Create bundles
|
||||
BUNDLES_COUNT=$(get_toolset_value '.xamarin.bundles | length')
|
||||
for ((BUNDLE_INDEX=0; BUNDLE_INDEX<BUNDLES_COUNT; BUNDLE_INDEX++)); do
|
||||
SYMLINK=$(get_toolset_value ".xamarin.bundles[$BUNDLE_INDEX].symlink")
|
||||
MONO=$(get_toolset_value ".xamarin.bundles[$BUNDLE_INDEX].mono")
|
||||
IOS=$(get_toolset_value ".xamarin.bundles[$BUNDLE_INDEX].ios")
|
||||
MAC=$(get_toolset_value ".xamarin.bundles[$BUNDLE_INDEX].mac")
|
||||
ANDROID=$(get_toolset_value ".xamarin.bundles[$BUNDLE_INDEX].android")
|
||||
createBundle $SYMLINK $MONO $IOS $MAC $ANDROID
|
||||
bundles_count=$(get_toolset_value '.xamarin.bundles | length')
|
||||
for ((bundle_index=0; bundle_index<bundles_count; bundle_index++)); do
|
||||
symlink=$(get_toolset_value ".xamarin.bundles[$bundle_index].symlink")
|
||||
mono=$(get_toolset_value ".xamarin.bundles[$bundle_index].mono")
|
||||
ios=$(get_toolset_value ".xamarin.bundles[$bundle_index].ios")
|
||||
mac=$(get_toolset_value ".xamarin.bundles[$bundle_index].mac")
|
||||
android=$(get_toolset_value ".xamarin.bundles[$bundle_index].android")
|
||||
createBundle $symlink $mono $ios $mac $android
|
||||
done
|
||||
|
||||
# Symlinks for the latest Xamarin bundle
|
||||
createBundleLink $LATEST_SDK_SYMLINK "Latest"
|
||||
createBundleLink $CURRENT_SDK_SYMLINK "Current"
|
||||
createBundleLink $latest_sdk_symlink "Latest"
|
||||
createBundleLink $current_sdk_symlink "Current"
|
||||
|
||||
#
|
||||
# Fix nuget in some mono versions because of known bugs
|
||||
@@ -80,7 +80,7 @@ sudo rm -rf "$TMPMOUNT"
|
||||
# Fix Xamarin issue with Xcode symlink: https://github.com/xamarin/xamarin-macios/issues/9960
|
||||
PREFERENCES_XAMARIN_DIR="${HOME}/Library/Preferences/Xamarin"
|
||||
mkdir -p $PREFERENCES_XAMARIN_DIR
|
||||
/usr/libexec/PlistBuddy -c "add :AppleSdkRoot string /Applications/Xcode_${DEFAULT_XCODE_VERSION}.app" $PREFERENCES_XAMARIN_DIR/Settings.plist
|
||||
/usr/libexec/PlistBuddy -c "add :AppleSdkRoot string /Applications/Xcode_${default_xcode_version}.app" $PREFERENCES_XAMARIN_DIR/Settings.plist
|
||||
|
||||
# Temporary workaround to recreate nuget.config file with a correct feed https://github.com/actions/runner-images/issues/5768
|
||||
rm -rf $HOME/.config/NuGet/NuGet.Config
|
||||
|
||||
@@ -19,11 +19,11 @@ SIMS_TO_INSTALL=(
|
||||
"10.3"
|
||||
)
|
||||
|
||||
for SIM_VERSION in ${SIMS_TO_INSTALL[@]}
|
||||
for sim_version in ${SIMS_TO_INSTALL[@]}
|
||||
do
|
||||
echo "Installing iOS $SIM_VERSION ..."
|
||||
sudo xcversion simulators --install="iOS ${SIM_VERSION}"
|
||||
echo "Successfuly installed iOS $SIM_VERSION ..."
|
||||
echo "Installing iOS $sim_version ..."
|
||||
sudo xcversion simulators --install="iOS ${sim_version}"
|
||||
echo "Successfuly installed iOS $sim_version ..."
|
||||
done
|
||||
|
||||
echo "Done installing simulator runtimes."
|
||||
|
||||
@@ -78,15 +78,11 @@ is_BigSur() {
|
||||
}
|
||||
|
||||
is_Veertu() {
|
||||
[ -d "/Library/Application Support/Veertu" ]
|
||||
}
|
||||
|
||||
get_toolset_path() {
|
||||
echo "$HOME/image-generation/toolset.json"
|
||||
[[ -d "/Library/Application Support/Veertu" ]]
|
||||
}
|
||||
|
||||
get_toolset_value() {
|
||||
local toolset_path=$(get_toolset_path)
|
||||
local toolset_path=$(echo "$HOME/image-generation/toolset.json")
|
||||
local query=$1
|
||||
echo "$(jq -r "$query" $toolset_path)"
|
||||
}
|
||||
@@ -96,32 +92,6 @@ verlte() {
|
||||
[ "$1" = "$sortedVersion" ]
|
||||
}
|
||||
|
||||
brew_cask_install_ignoring_sha256() {
|
||||
local TOOL_NAME=$1
|
||||
|
||||
CASK_DIR="$(brew --repo homebrew/cask)/Casks"
|
||||
chmod a+w "$CASK_DIR/$TOOL_NAME.rb"
|
||||
SHA=$(grep "sha256" "$CASK_DIR/$TOOL_NAME.rb" | awk '{print $2}')
|
||||
sed -i '' "s/$SHA/:no_check/" "$CASK_DIR/$TOOL_NAME.rb"
|
||||
brew install --cask $TOOL_NAME
|
||||
pushd $CASK_DIR
|
||||
git checkout HEAD -- "$TOOL_NAME.rb"
|
||||
popd
|
||||
}
|
||||
|
||||
get_brew_os_keyword() {
|
||||
if is_BigSur; then
|
||||
echo "big_sur"
|
||||
elif is_Monterey; then
|
||||
echo "monterey"
|
||||
elif is_Ventura; then
|
||||
echo "ventura"
|
||||
elif is_Sonoma; then
|
||||
echo "sonoma"
|
||||
else
|
||||
echo "null"
|
||||
fi
|
||||
}
|
||||
|
||||
# brew provides package bottles for different macOS versions
|
||||
# The 'brew install' command will fail if a package bottle does not exist
|
||||
@@ -172,7 +142,6 @@ brew_smart_install() {
|
||||
|
||||
configure_system_tccdb () {
|
||||
local values=$1
|
||||
|
||||
local dbPath="/Library/Application Support/com.apple.TCC/TCC.db"
|
||||
local sqlQuery="INSERT OR IGNORE INTO access VALUES($values);"
|
||||
sudo sqlite3 "$dbPath" "$sqlQuery"
|
||||
@@ -180,46 +149,38 @@ configure_system_tccdb () {
|
||||
|
||||
configure_user_tccdb () {
|
||||
local values=$1
|
||||
|
||||
local dbPath="$HOME/Library/Application Support/com.apple.TCC/TCC.db"
|
||||
local sqlQuery="INSERT OR IGNORE INTO access VALUES($values);"
|
||||
sqlite3 "$dbPath" "$sqlQuery"
|
||||
}
|
||||
|
||||
get_github_package_download_url() {
|
||||
local REPO_ORG=$1
|
||||
local FILTER=$2
|
||||
local VERSION=$3
|
||||
local API_PAT=$4
|
||||
local SEARCH_IN_COUNT="100"
|
||||
resolve_github_release_asset_url() {
|
||||
local repo=$1
|
||||
local filter=$2
|
||||
local version=${3:-"*"}
|
||||
local api_pat=$4
|
||||
|
||||
[ -n "$API_PAT" ] && authString=(-H "Authorization: token ${API_PAT}")
|
||||
page_size="100"
|
||||
|
||||
failed=true
|
||||
for i in {1..10}; do
|
||||
curl "${authString[@]}" -fsSL "https://api.github.com/repos/${REPO_ORG}/releases?per_page=${SEARCH_IN_COUNT}" >/tmp/get_github_package_download_url.json && failed=false || sleep 60
|
||||
[ "$failed" = false ] && break
|
||||
done
|
||||
[ -n "$api_pat" ] && authString=(-H "Authorization: token ${api_pat}")
|
||||
|
||||
if [ "$failed" = true ]; then
|
||||
echo "Failed: get_github_package_download_url"
|
||||
exit 1;
|
||||
fi
|
||||
json=$(curl "${authString[@]}" -fsSL "https://api.github.com/repos/${repo}/releases?per_page=${page_size}")
|
||||
|
||||
json=$(cat /tmp/get_github_package_download_url.json)
|
||||
|
||||
if [[ "$VERSION" == "latest" ]]; then
|
||||
tagName=$(echo $json | jq -r '.[] | select((.prerelease==false) and (.assets | length > 0)).tag_name' | sort --unique --version-sort | egrep -v ".*-[a-z]" | tail -1)
|
||||
if [[ $version == "latest" ]]; then
|
||||
tag_name=$(echo $json | jq -r '.[].tag_name' | sort --unique --version-sort | egrep -v ".*-[a-z]|beta" | tail -n 1)
|
||||
elif [[ $version == *"*"* ]]; then
|
||||
tag_name=$(echo $json | jq -r '.[].tag_name' | sort --unique --version-sort | egrep -v ".*-[a-z]|beta" | egrep "${version}" | tail -n 1)
|
||||
else
|
||||
tagName=$(echo $json | jq -r '.[] | select(.prerelease==false).tag_name' | sort --unique --version-sort | egrep -v ".*-[a-z]" | egrep "\w*${VERSION}" | tail -1)
|
||||
tag_name=$(echo $json | jq -r '.[].tag_name' | sort --unique --version-sort | egrep -v ".*-[a-z]|beta" | egrep "${version}")
|
||||
fi
|
||||
|
||||
downloadUrl=$(echo $json | jq -r ".[] | select(.tag_name==\"${tagName}\").assets[].browser_download_url | select(${FILTER})" | head -n 1)
|
||||
if [ -z "$downloadUrl" ]; then
|
||||
echo "Failed to parse a download url for the '${tagName}' tag using '${FILTER}' filter"
|
||||
download_url=$(echo $json | jq -r ".[] | select(.tag_name==\"${tag_name}\").assets[].browser_download_url | select(${filter})" | head -n 1)
|
||||
if [ -z "$download_url" ]; then
|
||||
echo "Failed to parse a download url for the '${tag_name}' tag using '${filter}' filter"
|
||||
exit 1
|
||||
fi
|
||||
echo $downloadUrl
|
||||
|
||||
echo $download_url
|
||||
}
|
||||
|
||||
# Close all finder windows because they can interfere with UI tests
|
||||
|
||||
11
images/macos/scripts/tests/Rosetta.Tests.ps1
Normal file
11
images/macos/scripts/tests/Rosetta.Tests.ps1
Normal file
@@ -0,0 +1,11 @@
|
||||
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
|
||||
|
||||
$os = Get-OSVersion
|
||||
|
||||
Describe "Rosetta" -Skip:(-not $os.IsArm64) {
|
||||
It "Rosetta is available" {
|
||||
$commandResult = Get-CommandResult "/usr/bin/pgrep oahd"
|
||||
$commandResult.Output | Should -Match "\d+"
|
||||
$commandResult.ExitCode | Should -Be 0
|
||||
}
|
||||
}
|
||||
@@ -131,8 +131,7 @@ build {
|
||||
provisioner "shell" {
|
||||
scripts = [
|
||||
"./scripts/build/install-xcode-clt.sh",
|
||||
"./scripts/build/install-homebrew.sh",
|
||||
"./scripts/build/install-rosetta.sh"
|
||||
"./scripts/build/install-homebrew.sh"
|
||||
]
|
||||
execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}"
|
||||
}
|
||||
@@ -170,6 +169,7 @@ build {
|
||||
provisioner "shell" {
|
||||
pause_before = "30s"
|
||||
scripts = [
|
||||
"./scripts/build/install-rosetta.sh",
|
||||
"./scripts/build/configure-windows.sh",
|
||||
"./scripts/build/install-powershell.sh",
|
||||
"./scripts/build/install-mono.sh",
|
||||
|
||||
Reference in New Issue
Block a user