1
0
Fork 0
mirror of https://code.forgejo.org/actions/go-versions synced 2025-03-15 06:36:58 +01:00

Merge branch 'actions:main' into main

This commit is contained in:
gowridurgad 2024-07-24 18:58:40 +05:30 committed by GitHub
commit 17a6de1e43
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 104 additions and 4 deletions

View file

@ -1,7 +1,9 @@
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")
BeforeAll { Describe "Go" {
BeforeAll {
Set-Location -Path "source" Set-Location -Path "source"
$sourceLocation = Get-Location $sourceLocation = Get-Location
@ -18,7 +20,6 @@ BeforeAll {
} }
} }
Describe "Go" {
It "is available" { It "is available" {
"go version" | Should -ReturnZeroExitCode "go version" | Should -ReturnZeroExitCode
} }
@ -44,12 +45,25 @@ Describe "Go" {
} }
It "cached version is used without downloading" { It "cached version is used without downloading" {
if ($env:RUNNER_TYPE -eq "self-hosted") {
# Get the installed version of Go
$goVersion = Invoke-Expression "go version"
# Check if Go is installed
$goVersion | Should -Not -BeNullOrEmpty
# Check if the installed version of Go is the expected version
$installedVersion = $goVersion -split " " | Select-Object -Index 2
$installedVersion = $installedVersion -replace "go", "" -replace "v", ""
$expectedVersion = $env:VERSION -replace ".0", ""
$installedVersion | Should -BeLike "$expectedVersion*"
}else {
# Analyze output of previous steps to check if Go was consumed from cache or downloaded # Analyze output of previous steps to check if Go was consumed from cache or downloaded
$useGoLogFile = Get-UseGoLogs $useGoLogFile = Get-UseGoLogs
$useGoLogFile | Should -Exist $useGoLogFile | Should -Exist
$useGoLogContent = Get-Content $useGoLogFile -Raw $useGoLogContent = Get-Content $useGoLogFile -Raw
$useGoLogContent | Should -Match "Found in cache" $useGoLogContent | Should -Match "Found in cache"
} }
}
It "Run simple code" { It "Run simple code" {
@ -81,4 +95,4 @@ Describe "Go" {
if ($IsWindows) { $compiledPackageName += ".exe" } if ($IsWindows) { $compiledPackageName += ".exe" }
(Resolve-Path "./$compiledPackageName").Path | Should -ReturnZeroExitCode (Resolve-Path "./$compiledPackageName").Path | Should -ReturnZeroExitCode
} }
} }

View file

@ -1,4 +1,47 @@
[ [
{
"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,
@ -190,6 +233,49 @@
} }
] ]
}, },
{
"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,