From 160d3cc82542c87312e9f9087e77f1730902995f Mon Sep 17 00:00:00 2001 From: Mikhail Timofeev <48208649+miketimofeev@users.noreply.github.com> Date: Wed, 22 Jun 2022 22:20:37 +0400 Subject: [PATCH] Recreate nuget.config with a proper feed for macos (#5793) --- images/macos/provision/core/xamarin.sh | 4 +++ images/macos/tests/Xamarin.Tests.ps1 | 46 +++++++++++++++----------- 2 files changed, 30 insertions(+), 20 deletions(-) diff --git a/images/macos/provision/core/xamarin.sh b/images/macos/provision/core/xamarin.sh index b747faaa..f738313f 100755 --- a/images/macos/provision/core/xamarin.sh +++ b/images/macos/provision/core/xamarin.sh @@ -82,4 +82,8 @@ 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 +# Temporary workaround to recreate nuget.config file with a correct feed https://github.com/actions/virtual-environments/issues/5768 +rm -rf $HOME/.config/NuGet/NuGet.Config +nuget config + invoke_tests "Xamarin" diff --git a/images/macos/tests/Xamarin.Tests.ps1 b/images/macos/tests/Xamarin.Tests.ps1 index 3d7a97dd..9f523318 100644 --- a/images/macos/tests/Xamarin.Tests.ps1 +++ b/images/macos/tests/Xamarin.Tests.ps1 @@ -11,7 +11,7 @@ BeforeAll { param ( [string] $Version ) - + $versionParts = $Version.Split(".") return [String]::Join(".", $versionParts[0..1]) } @@ -90,28 +90,28 @@ Describe "Xamarin.iOS" { It "is installed" -TestCases $testCase { param ( [string] $VersionFolderPath ) - + $xamarinBinPath = Join-Path $VersionFolderPath "bin" $VersionFolderPath | Should -Exist $xamarinBinPath | Should -Exist } - + It "is available via short link" -TestCases $testCase { param ( [string] $XamarinIosVersion, [string] $IosVersionsPath, [string] $VersionFolderPath ) - + $shortSymlink = Get-ShortSymlink $XamarinIosVersion # only 'major.minor' $shortSymlinkFolderPath = Join-Path $IosVersionsPath $shortSymlink $shortVersionPath = Join-Path $shortSymlinkFolderPath "VERSION" $fullVersionPath = Join-Path $VersionFolderPath "VERSION" - + Validate-IdenticalFileContent -File1 $shortVersionPath -File2 $fullVersionPath } } - } + } } Describe "Xamarin.Mac" { @@ -120,7 +120,7 @@ Describe "Xamarin.Mac" { $XAMARIN_MAC_VERSIONS_PATH = "/Library/Frameworks/Xamarin.Mac.framework/Versions" $versionFolderPath = Join-Path $XAMARIN_MAC_VERSIONS_PATH $_ $testCase = @{ XamarinMacVersion = $_; VersionFolderPath = $versionFolderPath; MacVersionsPath = $XAMARIN_MAC_VERSIONS_PATH } - + It "is installed" -TestCases $testCase { param ( [string] $VersionFolderPath ) @@ -128,7 +128,7 @@ Describe "Xamarin.Mac" { $VersionFolderPath | Should -Exist $xamarinBinPath | Should -Exist } - + It "is available via short link" -TestCases $testCase { param ( [string] $XamarinMacVersion, @@ -140,7 +140,7 @@ Describe "Xamarin.Mac" { $shortSymlinkFolderPath = Join-Path $MacVersionsPath $shortSymlink $shortVersionPath = Join-Path $shortSymlinkFolderPath "VERSION" $fullVersionPath = Join-Path $VersionFolderPath "VERSION" - + Validate-IdenticalFileContent -File1 $shortVersionPath -File2 $fullVersionPath } } @@ -156,35 +156,35 @@ Describe "Xamarin.Android" { It "is installed" -TestCases $testCase { param ( [string] $VersionFolderPath ) - + $xamarinLibPath = Join-Path $VersionFolderPath "lib" $xamarinLibPath | Should -Exist } - + It "is available via short link" -TestCases $testCase { param ( [string] $XamarinAndroidVersion, [string] $AndroidVersionsPath, [string] $VersionFolderPath ) - + $shortSymlink = Get-ShortSymlink $XamarinAndroidVersion # only 'major.minor' $shortSymlinkFolderPath = Join-Path $AndroidVersionsPath $shortSymlink $shortVersionPath = Join-Path $shortSymlinkFolderPath "VERSION" $fullVersionPath = Join-Path $VersionFolderPath "VERSION" - + Validate-IdenticalFileContent -File1 $shortVersionPath -File2 $fullVersionPath } - + It "has correct symlinks" -TestCases $testCase { param ( [string] $VersionFolderPath ) - + $xamarinLibPath = Join-Path $VersionFolderPath "lib" Join-Path $xamarinLibPath "xbuild" | Should -Exist Join-Path $xamarinLibPath "xbuild-frameworks" | Should -Exist - } + } } - } + } } Describe "Xamarin Bundles" { @@ -194,11 +194,11 @@ Describe "Xamarin Bundles" { $XAMARIN_MAC_VERSIONS_PATH = "/Library/Frameworks/Xamarin.Mac.framework/Versions" $XAMARIN_ANDROID_VERSIONS_PATH = "/Library/Frameworks/Xamarin.Android.framework/Versions" } - + [array]$XAMARIN_BUNDLES = Get-ToolsetValue "xamarin.bundles" $XAMARIN_DEFAULT_BUNDLE = Get-ToolsetValue "xamarin.bundle-default" If ($XAMARIN_DEFAULT_BUNDLE -eq "latest") { $XAMARIN_DEFAULT_BUNDLE = $XAMARIN_BUNDLES[0].symlink } - + $currentBundle = [PSCustomObject] @{ symlink = "Current" mono = $XAMARIN_DEFAULT_BUNDLE @@ -220,7 +220,7 @@ Describe "Xamarin Bundles" { It "Mono symlink exists" -TestCases $allBundles { param ( [string] $BundleSymlink ) - + (Join-Path $MONO_VERSIONS_PATH $BundleSymlink) | Should -Exist } @@ -290,4 +290,10 @@ Describe "Xamarin Bundles" { Validate-IdenticalFileContent -File1 $targetVersionPath -File2 $sourceVersionPath } +} + +Describe "Nuget" { + It "Nuget config contains nuget.org feed" { + Get-Content $env:HOME/.config/NuGet/NuGet.Config | Out-String | Should -Match "nuget.org" + } } \ No newline at end of file