Compare commits

..

7 Commits

Author SHA1 Message Date
aparnajyothi-y
de2c2ba36e Update Go.Tests.ps1 2024-06-28 16:44:00 +05:30
aparnajyothi-y
e60f915e0b Update Go.Tests.ps1 2024-06-28 16:23:31 +05:30
aparnajyothi-y
ba76e8ae2e Update Go.Tests.ps1 2024-06-28 16:19:28 +05:30
aparnajyothi-y
fb117ec42a Update Go.Tests.ps1 2024-06-28 16:06:21 +05:30
aparnajyothi-y
0f6d2a4392 Update Go.Tests.ps1 2024-06-28 16:01:13 +05:30
aparnajyothi-y
5fadb88d54 Update build-go-packages.yml 2024-06-28 15:51:04 +05:30
aparnajyothi-y
611b36edb5 cache test update for selfhosted runner 2024-06-28 15:50:05 +05:30
4 changed files with 31 additions and 248 deletions

View File

@@ -23,7 +23,7 @@ on:
jobs: jobs:
go: go:
name: Go name: Go
uses: actions/versions-package-tools/.github/workflows/build-tool-packages.yml@main uses: actions/versions-package-tools/.github/workflows/build-tool-packages.yml@test-arm64
with: with:
tool-name: "go" tool-name: "go"
tool-version: ${{ inputs.VERSION || '1.19.0' }} tool-version: ${{ inputs.VERSION || '1.19.0' }}

View File

@@ -13,4 +13,4 @@ jobs:
name: CodeQL analysis name: CodeQL analysis
uses: actions/reusable-workflows/.github/workflows/codeql-analysis.yml@main uses: actions/reusable-workflows/.github/workflows/codeql-analysis.yml@main
with: with:
languages: '["go"]' languages: "['go']"

View File

