mirror of
https://github.com/GoodOlClint/PSProxmoxVE.git
synced 2026-08-07 13:03:12 +00:00
fix: remediate findings F045, F047, F048, F064, F070, F071, F076-F079
Phase 1 — Trivial fixes: - F071: Add Uri.EscapeDataString to GetPveTemplateCmdlet node path - F077: Add ValidateRange(100, 999999999) to GetPveTaskListCmdlet.VmId - F076: Create .github/dependabot.yml (nuget + github-actions, weekly) - F079: Fix unit-tests.yml dotnet SDK from 9.0.x to 10.0.x - F048: Mark wont_fix — sync-over-async accepted for PS 5.1 compat Phase 2 — Framework targeting (D009 compliance): - F047: Reduce publishable csproj to netstandard2.0 only, remove all #if NET48/NETSTANDARD2_0 conditionals from PveHttpClient.cs, restructure build.yml for netstandard2.0 publish + net10.0/net48 tests - F064: Resolved by F047 — SMA 7.5.0 ItemGroup removed with net10.0 TFM - F070: Add PS 5.1 smoke-test job to publish.yml (windows-latest) Phase 3 — IPveHttpClient interface extraction (F045): - Extract IPveHttpClient interface from PveHttpClient - Add constructor injection to all 14 service classes - Services use injected client when available, create+dispose when not Phase 4 — Service unit tests (F078): - 196 new xUnit tests across 10 service test files - All services tested via Moq-mocked IPveHttpClient - Total test count: 382 (was 186) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
+19
-33
@@ -7,53 +7,39 @@ on:
|
||||
branches: [ main ]
|
||||
|
||||
jobs:
|
||||
build-net48:
|
||||
runs-on: windows-latest
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: '10.0.x'
|
||||
- name: Restore dependencies
|
||||
run: |
|
||||
dotnet restore src/PSProxmoxVE/PSProxmoxVE.csproj
|
||||
dotnet restore tests/PSProxmoxVE.Core.Tests/PSProxmoxVE.Core.Tests.csproj
|
||||
- name: Build net48
|
||||
run: |
|
||||
dotnet build src/PSProxmoxVE/PSProxmoxVE.csproj --configuration Release --framework net48 --no-restore
|
||||
dotnet build tests/PSProxmoxVE.Core.Tests/PSProxmoxVE.Core.Tests.csproj --configuration Release --framework net48 --no-restore
|
||||
- name: Test net48
|
||||
run: dotnet test tests/PSProxmoxVE.Core.Tests/PSProxmoxVE.Core.Tests.csproj --configuration Release --framework net48 --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./coverage
|
||||
- name: Upload coverage
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: coverage-net48
|
||||
path: ./coverage
|
||||
|
||||
build-net10:
|
||||
build-and-test:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [windows-latest, ubuntu-latest]
|
||||
include:
|
||||
- os: windows-latest
|
||||
test-framework: net48
|
||||
- os: windows-latest
|
||||
test-framework: net10.0
|
||||
- os: ubuntu-latest
|
||||
test-framework: net10.0
|
||||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: '10.0.x'
|
||||
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore
|
||||
- name: Build net10.0
|
||||
run: dotnet build --configuration Release --framework net10.0 --no-restore
|
||||
- name: Test net10.0
|
||||
run: dotnet test tests/PSProxmoxVE.Core.Tests/PSProxmoxVE.Core.Tests.csproj --configuration Release --framework net10.0 --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./coverage
|
||||
|
||||
- name: Build solution
|
||||
run: dotnet build --configuration Release --no-restore
|
||||
|
||||
- name: Run xUnit tests
|
||||
run: dotnet test tests/PSProxmoxVE.Core.Tests/PSProxmoxVE.Core.Tests.csproj --configuration Release --framework ${{ matrix.test-framework }} --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./coverage
|
||||
|
||||
- name: Upload coverage
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: coverage-net10-${{ matrix.os }}
|
||||
name: coverage-${{ matrix.test-framework }}-${{ matrix.os }}
|
||||
path: ./coverage
|
||||
|
||||
@@ -9,9 +9,9 @@ permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
timeout-minutes: 10
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
@@ -21,16 +21,61 @@ jobs:
|
||||
with:
|
||||
dotnet-version: '10.0.x'
|
||||
|
||||
- name: Extract version from tag
|
||||
id: version
|
||||
run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Build module
|
||||
run: dotnet publish src/PSProxmoxVE/PSProxmoxVE.csproj --configuration Release --framework netstandard2.0 --output ./publish/netstandard2.0
|
||||
run: dotnet publish src/PSProxmoxVE/PSProxmoxVE.csproj --configuration Release --output ./publish/netstandard2.0
|
||||
|
||||
- name: Clean publish output
|
||||
run: rm -f ./publish/netstandard2.0/*.deps.json ./publish/netstandard2.0/*.runtimeconfig.json
|
||||
|
||||
- name: Upload build artifact
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: module-netstandard2.0
|
||||
path: ./publish/netstandard2.0/
|
||||
|
||||
smoke-test-ps51:
|
||||
needs: build
|
||||
runs-on: windows-latest
|
||||
timeout-minutes: 10
|
||||
|
||||
steps:
|
||||
- name: Download module artifact
|
||||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
name: module-netstandard2.0
|
||||
path: ./publish/netstandard2.0/
|
||||
|
||||
- name: Import module on Windows PowerShell 5.1
|
||||
shell: powershell
|
||||
run: |
|
||||
$modulePath = "$env:USERPROFILE\Documents\WindowsPowerShell\Modules\PSProxmoxVE"
|
||||
New-Item -ItemType Directory -Path $modulePath -Force | Out-Null
|
||||
Copy-Item -Path .\publish\netstandard2.0\* -Destination $modulePath -Recurse -Force
|
||||
Import-Module PSProxmoxVE -Force -ErrorAction Stop
|
||||
$commands = Get-Command -Module PSProxmoxVE
|
||||
Write-Host "PS 5.1 smoke test: module loaded with $($commands.Count) commands"
|
||||
if ($commands.Count -lt 150) {
|
||||
throw "Expected at least 150 commands, got $($commands.Count)"
|
||||
}
|
||||
|
||||
publish:
|
||||
needs: [build, smoke-test-ps51]
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
- name: Download module artifact
|
||||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
name: module-netstandard2.0
|
||||
path: ./publish/netstandard2.0/
|
||||
|
||||
- name: Extract version from tag
|
||||
id: version
|
||||
run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Update module version in manifest
|
||||
shell: pwsh
|
||||
run: |
|
||||
@@ -42,11 +87,7 @@ jobs:
|
||||
$content = $content -replace "ModuleVersion\s*=\s*'[^']*'", "ModuleVersion = '$moduleVersion'"
|
||||
Set-Content $manifestPath $content
|
||||
|
||||
- name: Install PowerShell and Pester
|
||||
shell: pwsh
|
||||
run: Install-Module -Name Pester -MinimumVersion 5.0 -Force -Scope CurrentUser
|
||||
|
||||
- name: Test module loads
|
||||
- name: Test module loads on PS 7.x
|
||||
shell: pwsh
|
||||
run: |
|
||||
$modulePath = "$HOME/.local/share/powershell/Modules/PSProxmoxVE"
|
||||
|
||||
@@ -28,7 +28,7 @@ jobs:
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: '9.0.x'
|
||||
dotnet-version: '10.0.x'
|
||||
|
||||
- name: Build module
|
||||
run: dotnet publish src/PSProxmoxVE/PSProxmoxVE.csproj --configuration Release --framework ${{ matrix.framework }} --output ./publish/${{ matrix.framework }}
|
||||
|
||||
Reference in New Issue
Block a user