f373c0c24b
P0 bugs: - Invoke-CIJob.ps1: skip --depth 1 when $Commit specified (shallow clone + checkout specific commit was silently failing) - Get-BuildArtifacts.ps1: check .Length -eq 0 not rounded sizeKB (false fail on artifacts smaller than 50 bytes) - build-nsis.yml: upgrade upload-artifact v3 -> v4 (v3 deprecated) P0 security: - Remove hardcoded default password CIBuild!ChangeMe2026 from all scripts, README, TODO; prompt Read-Host -AsSecureString at runtime instead - Setup-TemplateVM.ps1: replace `net user $u $p /add` (password in argv / audit log 4688) with New-LocalUser + local ConvertTo-SecureString - Prepare-TemplateSetup.ps1: save and restore WSMan AllowUnencrypted + TrustedHosts in finally block (was permanently mutating host WinRM config) - Setup-TemplateVM.ps1: remove duplicate MaxMemoryPerShellMB (winrm set + Set-Item both setting same value) P1 doc (stale Host-Only / VMnet11 era): - Setup-TemplateVM.ps1: rewrite NETWORK REQUIREMENT block + final steps (system uses VMnet8 NAT permanently, not VMnet11 Host-Only) - Invoke-CIJob.ps1 Phase 1 comment: correct network model - ARCHITECTURE.md: remove Git from toolchain list (not installed); clarify zip-transfer rationale (no PAT in VM, not network isolation) - BEST-PRACTICES.md: rewrite Step 8 as NAT topology verification P1 minor: - Invoke-RemoteBuild.ps1: remove wasted first New-Item (created then immediately removed and recreated) - Wait-VMReady.ps1: remove unused $elapsed; simplify try/catch around native command (exit codes don't throw) - Install-Runner.ps1: add deprecation notice pointing to Setup-Host.ps1 P2 operational: - Add scripts/Cleanup-OrphanedBuildVMs.ps1 with -WhatIf support - Get-BuildArtifacts.ps1 -IncludeLogs: add -Recurse (msbuild logs in subdir) - Add gitea/workflows/lint.yml (PSScriptAnalyzer on .ps1 push/PR) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
56 lines
1.5 KiB
YAML
56 lines
1.5 KiB
YAML
# PSScriptAnalyzer lint — runs on every push/PR that touches PowerShell files.
|
|
# Requires PSScriptAnalyzer installed on the runner host:
|
|
# Install-Module PSScriptAnalyzer -Scope AllUsers -Force
|
|
#
|
|
# Failures block the PR. Fix warnings with:
|
|
# Invoke-ScriptAnalyzer -Path scripts\ -Recurse -Fix
|
|
|
|
name: Lint (PSScriptAnalyzer)
|
|
|
|
on:
|
|
push:
|
|
paths:
|
|
- '**.ps1'
|
|
- '**.psm1'
|
|
pull_request:
|
|
paths:
|
|
- '**.ps1'
|
|
- '**.psm1'
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: windows-build
|
|
timeout-minutes: 10
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 1
|
|
|
|
- name: Run PSScriptAnalyzer
|
|
shell: pwsh
|
|
run: |
|
|
$ErrorActionPreference = 'Stop'
|
|
|
|
if (-not (Get-Module -ListAvailable PSScriptAnalyzer)) {
|
|
Write-Host "Installing PSScriptAnalyzer..."
|
|
Install-Module PSScriptAnalyzer -Scope CurrentUser -Force -AllowClobber
|
|
}
|
|
|
|
$paths = @('scripts', 'template', 'runner', 'Setup-Host.ps1')
|
|
$results = $paths | ForEach-Object {
|
|
if (Test-Path $_) {
|
|
Invoke-ScriptAnalyzer -Path $_ -Recurse -Severity Error,Warning
|
|
}
|
|
}
|
|
|
|
if ($results) {
|
|
$results | Format-Table -AutoSize
|
|
Write-Error "PSScriptAnalyzer found $($results.Count) issue(s). Fix before merging."
|
|
exit 1
|
|
}
|
|
else {
|
|
Write-Host "PSScriptAnalyzer: no issues found."
|
|
}
|