@@ -1,9 +1,7 @@
Import-Module (Join-Path $PSScriptRoot "../helpers/pester-extensions.psm1") Import-Module (Join-Path $PSScriptRoot "../helpers/pester-extensions.psm1")
Import-Module (Join-Path $PSScriptRoot "../helpers/common-helpers.psm1") Import-Module (Join-Path $PSScriptRoot "../helpers/common-helpers.psm1")
Describe "Go" { BeforeAll {
BeforeAll {
Set-Location -Path "source" Set-Location -Path "source"
$sourceLocation = Get-Location $sourceLocation = Get-Location
@@ -20,19 +18,25 @@ Describe "Go" {
} }
} }
Describe "Go" {
It "is available" { It "is available" {
"go version" | Should -ReturnZeroExitCode "go version" | Should -ReturnZeroExitCode
} }
It "version is correct" { It "version is correct" {
[version]$Version = $env:VERSION [version]$Version = $env:VERSION
$versionOutput = Invoke-Expression -Command "go version" $versionOutput = Invoke-Expression -Command "go version"
$finalVersion = $Version.ToString(3)
If ($Version.Build -eq "0"){ # Extract only the version number from the go version command output.
$finalVersion = $Version.ToString(2) $installedVersion = ($versionOutput -split " ")[2] -replace "go", "" -replace "v", ""
}
$versionOutput | Should -Match $finalVersion $finalVersion = $Version.ToString(3)
If ($Version.Build -eq "0"){
$finalVersion = $Version.ToString(2)
} }
$installedVersion | Should -Match $finalVersion
}
It "is used from tool-cache" { It "is used from tool-cache" {
$goPath = (Get-Command "go").Path $goPath = (Get-Command "go").Path
@@ -44,26 +48,20 @@ Describe "Go" {
$goPath.startsWith($expectedPath) | Should -BeTrue -Because "'$goPath' is not started with '$expectedPath'" $goPath.startsWith($expectedPath) | Should -BeTrue -Because "'$goPath' is not started with '$expectedPath'"
} }
It "cached version is used without downloading" { if ($env:RUNNER_TYPE -eq "GitHub") {
# Analyze output of previous steps to check if Node.js was consumed from cache or downloaded
if ($env:RUNNER_TYPE -eq "self-hosted") { $useNodeLogFile = Get-UseNodeLogs
# Get the installed version of Go $useNodeLogFile | Should -Exist
$goVersion = Invoke-Expression "go version" $useNodeLogContent = Get-Content $useNodeLogFile -Raw
# Check if Go is installed $useNodeLogContent | Should -Match "Found in cache"
$goVersion | Should -Not -BeNullOrEmpty } else {
# Check if the installed version of Go is the expected version # Get the installed version of Node.js
$installedVersion = $goVersion -split " " | Select-Object -Index 2 $nodeVersion = Invoke-Expression "node --version"
$installedVersion = $installedVersion -replace "go", "" -replace "v", "" # Check if Node.js is installed
$expectedVersion = $env:VERSION -replace ".0", "" $nodeVersion | Should -Not -BeNullOrEmpty
$installedVersion | Should -BeLike "$expectedVersion*" # Check if the installed version of Node.js is the expected version
}else { $nodeVersion | Should -Match $env:VERSION
# Analyze output of previous steps to check if Go was consumed from cache or downloaded }
$useGoLogFile = Get-UseGoLogs
$useGoLogFile | Should -Exist
$useGoLogContent = Get-Content $useGoLogFile -Raw
$useGoLogContent | Should -Match "Found in cache"
}
}
It "Run simple code" { It "Run simple code" {

View File

@@ -1,133 +1,4 @@
[ [
{
"version": "1.23.0",
"stable": true,
"release_url": "https://github.com/actions/go-versions/releases/tag/1.23.0-10380775229",
"files": [
{
"filename": "go-1.23.0-darwin-arm64.tar.gz",
"arch": "arm64",
"platform": "darwin",
"download_url": "https://github.com/actions/go-versions/releases/download/1.23.0-10380775229/go-1.23.0-darwin-arm64.tar.gz"
},
{
"filename": "go-1.23.0-darwin-x64.tar.gz",
"arch": "x64",
"platform": "darwin",
"download_url": "https://github.com/actions/go-versions/releases/download/1.23.0-10380775229/go-1.23.0-darwin-x64.tar.gz"
},
{
"filename": "go-1.23.0-linux-arm64.tar.gz",
"arch": "arm64",
"platform": "linux",
"download_url": "https://github.com/actions/go-versions/releases/download/1.23.0-10380775229/go-1.23.0-linux-arm64.tar.gz"
},
{
"filename": "go-1.23.0-linux-x64.tar.gz",
"arch": "x64",
"platform": "linux",
"download_url": "https://github.com/actions/go-versions/releases/download/1.23.0-10380775229/go-1.23.0-linux-x64.tar.gz"
},
{
"filename": "go-1.23.0-win32-arm64.zip",
"arch": "arm64",
"platform": "win32",
"download_url": "https://github.com/actions/go-versions/releases/download/1.23.0-10380775229/go-1.23.0-win32-arm64.zip"
},
{
"filename": "go-1.23.0-win32-x64.zip",
"arch": "x64",
"platform": "win32",
"download_url": "https://github.com/actions/go-versions/releases/download/1.23.0-10380775229/go-1.23.0-win32-x64.zip"
}
]
},
{
"version": "1.22.6",
"stable": true,
"release_url": "https://github.com/actions/go-versions/releases/tag/1.22.6-10277903759",
"files": [
{
"filename": "go-1.22.6-darwin-arm64.tar.gz",
"arch": "arm64",
"platform": "darwin",
"download_url": "https://github.com/actions/go-versions/releases/download/1.22.6-10277903759/go-1.22.6-darwin-arm64.tar.gz"
},
{
"filename": "go-1.22.6-darwin-x64.tar.gz",
"arch": "x64",
"platform": "darwin",
"download_url": "https://github.com/actions/go-versions/releases/download/1.22.6-10277903759/go-1.22.6-darwin-x64.tar.gz"
},
{
"filename": "go-1.22.6-linux-arm64.tar.gz",
"arch": "arm64",
"platform": "linux",
"download_url": "https://github.com/actions/go-versions/releases/download/1.22.6-10277903759/go-1.22.6-linux-arm64.tar.gz"
},
{
"filename": "go-1.22.6-linux-x64.tar.gz",
"arch": "x64",
"platform": "linux",
"download_url": "https://github.com/actions/go-versions/releases/download/1.22.6-10277903759/go-1.22.6-linux-x64.tar.gz"
},
{
"filename": "go-1.22.6-win32-arm64.zip",
"arch": "arm64",
"platform": "win32",
"download_url": "https://github.com/actions/go-versions/releases/download/1.22.6-10277903759/go-1.22.6-win32-arm64.zip"
},
{
"filename": "go-1.22.6-win32-x64.zip",
"arch": "x64",
"platform": "win32",
"download_url": "https://github.com/actions/go-versions/releases/download/1.22.6-10277903759/go-1.22.6-win32-x64.zip"
}
]
},
{
"version": "1.22.5",
"stable": true,
"release_url": "https://github.com/actions/go-versions/releases/tag/1.22.5-9771837482",
"files": [
{
"filename": "go-1.22.5-darwin-arm64.tar.gz",
"arch": "arm64",
"platform": "darwin",
"download_url": "https://github.com/actions/go-versions/releases/download/1.22.5-9771837482/go-1.22.5-darwin-arm64.tar.gz"
},
{
"filename": "go-1.22.5-darwin-x64.tar.gz",
"arch": "x64",
"platform": "darwin",
"download_url": "https://github.com/actions/go-versions/releases/download/1.22.5-9771837482/go-1.22.5-darwin-x64.tar.gz"
},
{
"filename": "go-1.22.5-linux-arm64.tar.gz",
"arch": "arm64",
"platform": "linux",
"download_url": "https://github.com/actions/go-versions/releases/download/1.22.5-9771837482/go-1.22.5-linux-arm64.tar.gz"
},
{
"filename": "go-1.22.5-linux-x64.tar.gz",
"arch": "x64",
"platform": "linux",
"download_url": "https://github.com/actions/go-versions/releases/download/1.22.5-9771837482/go-1.22.5-linux-x64.tar.gz"
},
{
"filename": "go-1.22.5-win32-arm64.zip",
"arch": "arm64",
"platform": "win32",
"download_url": "https://github.com/actions/go-versions/releases/download/1.22.5-9771837482/go-1.22.5-win32-arm64.zip"
},
{
"filename": "go-1.22.5-win32-x64.zip",
"arch": "x64",
"platform": "win32",
"download_url": "https://github.com/actions/go-versions/releases/download/1.22.5-9771837482/go-1.22.5-win32-x64.zip"
}
]
},
{ {
"version": "1.22.4", "version": "1.22.4",
"stable": true, "stable": true,
@@ -319,92 +190,6 @@
} }
] ]
}, },
{
"version": "1.21.13",
"stable": true,
"release_url": "https://github.com/actions/go-versions/releases/tag/1.21.13-10277905115",
"files": [
{
"filename": "go-1.21.13-darwin-arm64.tar.gz",
"arch": "arm64",
"platform": "darwin",
"download_url": "https://github.com/actions/go-versions/releases/download/1.21.13-10277905115/go-1.21.13-darwin-arm64.tar.gz"
},
{
"filename": "go-1.21.13-darwin-x64.tar.gz",
"arch": "x64",
"platform": "darwin",
"download_url": "https://github.com/actions/go-versions/releases/download/1.21.13-10277905115/go-1.21.13-darwin-x64.tar.gz"
},
{
"filename": "go-1.21.13-linux-arm64.tar.gz",
"arch": "arm64",
"platform": "linux",
"download_url": "https://github.com/actions/go-versions/releases/download/1.21.13-10277905115/go-1.21.13-linux-arm64.tar.gz"
},
{
"filename": "go-1.21.13-linux-x64.tar.gz",
"arch": "x64",
"platform": "linux",
"download_url": "https://github.com/actions/go-versions/releases/download/1.21.13-10277905115/go-1.21.13-linux-x64.tar.gz"
},
{
"filename": "go-1.21.13-win32-arm64.zip",
"arch": "arm64",
"platform": "win32",
"download_url": "https://github.com/actions/go-versions/releases/download/1.21.13-10277905115/go-1.21.13-win32-arm64.zip"
},
{
"filename": "go-1.21.13-win32-x64.zip",
"arch": "x64",
"platform": "win32",
"download_url": "https://github.com/actions/go-versions/releases/download/1.21.13-10277905115/go-1.21.13-win32-x64.zip"
}
]
},
{
"version": "1.21.12",
"stable": true,
"release_url": "https://github.com/actions/go-versions/releases/tag/1.21.12-9771838613",
"files": [
{
"filename": "go-1.21.12-darwin-arm64.tar.gz",
"arch": "arm64",
"platform": "darwin",
"download_url": "https://github.com/actions/go-versions/releases/download/1.21.12-9771838613/go-1.21.12-darwin-arm64.tar.gz"
},
{
"filename": "go-1.21.12-darwin-x64.tar.gz",
"arch": "x64",
"platform": "darwin",
"download_url": "https://github.com/actions/go-versions/releases/download/1.21.12-9771838613/go-1.21.12-darwin-x64.tar.gz"
},
{
"filename": "go-1.21.12-linux-arm64.tar.gz",
"arch": "arm64",
"platform": "linux",
"download_url": "https://github.com/actions/go-versions/releases/download/1.21.12-9771838613/go-1.21.12-linux-arm64.tar.gz"
},
{
"filename": "go-1.21.12-linux-x64.tar.gz",
"arch": "x64",
"platform": "linux",
"download_url": "https://github.com/actions/go-versions/releases/download/1.21.12-9771838613/go-1.21.12-linux-x64.tar.gz"
},
{
"filename": "go-1.21.12-win32-arm64.zip",
"arch": "arm64",
"platform": "win32",
"download_url": "https://github.com/actions/go-versions/releases/download/1.21.12-9771838613/go-1.21.12-win32-arm64.zip"
},
{
"filename": "go-1.21.12-win32-x64.zip",
"arch": "x64",
"platform": "win32",
"download_url": "https://github.com/actions/go-versions/releases/download/1.21.12-9771838613/go-1.21.12-win32-x64.zip"
}
]
},
{ {
"version": "1.21.11", "version": "1.21.11",
"stable": true, "stable": true,