[macOS] Pre-cache Ruby binaries (#2085)

* precache ruby binaries

* remove github_feed_token and minor change

* do not install ruby binaries from toolset

* remove toolcache file
This commit is contained in:
Dibir Magomedsaygitov
2020-11-27 10:53:17 +03:00
committed by GitHub
parent 38b0a6005d
commit 75d141eb67
14 changed files with 319 additions and 331 deletions

View File

@@ -4,3 +4,40 @@ source ~/utils/utils.sh
echo Installing Ruby... echo Installing Ruby...
brew install ruby brew install ruby
#if High Sierra - skip installation from toolset
if is_HighSierra; then
exit 0
fi
echo "Install Ruby from toolset..."
PACKAGE_TAR_NAMES=$(curl -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
fi
for TOOLSET_VERSION in ${TOOLSET_VERSIONS[@]}; do
PACKAGE_TAR_NAME=$(echo "$PACKAGE_TAR_NAMES" | grep "^ruby-${TOOLSET_VERSION}-macos-latest.tar.gz$" | 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

View File

@@ -1,38 +0,0 @@
#!/bin/bash -e -o pipefail
# Download hosted tool cache with npm
NPM_FEED="npm.pkg.github.com"
TOOLSET_PATH="$HOME/image-generation/toolcache.json"
echo "Installing npm-toolcache..."
PACKAGE_LIST=($(jq -r 'keys | .[]' $TOOLSET_PATH))
# Execute in /tmp folder to avoid node_modules creation in $HOME
pushd /tmp
# GitHub Package Registry doesn't support downloading public packages without auth so we have to authorize
# Put the .npmrc to /tmp directory on the image to make sure that it will deleted after image generation
echo "Configure auth for github package registry"
echo "@actions:registry=https://${NPM_FEED}/" >> ".npmrc"
echo "//${NPM_FEED}/:_authToken=${GITHUB_FEED_TOKEN}" >> ".npmrc"
echo "Install packages..."
for PACKAGE_NAME in ${PACKAGE_LIST[@]}; do
PACKAGE_VERSIONS=($(jq -r ".[\"$PACKAGE_NAME\"] | .[]" $TOOLSET_PATH))
for PACKAGE_VERSION in ${PACKAGE_VERSIONS[@]}; do
echo "Install ${PACKAGE_NAME}@${PACKAGE_VERSION}"
npm install ${PACKAGE_NAME}@${PACKAGE_VERSION}
exit_code=$?
if [ $exit_code -ne 0 ]; then
echo "${PACKAGE_NAME}@${PACKAGE_VERSION} installation failure; Error:${exit_code}"
exit 1
fi
done;
done;
rm -f ".npmrc"
popd

View File

@@ -11,7 +11,6 @@
"output_folder": null, "output_folder": null,
"vm_username": null, "vm_username": null,
"vm_password": null, "vm_password": null,
"github_feed_token": null,
"xcode_install_user": null, "xcode_install_user": null,
"xcode_install_password": null, "xcode_install_password": null,
"image_os": "macos1013" "image_os": "macos1013"
@@ -87,11 +86,6 @@
"source": "./toolsets/toolset-10.13.json", "source": "./toolsets/toolset-10.13.json",
"destination": "~/image-generation/toolset.json" "destination": "~/image-generation/toolset.json"
}, },
{
"type": "file",
"source": "./toolsets/toolcache-10.13.json",
"destination": "~/image-generation/toolcache.json"
},
{ {
"type": "shell", "type": "shell",
"execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}", "execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}",

View File

@@ -11,7 +11,6 @@
"output_folder": null, "output_folder": null,
"vm_username": null, "vm_username": null,
"vm_password": null, "vm_password": null,
"github_feed_token": null,
"xcode_install_user": null, "xcode_install_user": null,
"xcode_install_password": null, "xcode_install_password": null,
"image_os": "macos1014" "image_os": "macos1014"
@@ -87,11 +86,6 @@
"source": "./toolsets/toolset-10.14.json", "source": "./toolsets/toolset-10.14.json",
"destination": "~/image-generation/toolset.json" "destination": "~/image-generation/toolset.json"
}, },
{
"type": "file",
"source": "./toolsets/toolcache-10.14.json",
"destination": "~/image-generation/toolcache.json"
},
{ {
"type": "shell", "type": "shell",
"execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}", "execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}",
@@ -187,12 +181,8 @@
"./provision/core/miniconda.sh", "./provision/core/miniconda.sh",
"./provision/core/xcode-sims.sh", "./provision/core/xcode-sims.sh",
"./provision/core/xcode-postbuild.sh", "./provision/core/xcode-postbuild.sh",
"./provision/core/toolcache.sh",
"./provision/core/pypy.sh", "./provision/core/pypy.sh",
"./provision/core/pipx-packages.sh" "./provision/core/pipx-packages.sh"
],
"environment_vars": [
"GITHUB_FEED_TOKEN={{user `github_feed_token`}}"
] ]
}, },
{ {

View File

@@ -11,7 +11,6 @@
"output_folder": null, "output_folder": null,
"vm_username": null, "vm_username": null,
"vm_password": null, "vm_password": null,
"github_feed_token": null,
"xcode_install_user": null, "xcode_install_user": null,
"xcode_install_password": null, "xcode_install_password": null,
"image_os": "macos1015" "image_os": "macos1015"
@@ -87,11 +86,6 @@
"source": "./toolsets/toolset-10.15.json", "source": "./toolsets/toolset-10.15.json",
"destination": "~/image-generation/toolset.json" "destination": "~/image-generation/toolset.json"
}, },
{
"type": "file",
"source": "./toolsets/toolcache-10.14.json",
"destination": "~/image-generation/toolcache.json"
},
{ {
"type": "shell", "type": "shell",
"execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}", "execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}",
@@ -188,12 +182,8 @@
"./provision/core/edge.sh", "./provision/core/edge.sh",
"./provision/core/firefox.sh", "./provision/core/firefox.sh",
"./provision/core/xcode-postbuild.sh", "./provision/core/xcode-postbuild.sh",
"./provision/core/toolcache.sh",
"./provision/core/pypy.sh", "./provision/core/pypy.sh",
"./provision/core/pipx-packages.sh" "./provision/core/pipx-packages.sh"
],
"environment_vars": [
"GITHUB_FEED_TOKEN={{user `github_feed_token`}}"
] ]
}, },
{ {

View File

@@ -11,7 +11,6 @@
"output_folder": null, "output_folder": null,
"vm_username": null, "vm_username": null,
"vm_password": null, "vm_password": null,
"github_feed_token": null,
"xcode_install_user": null, "xcode_install_user": null,
"xcode_install_password": null, "xcode_install_password": null,
"image_os": "macos11" "image_os": "macos11"
@@ -87,11 +86,6 @@
"source": "./toolsets/toolset-11.0.json", "source": "./toolsets/toolset-11.0.json",
"destination": "~/image-generation/toolset.json" "destination": "~/image-generation/toolset.json"
}, },
{
"type": "file",
"source": "./toolsets/toolcache-11.0.json",
"destination": "~/image-generation/toolcache.json"
},
{ {
"type": "shell", "type": "shell",
"execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}", "execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}",
@@ -185,11 +179,7 @@
"./provision/core/chrome.sh", "./provision/core/chrome.sh",
"./provision/core/edge.sh", "./provision/core/edge.sh",
"./provision/core/firefox.sh", "./provision/core/firefox.sh",
"./provision/core/toolcache.sh",
"./provision/core/pipx-packages.sh" "./provision/core/pipx-packages.sh"
],
"environment_vars": [
"GITHUB_FEED_TOKEN={{user `github_feed_token`}}"
] ]
}, },
{ {

View File

@@ -1,240 +1,243 @@
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1"
$os = Get-OSVersion $os = Get-OSVersion
Describe "Toolcache" { Describe "Toolcache" {
$toolcacheDirectory = Join-Path $env:HOME "hostedtoolcache" $toolcacheDirectory = Join-Path $env:HOME "hostedtoolcache"
$packages = (Get-ToolcachePackages).PSObject.Properties | ForEach-Object { [array]$packages = @()
$packageNameParts = $_.Name.Split("-") if ($os.IsHighSierra) {
return [PSCustomObject] @{ [array]$packages += (Get-ToolcachePackages).PSObject.Properties | ForEach-Object {
ToolName = $packageNameParts[1] $packageNameParts = $_.Name.Split("-")
Arch = $packageNameParts[4] return [PSCustomObject] @{
Versions = $_.Value ToolName = $packageNameParts[1]
} Arch = $packageNameParts[4]
} Versions = $_.Value
}
[array]$packages += Get-ToolsetValue -KeyPath "toolcache" | ForEach-Object { }
return [PSCustomObject] @{ }
ToolName = ($_.name).ToLower()
Arch = $_.arch [array]$packages += Get-ToolsetValue -KeyPath "toolcache" | ForEach-Object {
Versions = $_.versions | ForEach-Object { $_.Replace(".*", "") } return [PSCustomObject] @{
} ToolName = ($_.name).ToLower()
} Arch = $_.arch
Versions = $_.versions | ForEach-Object { $_.Replace(".*", "") }
Context "Python" { }
$pythonDirectory = Join-Path $toolcacheDirectory "Python" }
$pythonPackage = $packages | Where-Object { $_.ToolName -eq "python" } | Select-Object -First 1
$testCase = @{ PythonDirectory = $pythonDirectory } Context "Python" {
$pythonDirectory = Join-Path $toolcacheDirectory "Python"
It "Toolcache directory exists" -TestCases $testCase { $pythonPackage = $packages | Where-Object { $_.ToolName -eq "python" } | Select-Object -First 1
param ( [string] $PythonDirectory ) $testCase = @{ PythonDirectory = $pythonDirectory }
$PythonDirectory | Should -Exist It "Toolcache directory exists" -TestCases $testCase {
} param ( [string] $PythonDirectory )
It "Toolcache directory contains at least one version of Python" -TestCases $testCase { $PythonDirectory | Should -Exist
param ( [string] $PythonDirectory ) }
(Get-ChildItem -Path $PythonDirectory -Directory).Count | Should -BeGreaterThan 0 It "Toolcache directory contains at least one version of Python" -TestCases $testCase {
} param ( [string] $PythonDirectory )
$pythonPackage.Versions | Where-Object { $_ } | ForEach-Object { (Get-ChildItem -Path $PythonDirectory -Directory).Count | Should -BeGreaterThan 0
Context "$_" { }
$versionDirectory = Get-ChildItem -Path $pythonDirectory -Directory -Filter "$_*" | Select-Object -First 1
$pythonBinPath = Join-Path $versionDirectory.FullName $pythonPackage.Arch "python" $pythonPackage.Versions | Where-Object { $_ } | ForEach-Object {
$testCase = @{ PythonVersion = $_; PythonBinPath = $pythonBinPath } Context "$_" {
$versionDirectory = Get-ChildItem -Path $pythonDirectory -Directory -Filter "$_*" | Select-Object -First 1
It "Version" -TestCases $testCase { $pythonBinPath = Join-Path $versionDirectory.FullName $pythonPackage.Arch "python"
param ( $testCase = @{ PythonVersion = $_; PythonBinPath = $pythonBinPath }
[string] $PythonVersion,
[string] $PythonBinPath It "Version" -TestCases $testCase {
) param (
[string] $PythonVersion,
$result = Get-CommandResult "$PythonBinPath --version" [string] $PythonBinPath
$result.Output | Should -BeLike "*$PythonVersion*" )
$result.ExitCode | Should -Be 0
} $result = Get-CommandResult "$PythonBinPath --version"
$result.Output | Should -BeLike "*$PythonVersion*"
It "Run test script" -TestCases $testCase { $result.ExitCode | Should -Be 0
param ( [string] $PythonBinPath ) }
"$PythonBinPath -c 'import sys;print(sys.version)'" | Should -ReturnZeroExitCode It "Run test script" -TestCases $testCase {
} param ( [string] $PythonBinPath )
}
} "$PythonBinPath -c 'import sys;print(sys.version)'" | Should -ReturnZeroExitCode
} }
}
Context "Ruby" { }
$rubyDirectory = Join-Path $toolcacheDirectory "Ruby" }
$rubyPackage = $packages | Where-Object { $_.ToolName -eq "ruby" } | Select-Object -First 1
$testCase = @{ RubyDirectory = $rubyDirectory } Context "Ruby" {
$rubyDirectory = Join-Path $toolcacheDirectory "Ruby"
It "Toolcache directory exists" -TestCases $testCase { $rubyPackage = $packages | Where-Object { $_.ToolName -eq "Ruby" } | Select-Object -First 1
param ( [string] $RubyDirectory ) $testCase = @{ RubyDirectory = $rubyDirectory }
$RubyDirectory | Should -Exist It "Toolcache directory exists" -TestCases $testCase {
} param ( [string] $RubyDirectory )
It "Toolcache directory contains at least one version of Ruby" -TestCases $testCase { $RubyDirectory | Should -Exist
param ( [string] $RubyDirectory ) }
(Get-ChildItem -Path $RubyDirectory -Directory).Count | Should -BeGreaterThan 0 It "Toolcache directory contains at least one version of Ruby" -TestCases $testCase {
} param ( [string] $RubyDirectory )
$rubyPackage.Versions | Where-Object { $_ } | ForEach-Object { (Get-ChildItem -Path $RubyDirectory -Directory).Count | Should -BeGreaterThan 0
Context "$_" { }
$versionDirectory = Get-ChildItem -Path $rubyDirectory -Directory -Filter "$_*" | Select-Object -First 1
$rubyBinPath = Join-Path $versionDirectory.FullName $rubyPackage.Arch "bin" "ruby" $rubyPackage.Versions | Where-Object { $_ } | ForEach-Object {
$testCase = @{ RubyVersion = $_; RubyBinPath = $rubyBinPath } Context "$_" {
$versionDirectory = Get-ChildItem -Path $rubyDirectory -Directory -Filter "$_*" | Select-Object -First 1
It "Version" -TestCases $testCase { $rubyBinPath = Join-Path $versionDirectory.FullName $rubyPackage.Arch "bin" "ruby"
param ( $testCase = @{ RubyVersion = $_; RubyBinPath = $rubyBinPath }
[string] $RubyVersion,
[string] $RubyBinPath It "Version" -TestCases $testCase {
) param (
[string] $RubyVersion,
$result = Get-CommandResult "$RubyBinPath --version" [string] $RubyBinPath
$result.Output | Should -BeLike "*$RubyVersion*" )
$result.ExitCode | Should -Be 0
} $result = Get-CommandResult "$RubyBinPath --version"
$result.Output | Should -BeLike "*$RubyVersion*"
It "Run test script" -TestCases $testCase { $result.ExitCode | Should -Be 0
param ( [string] $RubyBinPath ) }
"$RubyBinPath -e 'puts RUBY_VERSION'" | Should -ReturnZeroExitCode It "Run test script" -TestCases $testCase {
} param ( [string] $RubyBinPath )
}
} "$RubyBinPath -e 'puts RUBY_VERSION'" | Should -ReturnZeroExitCode
} }
Context "PyPy" -Skip:($os.IsBigSur) { }
$pypyDirectory = Join-Path $toolcacheDirectory "PyPy" }
$pypyPackage = $packages | Where-Object { $_.ToolName -eq "pypy" } | Select-Object -First 1 }
$testCase = @{ PypyDirectory = $pypyDirectory } Context "PyPy" -Skip:($os.IsBigSur) {
$pypyDirectory = Join-Path $toolcacheDirectory "PyPy"
It "Toolcache directory exists" -TestCases $testCase { $pypyPackage = $packages | Where-Object { $_.ToolName -eq "pypy" } | Select-Object -First 1
param ( [string] $PypyDirectory ) $testCase = @{ PypyDirectory = $pypyDirectory }
$PypyDirectory | Should -Exist It "Toolcache directory exists" -TestCases $testCase {
} param ( [string] $PypyDirectory )
It "Toolcache directory contains at least one version of PyPy" -TestCases $testCase { $PypyDirectory | Should -Exist
param ( [string] $PypyDirectory ) }
(Get-ChildItem -Path $PypyDirectory -Directory).Count | Should -BeGreaterThan 0 It "Toolcache directory contains at least one version of PyPy" -TestCases $testCase {
} param ( [string] $PypyDirectory )
$pypyPackage.Versions | Where-Object { $_ } | ForEach-Object { (Get-ChildItem -Path $PypyDirectory -Directory).Count | Should -BeGreaterThan 0
Context "$_" { }
$versionDirectory = Get-ChildItem -Path $pypyDirectory -Directory -Filter "$_*" | Select-Object -First 1
$binFilename = If ($_.StartsWith("3")) { "pypy3" } else { "pypy" } $pypyPackage.Versions | Where-Object { $_ } | ForEach-Object {
$pypyBinPath = Join-Path $versionDirectory.FullName $pypyPackage.Arch "bin" $binFilename Context "$_" {
$testCase = @{ PypyVersion = $_; PypyBinPath = $pypyBinPath } $versionDirectory = Get-ChildItem -Path $pypyDirectory -Directory -Filter "$_*" | Select-Object -First 1
$binFilename = If ($_.StartsWith("3")) { "pypy3" } else { "pypy" }
It "Version" -TestCases $testCase { $pypyBinPath = Join-Path $versionDirectory.FullName $pypyPackage.Arch "bin" $binFilename
param ( $testCase = @{ PypyVersion = $_; PypyBinPath = $pypyBinPath }
[string] $PypyVersion,
[string] $PypyBinPath It "Version" -TestCases $testCase {
) param (
[string] $PypyVersion,
$result = Get-CommandResult "$PypyBinPath --version" [string] $PypyBinPath
$result.Output | Should -BeLike "*$PypyVersion*" )
$result.ExitCode | Should -Be 0
} $result = Get-CommandResult "$PypyBinPath --version"
$result.Output | Should -BeLike "*$PypyVersion*"
It "Run test script" -TestCases $testCase { $result.ExitCode | Should -Be 0
param ( [string] $PypyBinPath ) }
"$PypyBinPath -c 'import sys;print(sys.version)'" | Should -ReturnZeroExitCode It "Run test script" -TestCases $testCase {
} param ( [string] $PypyBinPath )
}
} "$PypyBinPath -c 'import sys;print(sys.version)'" | Should -ReturnZeroExitCode
} }
}
Context "Node" -Skip:($os.IsHighSierra) { }
$nodeDirectory = Join-Path $toolcacheDirectory "node" }
$nodePackage = $packages | Where-Object { $_.ToolName -eq "node" } | Select-Object -First 1
$testCase = @{ NodeDirectory = $nodeDirectory } Context "Node" -Skip:($os.IsHighSierra) {
$nodeDirectory = Join-Path $toolcacheDirectory "node"
It "Toolcache directory exists" -TestCases $testCase { $nodePackage = $packages | Where-Object { $_.ToolName -eq "node" } | Select-Object -First 1
param ( [string] $NodeDirectory ) $testCase = @{ NodeDirectory = $nodeDirectory }
$NodeDirectory | Should -Exist It "Toolcache directory exists" -TestCases $testCase {
} param ( [string] $NodeDirectory )
It "Toolcache directory contains at least one version of Node" -TestCases $testCase { $NodeDirectory | Should -Exist
param ( [string] $NodeDirectory ) }
(Get-ChildItem -Path $NodeDirectory -Directory).Count | Should -BeGreaterThan 0 It "Toolcache directory contains at least one version of Node" -TestCases $testCase {
} param ( [string] $NodeDirectory )
$nodePackage.Versions | Where-Object { $_ } | ForEach-Object { (Get-ChildItem -Path $NodeDirectory -Directory).Count | Should -BeGreaterThan 0
Context "$_" { }
$versionDirectory = Get-ChildItem -Path $nodeDirectory -Directory -Filter "$_*" | Select-Object -First 1
$nodeBinPath = Join-Path $versionDirectory.FullName $nodePackage.Arch "bin" "node" $nodePackage.Versions | Where-Object { $_ } | ForEach-Object {
$npmBinPath = Join-Path $versionDirectory.FullName $nodePackage.Arch "bin" "npm" Context "$_" {
$testCase = @{ NodeVersion = $_; NodeBinPath = $nodeBinPath; NpmBinPath = $npmBinPath } $versionDirectory = Get-ChildItem -Path $nodeDirectory -Directory -Filter "$_*" | Select-Object -First 1
$nodeBinPath = Join-Path $versionDirectory.FullName $nodePackage.Arch "bin" "node"
It "Version Node" -TestCases $testCase { $npmBinPath = Join-Path $versionDirectory.FullName $nodePackage.Arch "bin" "npm"
param ( $testCase = @{ NodeVersion = $_; NodeBinPath = $nodeBinPath; NpmBinPath = $npmBinPath }
[string] $NodeVersion,
[string] $NodeBinPath It "Version Node" -TestCases $testCase {
) param (
[string] $NodeVersion,
$result = Get-CommandResult "$NodeBinPath --version" [string] $NodeBinPath
$result.Output | Should -BeLike "*$NodeVersion*" )
$result.ExitCode | Should -Be 0
} $result = Get-CommandResult "$NodeBinPath --version"
$result.Output | Should -BeLike "*$NodeVersion*"
It "Version Npm" -TestCases $testCase { $result.ExitCode | Should -Be 0
param ( [string] $NpmBinPath ) }
"$NpmBinPath --version" | Should -ReturnZeroExitCode It "Version Npm" -TestCases $testCase {
} param ( [string] $NpmBinPath )
It "Run test script" -TestCases $testCase { "$NpmBinPath --version" | Should -ReturnZeroExitCode
param ( [string] $NodeBinPath ) }
"$NodeBinPath -e 'console.log(process.version)'" | Should -ReturnZeroExitCode It "Run test script" -TestCases $testCase {
} param ( [string] $NodeBinPath )
}
} "$NodeBinPath -e 'console.log(process.version)'" | Should -ReturnZeroExitCode
} }
}
Context "Go" -Skip:($os.IsHighSierra) { }
$goDirectory = Join-Path $toolcacheDirectory "go" }
$goPackage = $packages | Where-Object { $_.ToolName -eq "go" } | Select-Object -First 1
$testCase = @{ GoDirectory = $goDirectory } Context "Go" -Skip:($os.IsHighSierra) {
$goDirectory = Join-Path $toolcacheDirectory "go"
It "Toolcache directory exists" -TestCases $testCase { $goPackage = $packages | Where-Object { $_.ToolName -eq "go" } | Select-Object -First 1
param ( [string] $GoDirectory ) $testCase = @{ GoDirectory = $goDirectory }
$GoDirectory | Should -Exist It "Toolcache directory exists" -TestCases $testCase {
} param ( [string] $GoDirectory )
It "Toolcache directory contains at least one version of Go" -TestCases $testCase { $GoDirectory | Should -Exist
param ( [string] $GoDirectory ) }
(Get-ChildItem -Path $GoDirectory -Directory).Count | Should -BeGreaterThan 0 It "Toolcache directory contains at least one version of Go" -TestCases $testCase {
} param ( [string] $GoDirectory )
$goPackage.Versions | Where-Object { $_ } | ForEach-Object { (Get-ChildItem -Path $GoDirectory -Directory).Count | Should -BeGreaterThan 0
Context "$_" { }
$versionDirectory = Get-ChildItem -Path $goDirectory -Directory -Filter "$_*" | Select-Object -First 1
$goBinPath = Join-Path $versionDirectory.FullName $goPackage.Arch "bin" "go" $goPackage.Versions | Where-Object { $_ } | ForEach-Object {
$testCase = @{ GoVersion = $_; GoBinPath = $goBinPath } Context "$_" {
$versionDirectory = Get-ChildItem -Path $goDirectory -Directory -Filter "$_*" | Select-Object -First 1
It "Version Go" -TestCases $testCase { $goBinPath = Join-Path $versionDirectory.FullName $goPackage.Arch "bin" "go"
param ( $testCase = @{ GoVersion = $_; GoBinPath = $goBinPath }
[string] $GoVersion,
[string] $GoBinPath It "Version Go" -TestCases $testCase {
) param (
[string] $GoVersion,
$result = Get-CommandResult "$GoBinPath version" [string] $GoBinPath
$result.Output | Should -BeLike "*$GoVersion*" )
$result.ExitCode | Should -Be 0
} $result = Get-CommandResult "$GoBinPath version"
} $result.Output | Should -BeLike "*$GoVersion*"
} $result.ExitCode | Should -Be 0
} }
}
}
}
} }

View File

@@ -1,8 +0,0 @@
{
"@actions/toolcache-python-macos-1013-x64": [
"2.7", "3.5", "3.6", "3.7", "3.8"
],
"@actions/toolcache-ruby-macos-1013-x64": [
"2.4", "2.5", "2.6", "2.7"
]
}

View File

@@ -1,5 +0,0 @@
{
"@actions/toolcache-ruby-macos-1013-x64": [
"2.4", "2.5", "2.6", "2.7"
]
}

View File

@@ -1,5 +0,0 @@
{
"@actions/toolcache-ruby-macos-1013-x64": [
"2.4", "2.5", "2.6", "2.7"
]
}

View File

@@ -210,6 +210,16 @@
"2.7", "2.7",
"3.6" "3.6"
] ]
},
{
"name": "Ruby",
"arch": "x64",
"versions": [
"2.4.*",
"2.5.*",
"2.6.*",
"2.7.*"
]
} }
], ],
"pipx": [ "pipx": [

View File

@@ -269,6 +269,16 @@
"1.14.*", "1.14.*",
"1.15.*" "1.15.*"
] ]
},
{
"name": "Ruby",
"arch": "x64",
"versions": [
"2.4.*",
"2.5.*",
"2.6.*",
"2.7.*"
]
} }
], ],
"pipx": [ "pipx": [

View File

@@ -190,6 +190,16 @@
"1.14.*", "1.14.*",
"1.15.*" "1.15.*"
] ]
},
{
"name": "Ruby",
"arch": "x64",
"versions": [
"2.4.*",
"2.5.*",
"2.6.*",
"2.7.*"
]
} }
], ],
"pipx": [ "pipx": [

View File

@@ -108,6 +108,16 @@
"versions": [ "versions": [
"1.15.*" "1.15.*"
] ]
},
{
"name": "Ruby",
"arch": "x64",
"versions": [
"2.4.*",
"2.5.*",
"2.6.*",
"2.7.*"
]
} }
], ],
"pipx": [ "pipx": [