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) {
|
||||
Add-ShouldOperator -Name ReturnZeroExitCode -InternalName ShouldReturnZeroExitCode -Test ${function:ShouldReturnZeroExitCode}
|
||||
Add-ShouldOperator -Name MatchCommandOutput -InternalName ShouldMatchCommandOutput -Test ${function:ShouldMatchCommandOutput}
|
||||
}
|
||||
|
||||
function Invoke-PesterTests {
|
||||
|
||||
@@ -4,33 +4,12 @@ source ~/utils/utils.sh
|
||||
echo Updating RubyGems...
|
||||
gem update --system
|
||||
|
||||
echo Installing xcode-install utility...
|
||||
gem install xcode-install --force
|
||||
|
||||
echo Installing CocoaPods...
|
||||
gem install cocoapods
|
||||
|
||||
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
|
||||
gemsToInstall=$(get_toolset_value ".rubygems[]")
|
||||
if [ -n "$gemsToInstall" ]; then
|
||||
for gem in $gemsToInstall; do
|
||||
echo "Installing gem $gem"
|
||||
gem install $gem
|
||||
done
|
||||
fi
|
||||
|
||||
echo Installing nomad-cli...
|
||||
gem install nomad-cli
|
||||
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"
|
||||
|
||||
@@ -234,13 +234,18 @@ function Build-XcodeSupportToolsSection {
|
||||
"xcversion $xcversion"
|
||||
)
|
||||
|
||||
if ($os.IsLessThanBigSur) {
|
||||
$nomadCLI = Run-Command "gem -v nomad-cli"
|
||||
$nomadIPA = Run-Command "ipa -version"
|
||||
$xctool = Run-Command "xctool --version"
|
||||
$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 CLI IPA $nomadIPA",
|
||||
"Nomad shenzhen CLI $nomadShenzhen"
|
||||
)
|
||||
|
||||
if ($os.IsLessThanBigSur) {
|
||||
$xctool = Run-Command "xctool --version"
|
||||
$toolList += @(
|
||||
"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" {
|
||||
It "Bundler" {
|
||||
@@ -6,19 +17,11 @@ Describe "Bundler" {
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Nomad" -Skip:($os.IsBigSur) {
|
||||
Context "Nomad" {
|
||||
It "Nomad CLI" {
|
||||
$result = Get-CommandResult "gem list"
|
||||
$result.Output | Should -BeLike "*nomad-cli*"
|
||||
}
|
||||
}
|
||||
Context "Nomad CLI" {
|
||||
It "Nomad CLI IPA" {
|
||||
Describe "Nomad shenzhen CLI" {
|
||||
It "Nomad shenzhen CLI" {
|
||||
"ipa --version" | Should -ReturnZeroExitCode
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Fastlane" {
|
||||
It "Fastlane" {
|
||||
|
||||
@@ -339,5 +339,13 @@
|
||||
"versions": [
|
||||
"2.1"
|
||||
]
|
||||
}
|
||||
},
|
||||
"rubygems": [
|
||||
"xcode-install",
|
||||
"cocoapods",
|
||||
"nomad-cli",
|
||||
"xcpretty",
|
||||
"bundler",
|
||||
"fastlane"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -294,5 +294,13 @@
|
||||
"3.1",
|
||||
"5.0"
|
||||
]
|
||||
}
|
||||
},
|
||||
"rubygems": [
|
||||
"xcode-install",
|
||||
"cocoapods",
|
||||
"nomad-cli",
|
||||
"xcpretty",
|
||||
"bundler",
|
||||
"fastlane"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -214,5 +214,13 @@
|
||||
"3.1",
|
||||
"5.0"
|
||||
]
|
||||
}
|
||||
},
|
||||
"rubygems": [
|
||||
"xcode-install",
|
||||
"cocoapods",
|
||||
"nomad-cli",
|
||||
"xcpretty",
|
||||
"bundler",
|
||||
"fastlane"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user