mirror of
https://code.forgejo.org/actions/go-versions
synced 2025-06-09 03:52:24 +02:00
Update to Pester 5
This commit is contained in:
parent
e82dce5a38
commit
fdef7843ee
2 changed files with 19 additions and 21 deletions
11
.github/workflows/build-go-packages.yml
vendored
11
.github/workflows/build-go-packages.yml
vendored
|
@ -14,6 +14,10 @@ on:
|
||||||
env:
|
env:
|
||||||
VERSION: ${{ github.event.inputs.VERSION }}
|
VERSION: ${{ github.event.inputs.VERSION }}
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: pwsh
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build_go:
|
build_go:
|
||||||
name: Build Go ${{ github.event.inputs.VERSION }} [${{ matrix.platform }}]
|
name: Build Go ${{ github.event.inputs.VERSION }} [${{ matrix.platform }}]
|
||||||
|
@ -45,9 +49,6 @@ jobs:
|
||||||
name: Test Go ${{ github.event.inputs.VERSION }} [${{ matrix.platform }}]
|
name: Test Go ${{ github.event.inputs.VERSION }} [${{ matrix.platform }}]
|
||||||
needs: build_go
|
needs: build_go
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
shell: pwsh
|
|
||||||
env:
|
env:
|
||||||
ARTIFACT_NAME: go-${{ github.event.inputs.VERSION }}-${{ matrix.platform }}-x64
|
ARTIFACT_NAME: go-${{ github.event.inputs.VERSION }}-${{ matrix.platform }}-x64
|
||||||
strategy:
|
strategy:
|
||||||
|
@ -105,7 +106,7 @@ jobs:
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: |
|
run: |
|
||||||
Install-Module Pester -Force -Scope CurrentUser -RequiredVersion 4.10.1
|
Install-Module Pester -Force -Scope CurrentUser
|
||||||
Import-Module Pester
|
Import-Module Pester
|
||||||
$pesterParams = @{
|
$pesterParams = @{
|
||||||
Path="./Go.Tests.ps1";
|
Path="./Go.Tests.ps1";
|
||||||
|
@ -113,7 +114,7 @@ jobs:
|
||||||
Version="$env:VERSION";
|
Version="$env:VERSION";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Invoke-Pester -Script $pesterParams -EnableExit
|
Invoke-Pester -Script ./Go.Tests.ps1 -EnableExit
|
||||||
working-directory: ./tests
|
working-directory: ./tests
|
||||||
|
|
||||||
publish_release:
|
publish_release:
|
||||||
|
|
|
@ -1,12 +1,8 @@
|
||||||
param (
|
|
||||||
[version] [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()]
|
|
||||||
$Version
|
|
||||||
)
|
|
||||||
|
|
||||||
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")
|
||||||
|
|
||||||
function Get-UseGoLogs {
|
BeforeAll {
|
||||||
|
function Get-UseNodeLogs {
|
||||||
# GitHub Windows images don't have `HOME` variable
|
# GitHub Windows images don't have `HOME` variable
|
||||||
$homeDir = $env:HOME ?? $env:HOMEDRIVE
|
$homeDir = $env:HOME ?? $env:HOMEDRIVE
|
||||||
$logsFolderPath = Join-Path -Path $homeDir -ChildPath "runners/*/_diag/pages" -Resolve
|
$logsFolderPath = Join-Path -Path $homeDir -ChildPath "runners/*/_diag/pages" -Resolve
|
||||||
|
@ -16,6 +12,7 @@ function Get-UseGoLogs {
|
||||||
return $logContent -match "setup-go@v"
|
return $logContent -match "setup-go@v"
|
||||||
} | Select-Object -First 1
|
} | Select-Object -First 1
|
||||||
return $useGoLogFile.Fullname
|
return $useGoLogFile.Fullname
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Describe "Go" {
|
Describe "Go" {
|
||||||
|
@ -25,9 +22,9 @@ Describe "Go" {
|
||||||
|
|
||||||
It "version is correct" {
|
It "version is correct" {
|
||||||
$versionOutput = Invoke-Expression -Command "go version"
|
$versionOutput = Invoke-Expression -Command "go version"
|
||||||
$finalVersion = $Version.ToString(3)
|
$finalVersion = $env:VERSION.ToString(3)
|
||||||
If ($Version.Build -eq "0"){
|
If ($Version.Build -eq "0"){
|
||||||
$finalVersion = $Version.ToString(2)
|
$finalVersion = $env:VERSION.ToString(2)
|
||||||
}
|
}
|
||||||
$versionOutput | Should -Match $finalVersion
|
$versionOutput | Should -Match $finalVersion
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue