mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-20 06:29:50 +00:00
Change RubyGems installation to use toolset (#3474)
This commit is contained in:
@@ -78,8 +78,40 @@ function ShouldReturnZeroExitCode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ShouldMatchCommandOutput {
|
||||||
|
Param(
|
||||||
|
[String] $ActualValue,
|
||||||
|
[String] $RegularExpression,
|
||||||
|
[switch] $Negate
|
||||||
|
)
|
||||||
|
|
||||||
|
$output = (Get-CommandResult $ActualValue).Output | Out-String
|
||||||
|
[bool] $succeeded = $output -cmatch $RegularExpression
|
||||||
|
|
||||||
|
if ($Negate) {
|
||||||
|
$succeeded = -not $succeeded
|
||||||
|
}
|
||||||
|
|
||||||
|
$failureMessage = ''
|
||||||
|
|
||||||
|
if (-not $succeeded) {
|
||||||
|
if ($Negate) {
|
||||||
|
$failureMessage = "Expected regular expression '$RegularExpression' for '$ActualValue' command to not match '$output', but it did match."
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$failureMessage = "Expected regular expression '$RegularExpression' for '$ActualValue' command to match '$output', but it did not match."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return [PSCustomObject] @{
|
||||||
|
Succeeded = $succeeded
|
||||||
|
FailureMessage = $failureMessage
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
If (Get-Command -Name Add-ShouldOperator -ErrorAction SilentlyContinue) {
|
If (Get-Command -Name Add-ShouldOperator -ErrorAction SilentlyContinue) {
|
||||||
Add-ShouldOperator -Name ReturnZeroExitCode -InternalName ShouldReturnZeroExitCode -Test ${function:ShouldReturnZeroExitCode}
|
Add-ShouldOperator -Name ReturnZeroExitCode -InternalName ShouldReturnZeroExitCode -Test ${function:ShouldReturnZeroExitCode}
|
||||||
|
Add-ShouldOperator -Name MatchCommandOutput -InternalName ShouldMatchCommandOutput -Test ${function:ShouldMatchCommandOutput}
|
||||||
}
|
}
|
||||||
|
|
||||||
function Invoke-PesterTests {
|
function Invoke-PesterTests {
|
||||||
|
|||||||
@@ -4,33 +4,12 @@ source ~/utils/utils.sh
|
|||||||
echo Updating RubyGems...
|
echo Updating RubyGems...
|
||||||
gem update --system
|
gem update --system
|
||||||
|
|
||||||
echo Installing xcode-install utility...
|
gemsToInstall=$(get_toolset_value ".rubygems[]")
|
||||||
gem install xcode-install --force
|
if [ -n "$gemsToInstall" ]; then
|
||||||
|
for gem in $gemsToInstall; do
|
||||||
echo Installing CocoaPods...
|
echo "Installing gem $gem"
|
||||||
gem install cocoapods
|
gem install $gem
|
||||||
|
done
|
||||||
if is_Less_BigSur; then
|
|
||||||
# fix nomad-cli installation
|
|
||||||
if is_HighSierra; then
|
|
||||||
brew_smart_install "libxml2"
|
|
||||||
gem install nokogiri -v 1.6.8.1 -- --use-system-libraries --with-xml2-include=$(brew --prefix libxml2)/include/libxml2
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo Installing nomad-cli...
|
|
||||||
gem install nomad-cli
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo Installing xcpretty...
|
|
||||||
gem install xcpretty
|
|
||||||
|
|
||||||
echo Installing bundler...
|
|
||||||
gem install bundler --force
|
|
||||||
|
|
||||||
# AppStoreRelease Azure DevOps has issues with Fastlane 2.184.0. Temporary hardcoding the version until the issue is fixed
|
|
||||||
# https://github.com/microsoft/app-store-vsts-extension/issues/244
|
|
||||||
echo Installing fastlane tools...
|
|
||||||
gem uninstall fastlane -aI
|
|
||||||
gem install fastlane -v 2.183.2
|
|
||||||
|
|
||||||
invoke_tests "RubyGem"
|
invoke_tests "RubyGem"
|
||||||
|
|||||||
@@ -234,13 +234,18 @@ function Build-XcodeSupportToolsSection {
|
|||||||
"xcversion $xcversion"
|
"xcversion $xcversion"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
$nomadOutput = Run-Command "gem list nomad-cli"
|
||||||
|
$nomadCLI = [regex]::matches($nomadOutput, "(\d+.){2}\d+").Value
|
||||||
|
$nomadShenzhenOutput = Run-Command "ipa -version"
|
||||||
|
$nomadShenzhen = [regex]::matches($nomadShenzhenOutput, "(\d+.){2}\d+").Value
|
||||||
|
$toolList += @(
|
||||||
|
"Nomad CLI $nomadCLI",
|
||||||
|
"Nomad shenzhen CLI $nomadShenzhen"
|
||||||
|
)
|
||||||
|
|
||||||
if ($os.IsLessThanBigSur) {
|
if ($os.IsLessThanBigSur) {
|
||||||
$nomadCLI = Run-Command "gem -v nomad-cli"
|
|
||||||
$nomadIPA = Run-Command "ipa -version"
|
|
||||||
$xctool = Run-Command "xctool --version"
|
$xctool = Run-Command "xctool --version"
|
||||||
$toolList += @(
|
$toolList += @(
|
||||||
"Nomad CLI $nomadCLI",
|
|
||||||
"Nomad CLI IPA $nomadIPA",
|
|
||||||
"xctool $xctool"
|
"xctool $xctool"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,15 @@
|
|||||||
$os = Get-OSVersion
|
Describe "RubyGems" {
|
||||||
|
$gemTestCases = Get-ToolsetValue -KeyPath "rubygems" | ForEach-Object {
|
||||||
|
@{gemName = $_}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($gemTestCases)
|
||||||
|
{
|
||||||
|
It "Gem <gemName> is installed" -TestCases $gemTestCases {
|
||||||
|
"gem list -i '^$gemName$'" | Should -MatchCommandOutput "true"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Describe "Bundler" {
|
Describe "Bundler" {
|
||||||
It "Bundler" {
|
It "Bundler" {
|
||||||
@@ -6,17 +17,9 @@ Describe "Bundler" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Describe "Nomad" -Skip:($os.IsBigSur) {
|
Describe "Nomad shenzhen CLI" {
|
||||||
Context "Nomad" {
|
It "Nomad shenzhen CLI" {
|
||||||
It "Nomad CLI" {
|
"ipa --version" | Should -ReturnZeroExitCode
|
||||||
$result = Get-CommandResult "gem list"
|
|
||||||
$result.Output | Should -BeLike "*nomad-cli*"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Context "Nomad CLI" {
|
|
||||||
It "Nomad CLI IPA" {
|
|
||||||
"ipa --version" | Should -ReturnZeroExitCode
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -339,5 +339,13 @@
|
|||||||
"versions": [
|
"versions": [
|
||||||
"2.1"
|
"2.1"
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
"rubygems": [
|
||||||
|
"xcode-install",
|
||||||
|
"cocoapods",
|
||||||
|
"nomad-cli",
|
||||||
|
"xcpretty",
|
||||||
|
"bundler",
|
||||||
|
"fastlane"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -294,5 +294,13 @@
|
|||||||
"3.1",
|
"3.1",
|
||||||
"5.0"
|
"5.0"
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
"rubygems": [
|
||||||
|
"xcode-install",
|
||||||
|
"cocoapods",
|
||||||
|
"nomad-cli",
|
||||||
|
"xcpretty",
|
||||||
|
"bundler",
|
||||||
|
"fastlane"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -214,5 +214,13 @@
|
|||||||
"3.1",
|
"3.1",
|
||||||
"5.0"
|
"5.0"
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
"rubygems": [
|
||||||
|
"xcode-install",
|
||||||
|
"cocoapods",
|
||||||
|
"nomad-cli",
|
||||||
|
"xcpretty",
|
||||||
|
"bundler",
|
||||||
|
"fastlane"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user