Skip to content

Commit

Permalink
[macOS] Remove macOS-11 related code due to the deprecation (#10383)
Browse files Browse the repository at this point in the history
  • Loading branch information
erik-bershel authored Aug 9, 2024
1 parent 88cb1be commit 22143c7
Show file tree
Hide file tree
Showing 27 changed files with 74 additions and 1,176 deletions.
5 changes: 1 addition & 4 deletions images.CI/macos/anka/Anka.Helpers.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,7 @@ function Set-AnkaVMVideoController {
)

$command = "anka modify $VMName set display -c $Controller"
# Apple Metal is available starting from Big Sur
if (-not $ShortMacOSVersion.StartsWith("10.")) {
$null = Invoke-AnkaCommand -Command $command
}
$null = Invoke-AnkaCommand -Command $command
}

function Set-AnkaVMDisplayResolution {
Expand Down
29 changes: 10 additions & 19 deletions images/macos/scripts/build/configure-machine.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,7 @@ sudo rm -f /var/vm/sleepimage
defaults write NSGlobalDomain NSAppSleepDisabled -bool YES

# Disable Keyboard Setup Assistant window
if is_Veertu; then
sudo defaults write /Library/Preferences/com.apple.keyboardtype "keyboardtype" -dict-add "3-7582-0" -int 40
fi

# Change screen resolution to the maximum supported for 4Mb video memory
if [[ -d "/Library/Application Support/VMware Tools" ]]; then
sudo "/Library/Application Support/VMware Tools/vmware-resolutionSet" 1176 885
fi
sudo defaults write /Library/Preferences/com.apple.keyboardtype "keyboardtype" -dict-add "3-7582-0" -int 40

# Update VoiceOver Utility to allow VoiceOver to be controlled with AppleScript
# by creating a special Accessibility DB file (SIP must be disabled) and
Expand All @@ -39,7 +32,6 @@ defaults write com.apple.VoiceOver4/default SCREnableAppleScript -bool YES
# Rotate the certificate before expiration to ensure your apps are installed and signed with an active certificate.
# Confirm that the correct intermediate certificate is installed by verifying the expiration date is set to 2030.
# sudo security delete-certificate -Z FF6797793A3CD798DC5B2ABEF56F73EDC9F83A64 /Library/Keychains/System.keychain
# Big Sur requires user interaction to add a cert https://developer.apple.com/forums/thread/671582, we need to use a workaround with SecItemAdd swift method

swiftc -suppress-warnings "${HOME}/image-generation/add-certificate.swift"

Expand All @@ -58,7 +50,7 @@ done
rm -f ./add-certificate

# enable-automationmode-without-authentication
if ! is_BigSur; then

retry=10
while [[ $retry -gt 0 ]]; do
{
Expand All @@ -84,16 +76,15 @@ EOF
sleep 10
done

echo "Getting terminal windows"
term_service=$(launchctl list | grep -i terminal | cut -f3)
echo "Close terminal windows: gui/501/${term_service}"
launchctl bootout gui/501/${term_service} && sleep 5
echo "Getting terminal windows"
term_service=$(launchctl list | grep -i terminal | cut -f3)
echo "Close terminal windows: gui/501/${term_service}"
launchctl bootout gui/501/${term_service} && sleep 5

# test enable-automationmode-without-authentication
if [[ ! "$(automationmodetool)" =~ "DOES NOT REQUIRE" ]]; then
echo "Failed to enable enable-automationmode-without-authentication option"
exit 1
fi
# test enable-automationmode-without-authentication
if [[ ! "$(automationmodetool)" =~ "DOES NOT REQUIRE" ]]; then
echo "Failed to enable enable-automationmode-without-authentication option"
exit 1
fi

# Create symlink for tests running
Expand Down
10 changes: 2 additions & 8 deletions images/macos/scripts/build/configure-preimagedata.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,9 @@ if [[ $arch == "arm64" ]]; then
else
image_label="macos-${label_version}"
fi
release_label="macOS-${label_version}"

if is_Ventura || is_Sonoma || is_Monterey; then
software_url="https://github.com/actions/runner-images/blob/${image_label}/${image_version}/images/macos/${image_label}-Readme.md"
releaseUrl="https://github.com/actions/runner-images/releases/tag/${image_label}%2F${image_version}"
else
software_url="https://github.com/actions/runner-images/blob/${release_label}/${image_version}/images/macos/${image_label}-Readme.md"
releaseUrl="https://github.com/actions/runner-images/releases/tag/${release_label}%2F${image_version}"
fi
software_url="https://github.com/actions/runner-images/blob/${image_label}/${image_version}/images/macos/${image_label}-Readme.md"
releaseUrl="https://github.com/actions/runner-images/releases/tag/${image_label}%2F${image_version}"

cat <<EOF > $imagedata_file
[
Expand Down
8 changes: 3 additions & 5 deletions images/macos/scripts/build/install-aws-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ echo "Installing aws..."
awscliv2_pkg_path=$(download_with_retry "https://awscli.amazonaws.com/AWSCLIV2.pkg")
sudo installer -pkg "$awscliv2_pkg_path" -target /

if ! is_BigSur; then
echo "Installing aws sam cli..."
brew tap aws/tap
brew_smart_install aws-sam-cli
fi
echo "Installing aws sam cli..."
brew tap aws/tap
brew_smart_install aws-sam-cli

echo "Install aws cli session manager"
brew install --cask session-manager-plugin
Expand Down
45 changes: 16 additions & 29 deletions images/macos/scripts/build/install-common-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@

source ~/utils/utils.sh

# Download and install YQ in cases when it is not available in the formulae as for macOS 11: https://formulae.brew.sh/formula/yq
if is_BigSur; then
binary_path=$(download_with_retry "https://github.com/mikefarah/yq/releases/latest/download/yq_darwin_amd64")
sudo install "$binary_path" /usr/local/bin/yq
fi

# Monterey needs future review:
# aliyun-cli, gnupg, helm have issues with building from the source code.
# Added gmp for now, because toolcache ruby needs its libs. Remove it when php starts to build from source code.
Expand Down Expand Up @@ -48,27 +42,22 @@ fi
# Execute AppleScript to change security preferences
# System Preferences -> Security & Privacy -> General -> Unlock -> Allow -> Not now
if is_Monterey; then
if is_Veertu; then
for retry in {4..0}; do
echo "Executing AppleScript to change security preferences. Retries left: $retry"
{
set -e
osascript -e 'tell application "System Events" to get application processes where visible is true'
osascript $HOME/utils/confirm-identified-developers.scpt $USER_PASSWORD
} && break
for retry in {4..0}; do
echo "Executing AppleScript to change security preferences. Retries left: $retry"
{
set -e
osascript -e 'tell application "System Events" to get application processes where visible is true'
osascript $HOME/utils/confirm-identified-developers.scpt $USER_PASSWORD
} && break

if [[ $retry -eq 0 ]]; then
echo "Executing AppleScript failed. No retries left"
exit 1
fi
if [[ $retry -eq 0 ]]; then
echo "Executing AppleScript failed. No retries left"
exit 1
fi

echo "Executing AppleScript failed. Sleeping for 10 seconds and retrying"
sleep 10
done
else
echo "Executing AppleScript to change security preferences"
osascript $HOME/utils/confirm-identified-developers.scpt $USER_PASSWORD
fi
echo "Executing AppleScript failed. Sleeping for 10 seconds and retrying"
sleep 10
done
fi

# Validate "Parallels International GmbH" kext
Expand All @@ -95,10 +84,8 @@ if is_Monterey; then
echo "export PARALLELS_DMG_URL=$url" >> ${HOME}/.bashrc
fi

if ! is_BigSur; then
# Install Azure DevOps extension for Azure Command Line Interface
az extension add -n azure-devops
fi
# Install Azure DevOps extension for Azure Command Line Interface
az extension add -n azure-devops

# Invoke tests for all basic tools
invoke_tests "BasicTools"
15 changes: 6 additions & 9 deletions images/macos/scripts/build/install-git.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,13 @@ brew_smart_install "git"

git config --global --add safe.directory "*"

echo "Installing Git LFS"
brew_smart_install "git-lfs"

if ! is_BigSur; then
echo "Installing Git LFS"
brew_smart_install "git-lfs"

# Update global git config
git lfs install
# Update system git config
sudo git lfs install --system
fi
# Update global git config
git lfs install
# Update system git config
sudo git lfs install --system

echo "Disable all the Git help messages..."
git config --global advice.pushUpdateRejected false
Expand Down
2 changes: 1 addition & 1 deletion images/macos/scripts/build/install-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ echo Installing yarn...
yarn_installer_path=$(download_with_retry "https://yarnpkg.com/install.sh")
bash $yarn_installer_path

if is_BigSur || is_Monterey; then
if is_Monterey; then
npm_global_packages=$(get_toolset_value '.npm.global_packages[].name')
for module in ${npm_global_packages[@]}; do
echo "Install $module"
Expand Down
6 changes: 2 additions & 4 deletions images/macos/scripts/build/install-python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ source ~/utils/utils.sh

echo "Installing Python Tooling"

if is_Monterey || is_BigSur; then
if is_Monterey; then
echo "Install latest Python 2"
python2_pkg=$(download_with_retry "https://www.python.org/ftp/python/2.7.18/python-2.7.18-macosx10.9.pkg")
python2_pkg_sha256="c570f38b05dd8b112ad21b418cdf51a9816d62f9f44746452739d421be24d50c"
Expand All @@ -33,9 +33,7 @@ EOF
fi

# Close Finder window
if is_Veertu; then
close_finder_window
fi
close_finder_window

echo "Brew Installing Python 3"
brew_smart_install "[email protected]"
Expand Down
2 changes: 1 addition & 1 deletion images/macos/scripts/build/install-rust.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ CARGO_HOME=$HOME/.cargo
echo "Install common tools..."
rustup component add rustfmt clippy

if is_BigSur || is_Monterey; then
if is_Monterey; then
cargo install bindgen-cli cbindgen cargo-audit cargo-outdated
fi

Expand Down
9 changes: 1 addition & 8 deletions images/macos/scripts/build/install-swiftlint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,7 @@
source ~/utils/utils.sh

echo "Installing Swiftlint..."
if is_BigSur; then
# SwiftLint now requires Swift 5.6 or higher to build, and macOS 12 or higher to run https://github.com/realm/SwiftLint/releases/tag/0.49.0
COMMIT=d1d5743344227fe6e3c37cfba19f0cfe15a9448a
FORMULA_URL="https://raw.githubusercontent.com/Homebrew/homebrew-core/$COMMIT/Formula/swiftlint.rb"

curl -fsSL $FORMULA_URL > $(find $(brew --repository) -name swiftlint.rb)
HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_FROM_API=1 brew install swiftlint
elif is_Monterey; then
if is_Monterey; then
# SwiftLint now requires Xcode 15.3 or higher to build https://github.com/realm/SwiftLint/releases/tag/0.55.1
COMMIT=d91dabd087cb0b906c92a825df9e5e5e1a4f59f8
FORMULA_URL="https://raw.githubusercontent.com/Homebrew/homebrew-core/$COMMIT/Formula/s/swiftlint.rb"
Expand Down
43 changes: 11 additions & 32 deletions images/macos/scripts/docs-gen/Generate-SoftwareReport.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) {
$languageAndRuntime.AddToolVersionsListInline("NVM - Cached node versions", $(Get-NVMNodeVersionList), '^\d+')
}
$languageAndRuntime.AddToolVersion("Perl", $(Get-PerlVersion))
if ((-not $os.IsBigSur) -and (-not $os.IsVenturaArm64) -and (-not $os.IsSonomaArm64)) {
if ((-not $os.IsVenturaArm64) -and (-not $os.IsSonomaArm64)) {
$languageAndRuntime.AddToolVersion("PHP", $(Get-PHPVersion))
}

Expand All @@ -63,7 +63,7 @@ if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) {

$languageAndRuntime.AddToolVersion("Python3", $(Get-Python3Version))

if ((-not $os.IsVentura) -and (-not $os.IsSonoma) -and (-not $os.IsBigSur)) {
if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) {
$languageAndRuntime.AddToolVersion("R", $(Get-RVersion))
}

Expand All @@ -74,7 +74,7 @@ $packageManagement = $installedSoftware.AddHeader("Package Management")
$packageManagement.AddToolVersion("Bundler", $(Get-BundlerVersion))
$packageManagement.AddToolVersion("Carthage", $(Get-CarthageVersion))
$packageManagement.AddToolVersion("CocoaPods", $(Get-CocoaPodsVersion))
if ((-not $os.IsBigSur) -and (-not $os.IsVenturaArm64) -and (-not $os.IsSonomaArm64)) {
if ((-not $os.IsVenturaArm64) -and (-not $os.IsSonomaArm64)) {
$packageManagement.AddToolVersion("Composer", $(Get-ComposerVersion))
}
$packageManagement.AddToolVersion("Homebrew", $(Get-HomebrewVersion))
Expand Down Expand Up @@ -118,27 +118,19 @@ $utilities.AddToolVersion("bazelisk", $(Get-BazeliskVersion))
$utilities.AddToolVersion("bsdtar", $(Get-BsdtarVersion))
$utilities.AddToolVersion("Curl", $(Get-CurlVersion))
$utilities.AddToolVersion("Git", $(Get-GitVersion))
if (-not $os.IsBigSur) {
$utilities.AddToolVersion("Git LFS", $(Get-GitLFSVersion))
}
$utilities.AddToolVersion("Git LFS", $(Get-GitLFSVersion))
$utilities.AddToolVersion("GitHub CLI", $(Get-GitHubCLIVersion))
$utilities.AddToolVersion("GNU Tar", $(Get-GnuTarVersion))
$utilities.AddToolVersion("GNU Wget", $(Get-WgetVersion))
$utilities.AddToolVersion("gpg (GnuPG)", $(Get-GPGVersion))
if ($os.IsBigSur) {
$utilities.AddToolVersion("helm", $(Get-HelmVersion))
}
if ((-not $os.IsBigSur) -and (-not $os.IsVentura) -and (-not $os.IsSonoma)) {
if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) {
$utilities.AddToolVersion("ImageMagick", $(Get-ImageMagickVersion))
}
$utilities.AddToolVersion("jq", $(Get-JqVersion))
if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) {
$utilities.AddToolVersion("mongo", $(Get-MongoVersion))
$utilities.AddToolVersion("mongod", $(Get-MongodVersion))
}
if ($os.IsBigSur) {
$utilities.AddToolVersion("Newman", $(Get-NewmanVersion))
}
$utilities.AddToolVersion("OpenSSL", $(Get-OpenSSLVersion))
$utilities.AddToolVersion("Packer", $(Get-PackerVersion))
$utilities.AddToolVersion("pkg-config", $(Get-PKGConfigVersion))
Expand All @@ -158,21 +150,14 @@ $utilities.AddToolVersion("zstd", $(Get-ZstdVersion))

# Tools
$tools = $installedSoftware.AddHeader("Tools")
if ($os.IsBigSur) {
$tools.AddToolVersion("Aliyun CLI", $(Get-AliyunCLIVersion))
}
if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) {
$tools.AddToolVersion("App Center CLI", $(Get-AppCenterCLIVersion))
}
$tools.AddToolVersion("AWS CLI", $(Get-AWSCLIVersion))
if (-not $os.IsBigSur) {
$tools.AddToolVersion("AWS SAM CLI", $(Get-AWSSAMCLIVersion))
}
$tools.AddToolVersion("AWS SAM CLI", $(Get-AWSSAMCLIVersion))
$tools.AddToolVersion("AWS Session Manager CLI", $(Get-AWSSessionManagerCLIVersion))
if (-not $os.IsBigSur) {
$tools.AddToolVersion("Azure CLI", $(Get-AzureCLIVersion))
$tools.AddToolVersion("Azure CLI (azure-devops)", $(Get-AzureDevopsVersion))
}
$tools.AddToolVersion("Azure CLI", $(Get-AzureCLIVersion))
$tools.AddToolVersion("Azure CLI (azure-devops)", $(Get-AzureDevopsVersion))
$tools.AddToolVersion("Bicep CLI", $(Get-BicepVersion))
if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) {
$tools.AddToolVersion("Cabal", $(Get-CabalVersion))
Expand All @@ -193,13 +178,9 @@ $tools.AddToolVersion("SwiftFormat", $(Get-SwiftFormatVersion))
if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) {
$tools.AddToolVersion("Swig", $(Get-SwigVersion))
}
if (-not $os.IsBigSur) {
$tools.AddToolVersion("Xcbeautify", $(Get-XcbeautifyVersion))
}
$tools.AddToolVersion("Xcbeautify", $(Get-XcbeautifyVersion))
$tools.AddToolVersion("Xcode Command Line Tools", $(Get-XcodeCommandLineToolsVersion))
if (-not $os.IsBigSur) {
$tools.AddToolVersion("Xcodes", $(Get-XcodesVersion))
}
$tools.AddToolVersion("Xcodes", $(Get-XcodesVersion))

# Linters
$linters = $installedSoftware.AddHeader("Linters")
Expand All @@ -225,7 +206,6 @@ $toolcache = $installedSoftware.AddHeader("Cached Tools")
$toolcache.AddNodes($(Build-ToolcacheSection))

# Rust
if (-not $os.IsBigSur) {
$rust = $installedSoftware.AddHeader("Rust Tools")
$rust.AddToolVersion("Cargo", $(Get-RustCargoVersion))
$rust.AddToolVersion("Rust", $(Get-RustVersion))
Expand All @@ -241,7 +221,6 @@ if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) {
}
$rustPackages.AddToolVersion("Clippy", $(Get-RustClippyVersion))
$rustPackages.AddToolVersion("Rustfmt", $(Get-RustfmtVersion))
}

# PowerShell
$powerShell = $installedSoftware.AddHeader("PowerShell Tools")
Expand Down Expand Up @@ -303,7 +282,7 @@ $android.AddTable($androidTable)
$androidEnv = $android.AddHeader("Environment variables")
$androidEnv.AddTable($(Build-AndroidEnvironmentTable))

if ($os.IsBigSur -or $os.IsMonterey) {
if ($os.IsMonterey) {
$miscellaneous = $installedSoftware.AddHeader("Miscellaneous")
$miscellaneous.AddToolVersion("libXext", $(Get-LibXextVersion))
$miscellaneous.AddToolVersion("libXft", $(Get-LibXftVersion))
Expand Down
Loading

0 comments on commit 22143c7

Please sign in to comment.