Repository navigation
54 lines (54 loc) · 2.49 KB
/
Copy pathpowershell.yml
File metadata and controls
54 lines (54 loc) · 2.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: PowerShell validation
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: validation-${{ github.ref }}
cancel-in-progress: true
jobs:
validate:
runs-on: windows-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
edition: [Desktop, Core]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install pinned test tools
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
if (-not (Get-PackageProvider -Name NuGet -ListAvailable -ErrorAction SilentlyContinue)) {
$null = Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force -Scope CurrentUser
}
$moduleRoot = Join-Path $env:RUNNER_TEMP modules
$null = New-Item -ItemType Directory -Path $moduleRoot -Force
Save-Module Pester -RequiredVersion 5.7.1 -Path $moduleRoot -Force -Repository PSGallery
Save-Module PSScriptAnalyzer -RequiredVersion 1.24.0 -Path $moduleRoot -Force -Repository PSGallery
"TOOLKIT_TEST_MODULES=$moduleRoot" | Out-File $env:GITHUB_ENV -Encoding utf8 -Append
$archive = Join-Path $env:RUNNER_TEMP sqlite.zip
Invoke-WebRequest https://www.sqlite.org/2026/sqlite-tools-win-x64-3540100.zip -OutFile $archive -UseBasicParsing
if ((Get-FileHash $archive -Algorithm SHA256).Hash -ne 'FB20997ADE5583A5FBF1E36DB7BC3C82C9416B3F314F16961E1572AA4E49487D') { throw 'SQLite checksum mismatch' }
$directory = Join-Path $env:RUNNER_TEMP sqlite
Expand-Archive $archive -DestinationPath $directory -Force
"TOOLKIT_TEST_SQLITE=$directory\sqlite3.exe" | Out-File $env:GITHUB_ENV -Encoding utf8 -Append
- name: Parse, analyze and run offline regression tests
shell: pwsh
env:
TOOLKIT_EDITION: ${{ matrix.edition }}
run: |
$env:PSModulePath = $env:TOOLKIT_TEST_MODULES + [IO.Path]::PathSeparator + $env:PSModulePath
if ($env:TOOLKIT_EDITION -eq 'Desktop') {
& powershell.exe -NoProfile -ExecutionPolicy Bypass -File ./tools/Test-Repository.ps1
} else {
& pwsh -NoProfile -File ./tools/Test-Repository.ps1
}
if ($LASTEXITCODE -ne 0) { throw "Validation failed in $env:TOOLKIT_EDITION" }