diff --git a/images/macos/helpers/Common.Helpers.psm1 b/images/macos/helpers/Common.Helpers.psm1 index d877e5ac..86bc3247 100644 --- a/images/macos/helpers/Common.Helpers.psm1 +++ b/images/macos/helpers/Common.Helpers.psm1 @@ -28,12 +28,14 @@ function Get-EnvironmentVariable($variable) { function Get-OSVersion { $osVersion = [Environment]::OSVersion $osVersionMajorMinor = $osVersion.Version.ToString(2) + $processorArchitecture = arch return [PSCustomObject]@{ Version = $osVersion.Version Platform = $osVersion.Platform IsBigSur = $osVersion.Version.Major -eq "11" IsMonterey = $osVersion.Version.Major -eq "12" - IsVentura = $osVersion.Version.Major -eq "13" + IsVentura = $($osVersion.Version.Major -eq "13" -and $processorArchitecture -ne "arm64") + IsVenturaArm64 = $($osVersion.Version.Major -eq "13" -and $processorArchitecture -eq "arm64") } } @@ -150,3 +152,7 @@ function Add-EnvironmentVariable { $envVar = "export {0}={1}" -f $Name, $Value Add-Content -Path $FilePath -Value $envVar } + +function isVeertu { + return (Test-Path -Path "/Library/Application Support/Veertu") +} diff --git a/images/macos/provision/configuration/shell-change.sh b/images/macos/provision/configuration/shell-change.sh index 5fb12a03..8632a68e 100644 --- a/images/macos/provision/configuration/shell-change.sh +++ b/images/macos/provision/configuration/shell-change.sh @@ -1,5 +1,14 @@ #!/bin/bash -e -o pipefail +source ~/utils/utils.sh +arch=$(get_arch) + echo "Changing shell to bash" sudo chsh -s /bin/bash $USERNAME -sudo chsh -s /bin/bash root \ No newline at end of file +sudo chsh -s /bin/bash root + +# Check MacOS architecture and add HOMEBREW PATH to bashrc +if [[ $arch == "arm64" ]]; then + echo "Adding Homebrew environment to bash" + /opt/homebrew/bin/brew shellenv >> ~/.bashrc +fi \ No newline at end of file diff --git a/images/macos/provision/core/azcopy.sh b/images/macos/provision/core/azcopy.sh index 81f20161..cc188c73 100755 --- a/images/macos/provision/core/azcopy.sh +++ b/images/macos/provision/core/azcopy.sh @@ -1,15 +1,21 @@ #!/bin/bash -e -o pipefail source ~/utils/utils.sh +arch=$(get_arch) -AZCOPY_DOWNLOAD_URL="https://aka.ms/downloadazcopy-v10-mac" +# Check MacOS architecture and if ARM install using brew +if [ $arch == "arm64" ]; then + brew install azcopy +else + AZCOPY_DOWNLOAD_URL="https://aka.ms/downloadazcopy-v10-mac" -download_with_retries $AZCOPY_DOWNLOAD_URL "/tmp" "azcopy.zip" -unzip /tmp/azcopy.zip -d azcopy -AZCOPY_EXTRACTED=$(echo azcopy/azcopy*) -cp "$AZCOPY_EXTRACTED/azcopy" "/usr/local/bin/azcopy" -chmod +x "/usr/local/bin/azcopy" + download_with_retries $AZCOPY_DOWNLOAD_URL "/tmp" "azcopy.zip" + unzip /tmp/azcopy.zip -d azcopy + AZCOPY_EXTRACTED=$(echo azcopy/azcopy*) + cp "$AZCOPY_EXTRACTED/azcopy" "/usr/local/bin/azcopy" + chmod +x "/usr/local/bin/azcopy" -echo "Done, cleaning up" -rm -rf azcopy* + echo "Done, cleaning up" + rm -rf azcopy* +fi invoke_tests "Common" "AzCopy" diff --git a/images/macos/provision/core/dotnet.sh b/images/macos/provision/core/dotnet.sh index 1bd612e9..a7f8a44e 100755 --- a/images/macos/provision/core/dotnet.sh +++ b/images/macos/provision/core/dotnet.sh @@ -10,6 +10,8 @@ source ~/utils/utils.sh export DOTNET_CLI_TELEMETRY_OPTOUT=1 +arch=$(get_arch) + # Download installer from dot.net and keep it locally DOTNET_INSTALL_SCRIPT="https://dot.net/v1/dotnet-install.sh" curl -L -o "dotnet-install.sh" "$DOTNET_INSTALL_SCRIPT" @@ -18,7 +20,7 @@ chmod +x ./dotnet-install.sh ARGS_LIST=() echo "Parsing dotnet SDK (except rc and preview versions) from .json..." -DOTNET_VERSIONS=($(get_toolset_value '.dotnet.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/master/release-notes/${DOTNET_VERSION}/releases.json" @@ -37,7 +39,7 @@ for DOTNET_VERSION in "${DOTNET_VERSIONS[@]}"; do done for ARGS in "${ARGS_LIST[@]}"; do - ./dotnet-install.sh --version $ARGS -NoPath + ./dotnet-install.sh --version $ARGS -NoPath --arch $arch done rm ./dotnet-install.sh diff --git a/images/macos/provision/core/homebrew.sh b/images/macos/provision/core/homebrew.sh index c5380226..9dd91d00 100755 --- a/images/macos/provision/core/homebrew.sh +++ b/images/macos/provision/core/homebrew.sh @@ -2,10 +2,20 @@ source ~/utils/utils.sh +arch=$(get_arch) + echo "Installing Homebrew..." HOMEBREW_INSTALL_URL="https://raw.githubusercontent.com/Homebrew/install/master/install.sh" /bin/bash -c "$(curl -fsSL ${HOMEBREW_INSTALL_URL})" +if [[ $arch == "arm64" ]]; then + /opt/homebrew/bin/brew update + /opt/homebrew/bin/brew upgrade + /opt/homebrew/bin/brew upgrade --cask + /opt/homebrew/bin/brew cleanup + eval "$(/opt/homebrew/bin/brew shellenv)" +fi + echo "Disabling Homebrew analytics..." brew analytics off diff --git a/images/macos/provision/core/powershell.sh b/images/macos/provision/core/powershell.sh index 85c836cd..6d3ce1b6 100644 --- a/images/macos/provision/core/powershell.sh +++ b/images/macos/provision/core/powershell.sh @@ -2,9 +2,11 @@ source ~/utils/utils.sh echo Installing PowerShell... +arch=$(get_arch) + psmetadata=$(curl "https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/metadata.json" -s) psver=$(echo $psmetadata | jq -r '.LTSReleaseTag[0]') -psDownloadUrl=$(get_github_package_download_url "PowerShell/PowerShell" "contains(\"osx-x64.pkg\")" "$psver" "$API_PAT") +psDownloadUrl=$(get_github_package_download_url "PowerShell/PowerShell" "contains(\"osx-$arch.pkg\")" "$psver" "$API_PAT") download_with_retries $psDownloadUrl "/tmp" "powershell.pkg" # 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 @@ -19,15 +21,30 @@ for module in ${psModules[@]}; do echo "Installing $module module" moduleVersions="$(get_toolset_value ".powershellModules[] | select(.name==\"$module\") | .versions[]?")" if [[ -z "$moduleVersions" ]];then - pwsh -command "& {Install-Module $module -Force -Scope AllUsers}" + # Check MacOS architecture and sudo on Arm64 + if [[ $arch == "arm64" ]]; then + sudo pwsh -command "& {Install-Module $module -Force -Scope AllUsers}" + else + pwsh -command "& {Install-Module $module -Force -Scope AllUsers}" + fi else for version in ${moduleVersions[@]}; do - echo " - $version" - pwsh -command "& {Install-Module $module -RequiredVersion $version -Force -Scope AllUsers}" + # Check MacOS architecture and sudo on Arm64 + if [[ $arch == "arm64" ]]; then + echo " - $version" + sudo pwsh -command "& {Install-Module $module -RequiredVersion $version -Force -Scope AllUsers}" + else + echo " - $version" + pwsh -command "& {Install-Module $module -RequiredVersion $version -Force -Scope AllUsers}" + fi done fi done +if [[ $arch == "arm64" ]]; then + sudo chown -R $USER ~/.local +fi + # A dummy call to initialize .IdentityService directory pwsh -command "& {Import-Module Az}" diff --git a/images/macos/provision/core/rosetta.sh b/images/macos/provision/core/rosetta.sh new file mode 100644 index 00000000..ee0617fd --- /dev/null +++ b/images/macos/provision/core/rosetta.sh @@ -0,0 +1,4 @@ +#!/bin/bash -e -o pipefail + +echo 'Installing Rosetta' +/usr/sbin/softwareupdate --install-rosetta --agree-to-license diff --git a/images/macos/provision/core/ruby.sh b/images/macos/provision/core/ruby.sh index 0b60142f..62fb937d 100755 --- a/images/macos/provision/core/ruby.sh +++ b/images/macos/provision/core/ruby.sh @@ -1,45 +1,55 @@ #!/bin/bash -e -o pipefail source ~/utils/utils.sh +arch=$(get_arch) DEFAULT_RUBY_VERSION=$(get_toolset_value '.ruby.default') echo Installing Ruby... brew_smart_install "ruby@${DEFAULT_RUBY_VERSION}" -export PATH=/usr/local/opt/ruby@${DEFAULT_RUBY_VERSION}/bin:$PATH -GEM_PATH=`gem env|awk '/EXECUTABLE DIRECTORY/ {print $4}'` -echo "GEM_PATH=$GEM_PATH" >> "$HOME/.bashrc" -echo 'export PATH="$GEM_PATH:/usr/local/opt/ruby@'${DEFAULT_RUBY_VERSION}'/bin:$PATH"' >> "$HOME/.bashrc" - -echo "Install Ruby from toolset..." -[ -n "$API_PAT" ] && authString=(-H "Authorization: token ${API_PAT}") -PACKAGE_TAR_NAMES=$(curl "${authString[@]}" -s "https://api.github.com/repos/ruby/ruby-builder/releases/latest" | jq -r '.assets[].name') -TOOLSET_VERSIONS=$(get_toolset_value '.toolcache[] | select(.name | contains("Ruby")) | .versions[]') -RUBY_PATH="$AGENT_TOOLSDIRECTORY/Ruby" - -echo "Check if Ruby hostedtoolcache folder exists..." -if [ ! -d $RUBY_PATH ]; then - mkdir -p $RUBY_PATH +if [[ $arch == "arm64" ]]; then + export PATH=/opt/homebrew/opt/ruby@${DEFAULT_RUBY_VERSION}/bin:$PATH +else + export PATH=/usr/local/opt/ruby@${DEFAULT_RUBY_VERSION}/bin:$PATH fi -for TOOLSET_VERSION in ${TOOLSET_VERSIONS[@]}; do - PACKAGE_TAR_NAME=$(echo "$PACKAGE_TAR_NAMES" | grep "^ruby-${TOOLSET_VERSION}-macos-latest.tar.gz$" | egrep -v "rc|preview" | sort -V | tail -1) - RUBY_VERSION=$(echo "$PACKAGE_TAR_NAME" | cut -d'-' -f 2) - RUBY_VERSION_PATH="$RUBY_PATH/$RUBY_VERSION" +GEM_PATH=`gem env|awk '/EXECUTABLE DIRECTORY/ {print $4}'` +echo "GEM_PATH=$GEM_PATH" >> "$HOME/.bashrc" +if [[ $arch == "arm64" ]]; then + echo 'export PATH="$GEM_PATH:/opt/homebrew/opt/ruby@'${DEFAULT_RUBY_VERSION}'/bin:$PATH"' >> "$HOME/.bashrc" +else + echo 'export PATH="$GEM_PATH:/usr/local/opt/ruby@'${DEFAULT_RUBY_VERSION}'/bin:$PATH"' >> "$HOME/.bashrc" +fi - echo "Create Ruby $RUBY_VERSION directory..." - mkdir -p $RUBY_VERSION_PATH +if ! is_VenturaArm64; then + echo "Install Ruby from toolset..." + [ -n "$API_PAT" ] && authString=(-H "Authorization: token ${API_PAT}") + PACKAGE_TAR_NAMES=$(curl "${authString[@]}" -s "https://api.github.com/repos/ruby/ruby-builder/releases/latest" | jq -r '.assets[].name') + TOOLSET_VERSIONS=$(get_toolset_value '.toolcache[] | select(.name | contains("Ruby")) | .versions[]') + RUBY_PATH="$AGENT_TOOLSDIRECTORY/Ruby" - echo "Downloading tar archive $PACKAGE_TAR_NAME" - DOWNLOAD_URL="https://github.com/ruby/ruby-builder/releases/download/toolcache/${PACKAGE_TAR_NAME}" - download_with_retries $DOWNLOAD_URL "/tmp" $PACKAGE_TAR_NAME - - echo "Expand '$PACKAGE_TAR_NAME' to the '$RUBY_VERSION_PATH' folder" - tar xf "/tmp/$PACKAGE_TAR_NAME" -C $RUBY_VERSION_PATH - - COMPLETE_FILE_PATH="$RUBY_VERSION_PATH/x64.complete" - if [ ! -f $COMPLETE_FILE_PATH ]; then - echo "Create complete file" - touch $COMPLETE_FILE_PATH + echo "Check if Ruby hostedtoolcache folder exists..." + if [ ! -d $RUBY_PATH ]; then + mkdir -p $RUBY_PATH fi -done -invoke_tests "Ruby" + for TOOLSET_VERSION in ${TOOLSET_VERSIONS[@]}; do + PACKAGE_TAR_NAME=$(echo "$PACKAGE_TAR_NAMES" | grep "^ruby-${TOOLSET_VERSION}-macos-latest.tar.gz$" | egrep -v "rc|preview" | sort -V | tail -1) + RUBY_VERSION=$(echo "$PACKAGE_TAR_NAME" | cut -d'-' -f 2) + RUBY_VERSION_PATH="$RUBY_PATH/$RUBY_VERSION" + + echo "Create Ruby $RUBY_VERSION directory..." + mkdir -p $RUBY_VERSION_PATH + + echo "Downloading tar archive $PACKAGE_TAR_NAME" + DOWNLOAD_URL="https://github.com/ruby/ruby-builder/releases/download/toolcache/${PACKAGE_TAR_NAME}" + download_with_retries $DOWNLOAD_URL "/tmp" $PACKAGE_TAR_NAME + + echo "Expand '$PACKAGE_TAR_NAME' to the '$RUBY_VERSION_PATH' folder" + tar xf "/tmp/$PACKAGE_TAR_NAME" -C $RUBY_VERSION_PATH + COMPLETE_FILE_PATH="$RUBY_VERSION_PATH/x64.complete" + if [ ! -f $COMPLETE_FILE_PATH ]; then + echo "Create complete file" + touch $COMPLETE_FILE_PATH + fi + done +fi +invoke_tests "Ruby.$arch" diff --git a/images/macos/provision/core/xcode.ps1 b/images/macos/provision/core/xcode.ps1 index d3175f38..3c9b1036 100644 --- a/images/macos/provision/core/xcode.ps1 +++ b/images/macos/provision/core/xcode.ps1 @@ -14,8 +14,10 @@ if ([string]::IsNullOrEmpty($env:XCODE_INSTALL_USER) -or [string]::IsNullOrEmpty # https://github.com/fastlane/fastlane/pull/18116 $env:SPACESHIP_SKIP_2FA_UPGRADE = 1 -$os = Get-OSVersion -[Array]$xcodeVersions = Get-ToolsetValue "xcode.versions" +$ARCH = arch +if ($ARCH -ne "arm64") { $ARCH = "x64" } +[Array]$xcodeVersions = Get-ToolsetValue "xcode.$ARCH.versions" +write-host $xcodeVersions $defaultXcode = Get-ToolsetValue "xcode.default" [Array]::Reverse($xcodeVersions) $threadCount = "5" @@ -62,4 +64,3 @@ New-Item -Path "/Applications/Xcode.app" -ItemType SymbolicLink -Value (Get-Xcod Write-Host "Setting environment variables 'XCODE__DEVELOPER_DIR'" Set-XcodeDeveloperDirEnvironmentVariables -XcodeList $xcodeVersions.link - diff --git a/images/macos/provision/utils/utils.sh b/images/macos/provision/utils/utils.sh index 51de7729..778d8737 100755 --- a/images/macos/provision/utils/utils.sh +++ b/images/macos/provision/utils/utils.sh @@ -39,6 +39,15 @@ download_with_retries() { return 1 } +is_VenturaArm64() { + arch=$(get_arch) + if [ "$OSTYPE" = "darwin22" ] && [ $arch = "arm64" ]; then + true + else + false + fi +} + is_Ventura() { if [ "$OSTYPE" = "darwin22" ]; then true @@ -213,3 +222,12 @@ get_github_package_download_url() { close_finder_window() { osascript -e 'tell application "Finder" to close windows' } + +get_arch() { + arch=$(arch) + if [[ $arch == "arm64" ]]; then + echo "arm64" + else + echo "x64" + fi +} diff --git a/images/macos/software-report/SoftwareReport.Generator.ps1 b/images/macos/software-report/SoftwareReport.Generator.ps1 index 2e05d3d8..80172b34 100644 --- a/images/macos/software-report/SoftwareReport.Generator.ps1 +++ b/images/macos/software-report/SoftwareReport.Generator.ps1 @@ -40,7 +40,7 @@ $languageAndRuntime.AddNodes($(Get-GccVersions)) $languageAndRuntime.AddNodes($(Get-FortranVersions)) $languageAndRuntime.AddToolVersion("Julia", $(Get-JuliaVersion)) $languageAndRuntime.AddToolVersion("Kotlin", $(Get-KotlinVersion)) -if (-not $os.IsVentura) { +if ((-not $os.IsVentura) -and (-not $os.IsVenturaArm64)) { $languageAndRuntime.AddToolVersion("Go", $(Get-GoVersion)) $languageAndRuntime.AddToolVersion("Mono", $(Get-MonoVersion)) $languageAndRuntime.AddToolVersion("MSBuild", $(Get-MSBuildVersion)) @@ -49,8 +49,10 @@ if (-not $os.IsVentura) { $languageAndRuntime.AddToolVersionsListInline("NVM - Cached node versions", $(Get-NVMNodeVersionList), '^\d+') } $languageAndRuntime.AddToolVersion("Perl", $(Get-PerlVersion)) -$languageAndRuntime.AddToolVersion("PHP", $(Get-PHPVersion)) -if (-not $os.IsVentura) { +if (-not $os.IsVenturaArm64) { + $languageAndRuntime.AddToolVersion("PHP", $(Get-PHPVersion)) +} +if ((-not $os.IsVentura) -and (-not $os.IsVenturaArm64)) { $languageAndRuntime.AddToolVersion("Python", $(Get-PythonVersion)) $languageAndRuntime.AddToolVersion("Python3", $(Get-Python3Version)) } @@ -64,27 +66,29 @@ $packageManagement.AddToolVersion("Carthage", $(Get-CarthageVersion)) $packageManagement.AddToolVersion("CocoaPods", $(Get-CocoaPodsVersion)) $packageManagement.AddToolVersion("Composer", $(Get-ComposerVersion)) $packageManagement.AddToolVersion("Homebrew", $(Get-HomebrewVersion)) -if (-not $os.IsVentura) { +if ((-not $os.IsVentura) -and (-not $os.IsVenturaArm64)) { $packageManagement.AddToolVersion("Miniconda", $(Get-CondaVersion)) } $packageManagement.AddToolVersion("NPM", $(Get-NPMVersion)) -if (-not $os.IsVentura) { +if ((-not $os.IsVentura) -and (-not $os.IsVenturaArm64)) { $packageManagement.AddToolVersion("NuGet", $(Get-NuGetVersion)) $packageManagement.AddToolVersion("Pip", $(Get-PipVersion -Version 2)) $packageManagement.AddToolVersion("Pip3", $(Get-PipVersion -Version 3)) $packageManagement.AddToolVersion("Pipx", $(Get-PipxVersion)) } $packageManagement.AddToolVersion("RubyGems", $(Get-RubyGemsVersion)) -$packageManagement.AddToolVersion("Vcpkg", $(Get-VcpkgVersion)) +if (-not $os.IsVenturaArm64) { + $packageManagement.AddToolVersion("Vcpkg", $(Get-VcpkgVersion)) +} $packageManagement.AddToolVersion("Yarn", $(Get-YarnVersion)) -if (-not $os.IsVentura) { +if ((-not $os.IsVentura) -and (-not $os.IsVenturaArm64)) { $packageManagement.AddNode($(Build-PackageManagementEnvironmentTable)) } # Project Management $projectManagement = $installedSoftware.AddHeader("Project Management") $projectManagement.AddToolVersion("Apache Ant", $(Get-ApacheAntVersion)) -if (-not $os.IsVentura) { +if ((-not $os.IsVentura) -and (-not $os.IsVenturaArm64)) { $projectManagement.AddToolVersion("Apache Maven", $(Get-MavenVersion)) $projectManagement.AddToolVersion("Gradle", $(Get-GradleVersion)) $projectManagement.AddToolVersion("Sbt", $(Get-SbtVersion)) @@ -108,12 +112,12 @@ $utilities.AddToolVersion("gpg (GnuPG)", $(Get-GPGVersion)) if ($os.IsBigSur) { $utilities.AddToolVersion("helm", $(Get-HelmVersion)) } -if (-not $os.IsVentura) { +if ((-not $os.IsVentura) -and (-not $os.IsVenturaArm64)) { $utilities.AddToolVersion("Hub CLI", $(Get-HubVersion)) $utilities.AddToolVersion("ImageMagick", $(Get-ImageMagickVersion)) } $utilities.AddToolVersion("jq", $(Get-JqVersion)) -if (-not $os.IsVentura) { +if ((-not $os.IsVentura) -and (-not $os.IsVenturaArm64)) { $utilities.AddToolVersion("mongo", $(Get-MongoVersion)) $utilities.AddToolVersion("mongod", $(Get-MongodVersion)) } @@ -122,7 +126,7 @@ if ($os.IsBigSur) { } $utilities.AddToolVersion("OpenSSL", $(Get-OpenSSLVersion)) $utilities.AddToolVersion("Packer", $(Get-PackerVersion)) -if (-not $os.IsVentura) { +if ((-not $os.IsVentura) -and (-not $os.IsVenturaArm64)) { $utilities.AddToolVersion("PostgreSQL", $(Get-PostgresServerVersion)) $utilities.AddToolVersion("psql (PostgreSQL)", $(Get-PostgresClientVersion)) $utilities.AddToolVersion("Sox", $(Get-SoxVersion)) @@ -131,7 +135,7 @@ if (-not $os.IsVentura) { } if (-not $os.IsBigSur) { $utilities.AddToolVersion("Vagrant", $(Get-VagrantVersion)) - if (-not $os.IsVentura) { + if ((-not $os.IsVentura) -and (-not $os.IsVenturaArm64)) { $utilities.AddToolVersion("VirtualBox", $(Get-VirtualBoxVersion)) } } @@ -143,53 +147,66 @@ $tools = $installedSoftware.AddHeader("Tools") if ($os.IsBigSur) { $tools.AddToolVersion("Aliyun CLI", $(Get-AliyunCLIVersion)) } -if (-not $os.IsVentura) { +if ((-not $os.IsVentura) -and (-not $os.IsVenturaArm64)) { $tools.AddToolVersion("App Center CLI", $(Get-AppCenterCLIVersion)) } -$tools.AddToolVersion("AWS CLI", $(Get-AWSCLIVersion)) -$tools.AddToolVersion("AWS SAM CLI", $(Get-AWSSAMCLIVersion)) -$tools.AddToolVersion("AWS Session Manager CLI", $(Get-AWSSessionManagerCLIVersion)) +if (-not $os.IsVenturaArm64) { + $tools.AddToolVersion("AWS CLI", $(Get-AWSCLIVersion)) + $tools.AddToolVersion("AWS SAM CLI", $(Get-AWSSAMCLIVersion)) + $tools.AddToolVersion("AWS Session Manager CLI", $(Get-AWSSessionManagerCLIVersion)) +} $tools.AddToolVersion("Azure CLI", $(Get-AzureCLIVersion)) $tools.AddToolVersion("Azure CLI (azure-devops)", $(Get-AzureDevopsVersion)) $tools.AddToolVersion("Bicep CLI", $(Get-BicepVersion)) -$tools.AddToolVersion("Cabal", $(Get-CabalVersion)) +if (-not $os.IsVenturaArm64) { + $tools.AddToolVersion("Cabal", $(Get-CabalVersion)) +} $tools.AddToolVersion("Cmake", $(Get-CmakeVersion)) $tools.AddToolVersion("CodeQL Action Bundles", $(Get-CodeQLBundleVersions)) if ($os.IsMonterey) { $tools.AddToolVersion("Colima", $(Get-ColimaVersion)) } $tools.AddToolVersion("Fastlane", $(Get-FastlaneVersion)) -$tools.AddToolVersion("GHC", $(Get-GHCVersion)) -$tools.AddToolVersion("GHCup", $(Get-GHCupVersion)) -if (-not $os.IsVentura) { +if (-not $os.IsVenturaArm64) { + $tools.AddToolVersion("GHC", $(Get-GHCVersion)) + $tools.AddToolVersion("GHCup", $(Get-GHCupVersion)) +} +if ((-not $os.IsVentura) -and (-not $os.IsVenturaArm64)) { $tools.AddToolVersion("Jazzy", $(Get-JazzyVersion)) } -$tools.AddToolVersion("Stack", $(Get-StackVersion)) +if (-not $os.IsVenturaArm64) { + $tools.AddToolVersion("Stack", $(Get-StackVersion)) +} $tools.AddToolVersion("SwiftFormat", $(Get-SwiftFormatVersion)) -if (-not $os.IsVentura) { +if ((-not $os.IsVentura) -and (-not $os.IsVenturaArm64)) { $tools.AddToolVersion("Swig", $(Get-SwigVersion)) } $tools.AddToolVersion("Xcode Command Line Tools", $(Get-XcodeCommandLineToolsVersion)) # Linters $linters = $installedSoftware.AddHeader("Linters") -$linters.AddToolVersion("SwiftLint", $(Get-SwiftLintVersion)) -if (-not $os.IsVentura) { +if (-not $os.IsVenturaArm64) { + $linters.AddToolVersion("SwiftLint", $(Get-SwiftLintVersion)) +} +if ((-not $os.IsVentura) -and (-not $os.IsVenturaArm64)) { $linters.AddToolVersion("Yamllint", $(Get-YamllintVersion)) } -# Browsers -$browsers = $installedSoftware.AddHeader("Browsers") -$browsers.AddNodes($(Build-BrowserSection)) -$browsers.AddNode($(Build-BrowserWebdriversEnvironmentTable)) +if (-not $os.IsVenturaArm64) { + # Browsers + $browsers = $installedSoftware.AddHeader("Browsers") + $browsers.AddNodes($(Build-BrowserSection)) + $browsers.AddNode($(Build-BrowserWebdriversEnvironmentTable)) -# Java -$java = $installedSoftware.AddHeader("Java") -$java.AddTable($(Get-JavaVersions)) - -# Toolcache -$toolcache = $installedSoftware.AddHeader("Cached Tools") -$toolcache.AddNodes($(Build-ToolcacheSection)) + # Java + $java = $installedSoftware.AddHeader("Java") + $java.AddTable($(Get-JavaVersions)) +} +if (-not $os.IsVenturaArm64) { + # Toolcache + $toolcache = $installedSoftware.AddHeader("Cached Tools") + $toolcache.AddNodes($(Build-ToolcacheSection)) +} # Rust $rust = $installedSoftware.AddHeader("Rust Tools") @@ -214,13 +231,13 @@ $powerShellModules = $powerShell.AddHeader("PowerShell Modules") $powerShellModules.AddNodes($(Get-PowerShellModules)) # Web Servers -if (-not $os.IsVentura) { +if ((-not $os.IsVentura) -and (-not $os.IsVenturaArm64)) { $webServers = $installedSoftware.AddHeader("Web Servers") $webServers.AddTable($(Build-WebServersSection)) } # Xamarin section -if (-not $os.IsVentura) { +if ((-not $os.IsVentura) -and (-not $os.IsVenturaArm64)) { $xamarin = $installedSoftware.AddHeader("Xamarin") $vsForMac = $xamarin.AddHeader("Visual Studio for Mac") $vsForMac.AddTable($(Build-VSMacTable)) @@ -256,16 +273,16 @@ $installedSdks.AddTable($(Build-XcodeSDKTable $xcodeInfo)) $installedSimulators = $xcode.AddHeader("Installed Simulators") $installedSimulators.AddTable($(Build-XcodeSimulatorsTable $xcodeInfo)) - +if (-not $os.IsVenturaArm64) { # Android section -$android = $installedSoftware.AddHeader("Android") -$androidTable = Build-AndroidTable -$android.AddTable($androidTable) + $android = $installedSoftware.AddHeader("Android") + $androidTable = Build-AndroidTable + $android.AddTable($androidTable) -$androidEnv = $android.AddHeader("Environment variables") -$androidEnv.AddTable($(Build-AndroidEnvironmentTable)) - -if (-not $os.IsVentura) { + $androidEnv = $android.AddHeader("Environment variables") + $androidEnv.AddTable($(Build-AndroidEnvironmentTable)) +} +if ((-not $os.IsVentura) -and (-not $os.IsVenturaArm64)) { $miscellaneous = $installedSoftware.AddHeader("Miscellaneous") $miscellaneous.AddToolVersion("libXext", $(Get-LibXextVersion)) $miscellaneous.AddToolVersion("libXft", $(Get-LibXftVersion)) @@ -303,4 +320,3 @@ Write-Host $markdownExtended $systemInfo | Out-File -FilePath "${OutputDirectory}/systeminfo.txt" -Encoding UTF8NoBOM $softwareReport.ToJson() | Out-File -FilePath "${OutputDirectory}/systeminfo.json" -Encoding UTF8NoBOM $softwareReport.ToMarkdown() | Out-File -FilePath "${OutputDirectory}/systeminfo.md" -Encoding UTF8NoBOM - diff --git a/images/macos/templates/macOS-13.arm64.anka.pkr.hcl b/images/macos/templates/macOS-13.arm64.anka.pkr.hcl new file mode 100644 index 00000000..489f61ec --- /dev/null +++ b/images/macos/templates/macOS-13.arm64.anka.pkr.hcl @@ -0,0 +1,231 @@ +packer { + required_plugins { + veertu-anka = { + version = "= v3.1.0" + source = "github.com/veertuinc/veertu-anka" + } + } +} + +variable "source_vm_name" { + type = string +} + +variable "source_vm_tag" { + type = string +} + +variable "build_id" { + type = string +} + +variable "vm_username" { + type = string + sensitive = true +} + +variable "vm_password" { + type = string + sensitive = true +} + +variable "github_api_pat" { + type = string + default = "" +} + +variable "xcode_install_user" { + type = string + sensitive = true +} + +variable "xcode_install_password" { + type = string + sensitive = true +} + +variable "vcpu_count" { + type = string + default = "6" +} + +variable "ram_size" { + type = string + default = "8G" +} + +variable "image_os" { + type = string + default = "macos13" +} + +source "veertu-anka-vm-clone" "template" { + vm_name = "${var.build_id}" + source_vm_name = "${var.source_vm_name}" + source_vm_tag = "${var.source_vm_tag}" + vcpu_count = "${var.vcpu_count}" + ram_size = "${var.ram_size}" + stop_vm = "true" + log_level = "debug" +} + +build { + sources = [ + "source.veertu-anka-vm-clone.template" + ] + provisioner "shell" { + inline = [ + "mkdir ~/image-generation" + ] + } + provisioner "file" { + destination = "image-generation/" + sources = [ + "./provision/assets", + "./tests", + "./software-report", + "./helpers" + ] + } + provisioner "file" { + destination = "image-generation/software-report/" + source = "../../helpers/software-report-base" + } + provisioner "file" { + destination = "image-generation/add-certificate.swift" + source = "./provision/configuration/add-certificate.swift" + } + provisioner "file" { + destination = ".bashrc" + source = "./provision/configuration/environment/bashrc" + } + provisioner "file" { + destination = ".bash_profile" + source = "./provision/configuration/environment/bashprofile" + } + provisioner "file" { + destination = "./" + source = "./provision/utils" + } + provisioner "shell" { + inline = [ + "mkdir ~/bootstrap" + ] + } + provisioner "file" { + destination = "bootstrap" + source = "./provision/bootstrap-provisioner/" + } + provisioner "file" { + destination = "image-generation/toolset.json" + source = "./toolsets/toolset-13.json" + } + provisioner "shell" { + scripts = [ + "./provision/core/xcode-clt.sh", + "./provision/core/homebrew.sh", + "./provision/core/rosetta.sh" + ] + execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" + } + provisioner "shell" { + scripts = [ + "./provision/configuration/configure-tccdb-macos.sh", + "./provision/configuration/disable-auto-updates.sh", + "./provision/configuration/ntpconf.sh", + "./provision/configuration/shell-change.sh" + ] + environment_vars = [ + "PASSWORD=${var.vm_password}", + "USERNAME=${var.vm_username}" + ] + execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; sudo {{ .Vars }} {{ .Path }}" + } + provisioner "shell" { + scripts = [ + "./provision/configuration/preimagedata.sh", + "./provision/configuration/configure-ssh.sh", + "./provision/configuration/configure-machine.sh" + ] + environment_vars = [ + "IMAGE_VERSION=${var.build_id}", + "IMAGE_OS=${var.image_os}", + "PASSWORD=${var.vm_password}" + ] + execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" + } + provisioner "shell" { + script = "./provision/core/reboot.sh" + execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; sudo {{ .Vars }} {{ .Path }}" + expect_disconnect = true + } + provisioner "shell" { + pause_before = "30s" + scripts = [ + "./provision/core/powershell.sh", + "./provision/core/dotnet.sh", + "./provision/core/azcopy.sh", + "./provision/core/ruby.sh", + "./provision/core/rubygem.sh", + "./provision/core/git.sh", + "./provision/core/node.sh", + "./provision/core/commonutils.sh" + ] + environment_vars = [ + "API_PAT=${var.github_api_pat}", + "USER_PASSWORD=${var.vm_password}" + ] + execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" + } + provisioner "shell" { + script = "./provision/core/xcode.ps1" + environment_vars = [ + "XCODE_INSTALL_USER=${var.xcode_install_user}", + "XCODE_INSTALL_PASSWORD=${var.xcode_install_password}" + ] + execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} pwsh -f {{ .Path }}" + } + provisioner "shell" { + script = "./provision/core/reboot.sh" + execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; sudo {{ .Vars }} {{ .Path }}" + expect_disconnect = true + } + provisioner "shell" { + scripts = [ + "./provision/core/llvm.sh", + "./provision/core/rust.sh", + "./provision/core/gcc.sh", + "./provision/core/cocoapods.sh", + "./provision/core/vsmac.sh", + "./provision/core/safari.sh", + "./provision/core/bicep.sh", + "./provision/core/codeql-bundle.sh" + ] + environment_vars = [ + "API_PAT=${var.github_api_pat}" + ] + execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" + } + provisioner "shell" { + script = "./provision/core/delete-duplicate-sims.rb" + execute_command = "source $HOME/.bash_profile; ruby {{ .Path }}" + } + provisioner "shell" { + inline = [ + "pwsh -File \"$HOME/image-generation/software-report/SoftwareReport.Generator.ps1\" -OutputDirectory \"$HOME/image-generation/output/software-report\" -ImageName ${var.build_id}", + "pwsh -File \"$HOME/image-generation/tests/RunAll-Tests.ps1\"" + ] + execute_command = "source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" + } + provisioner "file" { + destination = "../image-output/" + direction = "download" + source = "./image-generation/output/" + } + provisioner "shell" { + scripts = [ + "./provision/configuration/configure-hostname.sh" + ] + execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" + } +} diff --git a/images/macos/tests/Android.Tests.ps1 b/images/macos/tests/Android.Tests.ps1 index 36e5ea96..f19e2087 100644 --- a/images/macos/tests/Android.Tests.ps1 +++ b/images/macos/tests/Android.Tests.ps1 @@ -4,7 +4,7 @@ Import-Module "$PSScriptRoot/../software-report/SoftwareReport.Android.psm1" -Di $os = Get-OSVersion -Describe "Android" { +Describe "Android" -Skip:($os.IsVenturaArm64) { $androidSdkManagerPackages = Get-AndroidPackages [int]$platformMinVersion = Get-ToolsetValue "android.platform_min_version" [version]$buildToolsMinVersion = Get-ToolsetValue "android.build_tools_min_version" @@ -50,8 +50,8 @@ Describe "Android" { } } - Context "SDKManagers" { - if (-not $os.IsVentura) { + Context "SDKManagers" -Skip:($os.IsVenturaArm64) { + if (-not $os.IsVentura -and -not $os.IsVenturaArm64) { $testCases = @( @{ PackageName = "SDK tools" @@ -76,7 +76,7 @@ Describe "Android" { } } - Context "Packages" { + Context "Packages" -Skip:($os.IsVenturaArm64) { $testCases = $androidPackages | ForEach-Object { @{ PackageName = $_ } } It "" -TestCases $testCases { diff --git a/images/macos/tests/BasicTools.Tests.ps1 b/images/macos/tests/BasicTools.Tests.ps1 index ec5afec9..5ca408c4 100644 --- a/images/macos/tests/BasicTools.Tests.ps1 +++ b/images/macos/tests/BasicTools.Tests.ps1 @@ -1,3 +1,4 @@ +Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" $os = Get-OSVersion Describe "Azure CLI" { @@ -24,7 +25,7 @@ Describe "cmake" { } } -Describe "Subversion" -Skip:($os.IsVentura) { +Describe "Subversion" -Skip:($os.IsVentura -or $os.IsVenturaArm64) { It "Subversion" { "svn --version" | Should -ReturnZeroExitCode } @@ -60,7 +61,7 @@ Describe "Perl" { } } -Describe "Helm" -Skip:($os.IsMonterey -or $os.IsVentura) { +Describe "Helm" -Skip:($os.IsMonterey -or $os.IsVentura -or $os.IsVenturaArm64) { It "Helm" { "helm version --short" | Should -ReturnZeroExitCode } @@ -108,7 +109,7 @@ Describe "bazel" { } } -Describe "Aliyun CLI" -Skip:($os.IsMonterey -or $os.IsVentura) { +Describe "Aliyun CLI" -Skip:($os.IsMonterey -or $os.IsVentura -or $os.IsVenturaArm64) { It "Aliyun CLI" { "aliyun --version" | Should -ReturnZeroExitCode } @@ -144,7 +145,7 @@ Describe "vagrant" -Skip:($os.IsBigSur) { } } -Describe "virtualbox" -Skip:($os.IsBigSur -or $os.IsVentura) { +Describe "virtualbox" -Skip:($os.IsBigSur -or $os.IsVentura -or $os.IsVenturaArm64) { It "virtualbox" { "vboxmanage -v" | Should -ReturnZeroExitCode } @@ -170,7 +171,7 @@ Describe "Kotlin" { } } -Describe "sbt" -Skip:($os.IsVentura) { +Describe "sbt" -Skip:($os.IsVentura -or $os.IsVenturaArm64) { It "sbt" { "sbt -version" | Should -ReturnZeroExitCode } @@ -182,7 +183,7 @@ Describe "yq" { } } -Describe "imagemagick" -Skip:($os.IsVentura) { +Describe "imagemagick" -Skip:($os.IsVentura -or $os.IsVenturaArm64) { It "imagemagick" { "magick -version" | Should -ReturnZeroExitCode } diff --git a/images/macos/tests/Browsers.Tests.ps1 b/images/macos/tests/Browsers.Tests.ps1 index cf8ce3a2..1b7499b3 100644 --- a/images/macos/tests/Browsers.Tests.ps1 +++ b/images/macos/tests/Browsers.Tests.ps1 @@ -1,4 +1,7 @@ -Describe "Chrome" { +Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" +$os = Get-OSVersion + +Describe "Chrome" -Skip:($os.IsVenturaArm64) { BeforeAll { $chromeLocation = "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" } @@ -19,13 +22,13 @@ Describe "Chrome" { } } -Describe "Selenium server" { +Describe "Selenium server" -Skip:($os.IsVenturaArm64) { It "Selenium server" { (Get-ChildItem -Path "/usr/local/Cellar/selenium-server*/*").Name | Should -BeLike "4.*" } } -Describe "Edge" { +Describe "Edge" -Skip:($os.IsVenturaArm64) { It "Microsoft Edge" { $edgeLocation = "/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge" $edgeLocation | Should -Exist @@ -37,7 +40,7 @@ Describe "Edge" { } } -Describe "Firefox" { +Describe "Firefox" -Skip:($os.IsVenturaArm64) { It "Firefox" { $firefoxLocation = "/Applications/Firefox.app/Contents/MacOS/firefox" $firefoxLocation | Should -Exist diff --git a/images/macos/tests/Common.Tests.ps1 b/images/macos/tests/Common.Tests.ps1 index 243ad26f..a58a0561 100644 --- a/images/macos/tests/Common.Tests.ps1 +++ b/images/macos/tests/Common.Tests.ps1 @@ -33,13 +33,13 @@ Describe "GCC" { } } -Describe "vcpkg" { +Describe "vcpkg" -Skip:($os.IsVenturaArm64) { It "vcpkg" { "vcpkg version" | Should -ReturnZeroExitCode } } -Describe "AWS" { +Describe "AWS" -Skip:($os.IsVenturaArm64) { It "AWS CLI" { "aws --version" | Should -ReturnZeroExitCode } @@ -58,7 +58,7 @@ Describe "AzCopy" { } } -Describe "Miniconda" -Skip:($os.IsVentura) { +Describe "Miniconda" -Skip:($os.IsVentura -or $os.IsVenturaArm64) { It "Conda" { Get-EnvironmentVariable "CONDA" | Should -Not -BeNullOrEmpty $condaBinPath = Join-Path $env:CONDA "bin" "conda" @@ -66,7 +66,7 @@ Describe "Miniconda" -Skip:($os.IsVentura) { } } -Describe "Stack" { +Describe "Stack" -Skip:($os.IsVenturaArm64) { It "Stack" { "stack --version" | Should -ReturnZeroExitCode } @@ -105,7 +105,7 @@ Describe "VSMac" { } } -Describe "Swig" -Skip:($os.IsVentura) { +Describe "Swig" -Skip:($os.IsVentura -or $os.IsVenturaArm64) { It "Swig" { "swig -version" | Should -ReturnZeroExitCode } @@ -117,13 +117,13 @@ Describe "Bicep" { } } -Describe "Go" -Skip:($os.IsVentura) { +Describe "Go" -Skip:($os.IsVentura -or $os.IsVenturaArm64) { It "Go" { "go version" | Should -ReturnZeroExitCode } } -Describe "VirtualBox" -Skip:($os.IsBigSur -or $os.IsVentura) { +Describe "VirtualBox" -Skip:($os.IsBigSur -or $os.IsVentura -or $os.IsVenturaArm64) { It "Check kext kernel modules" { kextstat | Out-String | Should -Match "org.virtualbox.kext" } @@ -165,7 +165,7 @@ Describe "CodeQLBundles" { } } -Describe "Colima" -Skip:($os.IsVentura) { +Describe "Colima" -Skip:($os.IsVentura -or $os.IsVenturaArm64) { It "Colima" { "colima version" | Should -ReturnZeroExitCode } diff --git a/images/macos/tests/Databases.Tests.ps1 b/images/macos/tests/Databases.Tests.ps1 index 4483c7c3..36eebcd5 100644 --- a/images/macos/tests/Databases.Tests.ps1 +++ b/images/macos/tests/Databases.Tests.ps1 @@ -1,9 +1,8 @@ - Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" $os = Get-OSVersion -Describe "MongoDB" -Skip:($os.IsVentura) { +Describe "MongoDB" -Skip:($os.IsVentura -or $os.IsVenturaArm64) { It "" -TestCases @( @{ ToolName = "mongo" } @{ ToolName = "mongod" } @@ -13,7 +12,7 @@ Describe "MongoDB" -Skip:($os.IsVentura) { } } -Describe "PostgreSQL" -Skip:($os.IsVentura) { +Describe "PostgreSQL" -Skip:($os.IsVentura -or $os.IsVenturaArm64) { It "PostgreSQL version should correspond to the version in the toolset" { $toolsetVersion = Get-ToolsetValue 'postgresql.version' # Client version diff --git a/images/macos/tests/Git.Tests.ps1 b/images/macos/tests/Git.Tests.ps1 index c0600dae..0122c9fa 100644 --- a/images/macos/tests/Git.Tests.ps1 +++ b/images/macos/tests/Git.Tests.ps1 @@ -1,3 +1,4 @@ +Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" $os = Get-OSVersion Describe "Git" { It "git is installed" { @@ -7,7 +8,7 @@ Describe "Git" { "git lfs version" | Should -ReturnZeroExitCode } } -Describe "hub CLI" -Skip:($os.IsVentura) { +Describe "hub CLI" -Skip:($os.IsVentura -or $os.IsVenturaArm64) { It "hub CLI is installed" { "hub --version" | Should -ReturnZeroExitCode } diff --git a/images/macos/tests/Haskell.Tests.ps1 b/images/macos/tests/Haskell.Tests.ps1 index a0c11ce1..f1a342d7 100644 --- a/images/macos/tests/Haskell.Tests.ps1 +++ b/images/macos/tests/Haskell.Tests.ps1 @@ -1,6 +1,7 @@ +Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" $os = Get-OSVersion -Describe "Haskell" { +Describe "Haskell" -Skip:($os.IsVenturaArm64) { Context "GHCup" { It "GHCup" { "ghcup --version" | Should -ReturnZeroExitCode diff --git a/images/macos/tests/Java.Tests.ps1 b/images/macos/tests/Java.Tests.ps1 index b1456eb6..10a5ea7a 100644 --- a/images/macos/tests/Java.Tests.ps1 +++ b/images/macos/tests/Java.Tests.ps1 @@ -11,7 +11,7 @@ function Get-NativeVersionFormat { return $Version } -Describe "Java" { +Describe "Java" -Skip:($os.IsVenturaArm64) { BeforeAll { function Validate-JavaVersion { param($JavaCommand, $ExpectedVersion) @@ -58,7 +58,7 @@ Describe "Java" { } Context "Java Adopt" { - Describe "Java Adopt" -Skip:($os.IsVentura) { + Describe "Java Adopt" -Skip:($os.IsVentura -or $os.IsVenturaArm64) { It "Java Adopt " -TestCases $adoptCases { $adoptPath = Join-Path (Get-ChildItem ${env:AGENT_TOOLSDIRECTORY}\Java_Adopt_jdk\${Version}*) "x64\Contents\Home\bin\java" diff --git a/images/macos/tests/Linters.Tests.ps1 b/images/macos/tests/Linters.Tests.ps1 index 99fa3496..79bf639b 100644 --- a/images/macos/tests/Linters.Tests.ps1 +++ b/images/macos/tests/Linters.Tests.ps1 @@ -2,7 +2,7 @@ Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" -DisableNameChecking $os = Get-OSVersion -Describe "SwiftLint" { +Describe "SwiftLint" -Skip:($os.IsVenturaArm64) { It "SwiftLint" { "swiftlint version" | Should -ReturnZeroExitCode } diff --git a/images/macos/tests/Node.Tests.ps1 b/images/macos/tests/Node.Tests.ps1 index b6d37eaf..9f13fe43 100644 --- a/images/macos/tests/Node.Tests.ps1 +++ b/images/macos/tests/Node.Tests.ps1 @@ -21,7 +21,7 @@ Describe "Node.js" { } } -Describe "nvm" -Skip:($os.IsVentura) { +Describe "nvm" -Skip:($os.IsVentura -or $os.IsVenturaArm64) { BeforeAll { $nvmPath = Join-Path $env:HOME ".nvm" "nvm.sh" $nvmInitCommand = ". $nvmPath > /dev/null 2>&1 || true" diff --git a/images/macos/tests/OpenSSL.Tests.ps1 b/images/macos/tests/OpenSSL.Tests.ps1 index 4e8a35db..8da41bba 100644 --- a/images/macos/tests/OpenSSL.Tests.ps1 +++ b/images/macos/tests/OpenSSL.Tests.ps1 @@ -1,7 +1,7 @@ Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" $os = Get-OSVersion -Describe "OpenSSL" -Skip:($os.IsVentura) { +Describe "OpenSSL" -Skip:($os.IsVentura -or $os.IsVenturaArm64) { Context "OpenSSL Version" { It "OpenSSL is available" { "openssl version" | Should -ReturnZeroExitCode diff --git a/images/macos/tests/PHP.Tests.ps1 b/images/macos/tests/PHP.Tests.ps1 index d5b25732..2ac1b55d 100644 --- a/images/macos/tests/PHP.Tests.ps1 +++ b/images/macos/tests/PHP.Tests.ps1 @@ -1,7 +1,8 @@ +Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" $os = Get-OSVersion Describe "PHP" { - Context "PHP" { + Context "PHP" -Skip:($os.IsVenturaArm64) { It "PHP Path" { Get-WhichTool "php" | Should -Not -BeLike "/usr/bin/php*" } @@ -12,7 +13,7 @@ Describe "PHP" { } } - Context "Composer" { + Context "Composer" -Skip:($os.IsVenturaArm64) { It "Composer" { "composer --version" | Should -ReturnZeroExitCode } diff --git a/images/macos/tests/PipxPackages.Tests.ps1 b/images/macos/tests/PipxPackages.Tests.ps1 index 168e0b54..f95d3563 100644 --- a/images/macos/tests/PipxPackages.Tests.ps1 +++ b/images/macos/tests/PipxPackages.Tests.ps1 @@ -3,7 +3,7 @@ Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" $os = Get-OSVersion -Describe "PipxPackages" -Skip:($os.IsVentura) { +Describe "PipxPackages" -Skip:($os.IsVentura -or $os.IsVenturaArm64) { $pipxToolset = Get-ToolsetValue "pipx" $testCases = $pipxToolset | ForEach-Object { @{package = $_.package; cmd = $_.cmd} } It "" -TestCases $testCases { diff --git a/images/macos/tests/Python.Tests.ps1 b/images/macos/tests/Python.Tests.ps1 index 5464fc9e..15f4e160 100644 --- a/images/macos/tests/Python.Tests.ps1 +++ b/images/macos/tests/Python.Tests.ps1 @@ -3,7 +3,7 @@ Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" -DisableNameChecking $os = Get-OSVersion -Describe "Python" -Skip:($os.IsVentura) { +Describe "Python" -Skip:($os.IsVentura -or $os.IsVenturaArm64) { It "Python 2 is available" { "python --version" | Should -ReturnZeroExitCode } diff --git a/images/macos/tests/Ruby.arm64.Tests.ps1 b/images/macos/tests/Ruby.arm64.Tests.ps1 new file mode 100644 index 00000000..41fee5f5 --- /dev/null +++ b/images/macos/tests/Ruby.arm64.Tests.ps1 @@ -0,0 +1,26 @@ +Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" +Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" -DisableNameChecking + +$os = Get-OSVersion + +Describe "Ruby" -Skip:($os.IsVentura) { + It "Ruby is available" { + "ruby --version" | Should -ReturnZeroExitCode + } + + It "Ruby is installed via HomeBrew" { + Get-WhichTool "ruby" | Should -Not -BeLike "/usr/bin/ruby*" + } + + It "Ruby tools are consistent" { + $expectedPrefix = "/opt/homebrew" + Get-WhichTool "ruby" | Should -Match "$($expectedPrefix)*" + Get-WhichTool "gem" | Should -Match "$($expectedPrefix)*" + Get-WhichTool "bundler" | Should -Match "$($expectedPrefix)*" + } + + It "Ruby gems permissions are valid" { + "gem install bundle" | Should -ReturnZeroExitCode + "gem uninstall bundle" | Should -ReturnZeroExitCode + } +} diff --git a/images/macos/tests/Ruby.Tests.ps1 b/images/macos/tests/Ruby.x64.Tests.ps1 similarity index 92% rename from images/macos/tests/Ruby.Tests.ps1 rename to images/macos/tests/Ruby.x64.Tests.ps1 index 222c182f..ff438c7c 100644 --- a/images/macos/tests/Ruby.Tests.ps1 +++ b/images/macos/tests/Ruby.x64.Tests.ps1 @@ -1,24 +1,26 @@ -Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" -Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" -DisableNameChecking - -Describe "Ruby" { - It "Ruby is available" { - "ruby --version" | Should -ReturnZeroExitCode - } - - It "Ruby is installed via HomeBrew" { - Get-WhichTool "ruby" | Should -Not -BeLike "/usr/bin/ruby*" - } - - It "Ruby tools are consistent" { - $expectedPrefix = "/usr/local" - Get-WhichTool "ruby" | Should -Match "$($expectedPrefix)*" - Get-WhichTool "gem" | Should -Match "$($expectedPrefix)*" - Get-WhichTool "bundler" | Should -Match "$($expectedPrefix)*" - } - - It "Ruby gems permissions are valid" { - "gem install bundle" | Should -ReturnZeroExitCode - "gem uninstall bundle" | Should -ReturnZeroExitCode - } -} \ No newline at end of file +Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" +Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" -DisableNameChecking + +$os = Get-OSVersion + +Describe "Ruby" -Skip:($os.IsVenturaArm64) { + It "Ruby is available" { + "ruby --version" | Should -ReturnZeroExitCode + } + + It "Ruby is installed via HomeBrew" { + Get-WhichTool "ruby" | Should -Not -BeLike "/usr/bin/ruby*" + } + + It "Ruby tools are consistent" { + $expectedPrefix = "/usr/local" + Get-WhichTool "ruby" | Should -Match "$($expectedPrefix)*" + Get-WhichTool "gem" | Should -Match "$($expectedPrefix)*" + Get-WhichTool "bundler" | Should -Match "$($expectedPrefix)*" + } + + It "Ruby gems permissions are valid" { + "gem install bundle" | Should -ReturnZeroExitCode + "gem uninstall bundle" | Should -ReturnZeroExitCode + } +} diff --git a/images/macos/tests/RubyGem.Tests.ps1 b/images/macos/tests/RubyGem.Tests.ps1 index 5e906096..4546c951 100644 --- a/images/macos/tests/RubyGem.Tests.ps1 +++ b/images/macos/tests/RubyGem.Tests.ps1 @@ -1,3 +1,4 @@ +Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" $os = Get-OSVersion Describe "RubyGems" { @@ -19,7 +20,7 @@ Describe "Bundler" { } } -Describe "Nomad shenzhen CLI" -Skip:($os.IsMonterey -or $os.IsVentura) { +Describe "Nomad shenzhen CLI" -Skip:($os.IsMonterey -or $os.IsVentura -or $os.IsVenturaArm64) { It "Nomad shenzhen CLI" { "ipa --version" | Should -ReturnZeroExitCode } @@ -37,7 +38,7 @@ Describe "xcpretty" { } } -Describe "jazzy" -Skip:($os.IsVentura) { +Describe "jazzy" -Skip:($os.IsVentura -or $os.IsVenturaArm64) { It "jazzy" { "jazzy --version" | Should -ReturnZeroExitCode } diff --git a/images/macos/tests/Rust.Tests.ps1 b/images/macos/tests/Rust.Tests.ps1 index 58527183..894ef443 100644 --- a/images/macos/tests/Rust.Tests.ps1 +++ b/images/macos/tests/Rust.Tests.ps1 @@ -1,5 +1,3 @@ -$os = Get-OSVersion - Describe "Rust" { Context "Rust" { It "Rustup is installed" { @@ -10,7 +8,7 @@ Describe "Rust" { "rustc --version" | Should -ReturnZeroExitCode } } - + Context "Cargo" { It "Cargo is installed" { "cargo --version" | Should -ReturnZeroExitCode @@ -34,4 +32,4 @@ Describe "Rust" { "cargo outdated --version" | Should -ReturnZeroExitCode } } -} \ No newline at end of file +} diff --git a/images/macos/tests/System.Tests.ps1 b/images/macos/tests/System.Tests.ps1 index 7322062a..c71a2c8f 100644 --- a/images/macos/tests/System.Tests.ps1 +++ b/images/macos/tests/System.Tests.ps1 @@ -25,7 +25,7 @@ Describe "Certificate" { } } -Describe "Audio device" -Skip:($os.IsVentura) { +Describe "Audio device" -Skip:($os.IsVentura -or $os.IsVenturaArm64) { It "Sox is installed" { "sox --version" | Should -ReturnZeroExitCode } @@ -39,13 +39,13 @@ Describe "Audio device" -Skip:($os.IsVentura) { } } -Describe "Screen Resolution" { +Describe "Screen Resolution" -Skip:(isVeertu) { It "Screen Resolution" { system_profiler SPDisplaysDataType | Select-String "Resolution" | Should -Match "1176 x 885|1920 x 1080" } } -Describe "Open windows" { +Describe "Open windows" -Skip:(isVeertu) { It "Opened windows not found" { 'tell application id "com.apple.systemevents" to get every window of (every process whose class of windows contains window)' | Tee-Object /tmp/windows.osascript $cmd = "osascript /tmp/windows.osascript" diff --git a/images/macos/tests/Toolcache.Tests.ps1 b/images/macos/tests/Toolcache.Tests.ps1 index e397ea12..ee2b0fe8 100644 --- a/images/macos/tests/Toolcache.Tests.ps1 +++ b/images/macos/tests/Toolcache.Tests.ps1 @@ -1,6 +1,8 @@ Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" -DisableNameChecking +$os = Get-OSVersion + Describe "Toolcache" { $toolcacheDirectory = Join-Path $env:HOME "hostedtoolcache" [array]$packages += Get-ToolsetValue -KeyPath "toolcache" | ForEach-Object { @@ -11,7 +13,7 @@ Describe "Toolcache" { } } - Context "Python" { + Context "Python" -Skip:($os.IsVenturaArm64) { $pythonDirectory = Join-Path $toolcacheDirectory "Python" $pythonPackage = $packages | Where-Object { $_.ToolName -eq "python" } | Select-Object -First 1 $testCase = @{ PythonDirectory = $pythonDirectory } @@ -54,7 +56,7 @@ Describe "Toolcache" { } } - Context "Ruby" { + Context "Ruby" -Skip:($os.IsVenturaArm64) { $rubyDirectory = Join-Path $toolcacheDirectory "Ruby" $rubyPackage = $packages | Where-Object { $_.ToolName -eq "Ruby" } | Select-Object -First 1 $testCase = @{ RubyDirectory = $rubyDirectory } @@ -96,7 +98,7 @@ Describe "Toolcache" { } } } - Context "PyPy" { + Context "PyPy" -Skip:($os.IsVenturaArm64) { $pypyDirectory = Join-Path $toolcacheDirectory "PyPy" $pypyPackage = $packages | Where-Object { $_.ToolName -eq "pypy" } | Select-Object -First 1 $testCase = @{ PypyDirectory = $pypyDirectory } @@ -140,7 +142,7 @@ Describe "Toolcache" { } } - Context "Node" { + Context "Node" -Skip:($os.IsVenturaArm64) { $nodeDirectory = Join-Path $toolcacheDirectory "node" $nodePackage = $packages | Where-Object { $_.ToolName -eq "node" } | Select-Object -First 1 $testCase = @{ NodeDirectory = $nodeDirectory } @@ -190,7 +192,7 @@ Describe "Toolcache" { } } - Context "Go" { + Context "Go" -Skip:($os.IsVenturaArm64) { $goDirectory = Join-Path $toolcacheDirectory "go" $goPackage = $packages | Where-Object { $_.ToolName -eq "go" } | Select-Object -First 1 $testCase = @{ GoDirectory = $goDirectory } diff --git a/images/macos/tests/WebServers.Tests.ps1 b/images/macos/tests/WebServers.Tests.ps1 index 27eb1778..ef0a128b 100644 --- a/images/macos/tests/WebServers.Tests.ps1 +++ b/images/macos/tests/WebServers.Tests.ps1 @@ -2,7 +2,7 @@ Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" $os = Get-OSVersion -Describe "Apache" { +Describe "Apache" -Skip:($os.IsVenturaArm64) { It "Apache CLI" { "httpd -v" | Should -ReturnZeroExitCode } @@ -12,7 +12,7 @@ Describe "Apache" { } } -Describe "Nginx" -Skip:($os.IsVentura) { +Describe "Nginx" -Skip:($os.IsVentura -or $os.IsVenturaArm64) { It "Nginx CLI" { "nginx -v" | Should -ReturnZeroExitCode } diff --git a/images/macos/tests/Xamarin.Tests.ps1 b/images/macos/tests/Xamarin.Tests.ps1 index 2c989b5c..ad9e098f 100644 --- a/images/macos/tests/Xamarin.Tests.ps1 +++ b/images/macos/tests/Xamarin.Tests.ps1 @@ -18,7 +18,7 @@ BeforeAll { } } -Describe "Mono" -Skip:($os.IsVentura) { +Describe "Mono" -Skip:($os.IsVentura -or $os.IsVenturaArm64) { $MONO_VERSIONS | ForEach-Object { Context "$_" { $MONO_VERSIONS_PATH = "/Library/Frameworks/Mono.framework/Versions" @@ -82,7 +82,7 @@ Describe "Mono" -Skip:($os.IsVentura) { } } -Describe "Xamarin.iOS" -Skip:($os.IsVentura) { +Describe "Xamarin.iOS" -Skip:($os.IsVentura -or $os.IsVenturaArm64) { $XAMARIN_IOS_VERSIONS | ForEach-Object { Context "$_" { $XAMARIN_IOS_VERSIONS_PATH = "/Library/Frameworks/Xamarin.iOS.framework/Versions" @@ -115,7 +115,7 @@ Describe "Xamarin.iOS" -Skip:($os.IsVentura) { } } -Describe "Xamarin.Mac" -Skip:($os.IsVentura) { +Describe "Xamarin.Mac" -Skip:($os.IsVentura-or $os.IsVenturaArm64) { $XAMARIN_MAC_VERSIONS | ForEach-Object { Context "$_" { $XAMARIN_MAC_VERSIONS_PATH = "/Library/Frameworks/Xamarin.Mac.framework/Versions" @@ -148,7 +148,7 @@ Describe "Xamarin.Mac" -Skip:($os.IsVentura) { } } -Describe "Xamarin.Android" -Skip:($os.IsVentura) { +Describe "Xamarin.Android" -Skip:($os.IsVentura -or $os.IsVenturaArm64) { $XAMARIN_ANDROID_VERSIONS | ForEach-Object { Context "$_" { $XAMARIN_ANDROID_VERSIONS_PATH = "/Library/Frameworks/Xamarin.Android.framework/Versions" @@ -188,7 +188,7 @@ Describe "Xamarin.Android" -Skip:($os.IsVentura) { } } -Describe "Xamarin Bundles" -Skip:($os.IsVentura) { +Describe "Xamarin Bundles" -Skip:($os.IsVentura -or $os.IsVenturaArm64) { BeforeAll { $MONO_VERSIONS_PATH = "/Library/Frameworks/Mono.framework/Versions" $XAMARIN_IOS_VERSIONS_PATH = "/Library/Frameworks/Xamarin.iOS.framework/Versions" @@ -293,7 +293,7 @@ Describe "Xamarin Bundles" -Skip:($os.IsVentura) { } } -Describe "Nuget" -Skip:($os.IsVentura) { +Describe "Nuget" -Skip:($os.IsVentura -or $os.IsVenturaArm64) { It "Nuget config contains nuget.org feed" { Get-Content $env:HOME/.config/NuGet/NuGet.Config | Out-String | Should -Match "nuget.org" } diff --git a/images/macos/toolsets/toolset-13.json b/images/macos/toolsets/toolset-13.json index 32206718..5a5a90a5 100644 --- a/images/macos/toolsets/toolset-13.json +++ b/images/macos/toolsets/toolset-13.json @@ -1,11 +1,20 @@ { "xcode": { "default": "14.2", - "versions": [ - { "link": "14.3", "version": "14.3.0" }, - { "link": "14.2", "version": "14.2.0" }, - { "link": "14.1", "version": "14.1.0" } - ] + "x64": { + "versions": [ + { "link": "14.3", "version": "14.3.0" }, + { "link": "14.2", "version": "14.2.0" }, + { "link": "14.1", "version": "14.1.0" } + ] + }, + "arm64":{ + "versions": [ + { "link": "14.3", "version": "14.3.0" }, + { "link": "14.2", "version": "14.2.0" }, + { "link": "14.1", "version": "14.1.0" } + ] + } }, "xamarin": { "vsmac": { @@ -80,9 +89,18 @@ ] }, "dotnet": { - "versions": [ - "7.0" - ] + "arch":{ + "x64": { + "versions": [ + "7.0" + ] + }, + "arm64": { + "versions": [ + "7.0" + ] + } + } }, "ruby": { "default": "3.0",