mirror of
https://github.com/GoodOlClint/PSProxmoxVE.git
synced 2026-08-07 04:53:12 +00:00
fix(ci): restore GitHub-hosted runners with deps.json and DOTNET_ROOT fixes
Reverts to GitHub-hosted runner matrix (Windows PS 5.1/7.5, Ubuntu, macOS) with the two critical fixes that resolve System.Runtime 9.0.0.0 assembly loading on PS 7.x: 1. Remove PSProxmoxVE.deps.json from publish output (prevents .NET dependency resolution conflicts with PS's bundled runtime) 2. Unset DOTNET_ROOT/DOTNET_MULTILEVEL_LOOKUP in Pester steps (prevents setup-dotnet from overriding PS's assembly resolution) Both fixes validated in Docker (705/705 tests pass). Adds timeout-minutes: 15 to all jobs to prevent runaway billing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
+41
-16
@@ -7,28 +7,53 @@ on:
|
||||
branches: [ main ]
|
||||
|
||||
jobs:
|
||||
build-and-test:
|
||||
runs-on: [self-hosted, proxmox, integration]
|
||||
build-net48:
|
||||
runs-on: windows-latest
|
||||
timeout-minutes: 15
|
||||
container:
|
||||
image: mcr.microsoft.com/dotnet/sdk:9.0
|
||||
options: --user root
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: '9.0.x'
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore
|
||||
|
||||
- name: Build net9.0
|
||||
run: dotnet build --configuration Release --framework net9.0 --no-restore
|
||||
|
||||
- name: Test net9.0
|
||||
run: dotnet test tests/PSProxmoxVE.Core.Tests/PSProxmoxVE.Core.Tests.csproj --configuration Release --framework net9.0 --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./coverage
|
||||
|
||||
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@v4
|
||||
with:
|
||||
name: coverage-net9
|
||||
name: coverage-net48
|
||||
path: ./coverage
|
||||
|
||||
build-net9:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [windows-latest, ubuntu-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: '9.0.x'
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore
|
||||
- name: Build net9.0
|
||||
run: dotnet build --configuration Release --framework net9.0 --no-restore
|
||||
- name: Test net9.0
|
||||
run: dotnet test tests/PSProxmoxVE.Core.Tests/PSProxmoxVE.Core.Tests.csproj --configuration Release --framework net9.0 --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./coverage
|
||||
- name: Upload coverage
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: coverage-net9-${{ matrix.os }}
|
||||
path: ./coverage
|
||||
|
||||
@@ -8,41 +8,108 @@ on:
|
||||
|
||||
jobs:
|
||||
pester-tests:
|
||||
runs-on: [self-hosted, proxmox, integration]
|
||||
timeout-minutes: 15
|
||||
container:
|
||||
image: mcr.microsoft.com/powershell:7.5-ubuntu-24.04
|
||||
options: --user root
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: windows-latest
|
||||
ps_version: '5.1'
|
||||
framework: net48
|
||||
shell: powershell
|
||||
- os: windows-latest
|
||||
ps_version: '7.5'
|
||||
framework: net9.0
|
||||
shell: pwsh
|
||||
- os: ubuntu-latest
|
||||
ps_version: '7.5'
|
||||
framework: net9.0
|
||||
shell: pwsh
|
||||
- os: macos-latest
|
||||
ps_version: '7.5'
|
||||
framework: net9.0
|
||||
shell: pwsh
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
- name: Install .NET SDK 9.0
|
||||
run: |
|
||||
apt-get update && apt-get install -y wget
|
||||
wget -q https://dot.net/v1/dotnet-install.sh -O /tmp/dotnet-install.sh
|
||||
chmod +x /tmp/dotnet-install.sh
|
||||
/tmp/dotnet-install.sh --channel 9.0 --install-dir /usr/share/dotnet
|
||||
ln -sf /usr/share/dotnet/dotnet /usr/local/bin/dotnet
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: '9.0.x'
|
||||
|
||||
- name: Build module
|
||||
run: dotnet publish src/PSProxmoxVE/PSProxmoxVE.csproj --configuration Release --framework net9.0 --output ./publish/net9.0
|
||||
run: dotnet publish src/PSProxmoxVE/PSProxmoxVE.csproj --configuration Release --framework ${{ matrix.framework }} --output ./publish/${{ matrix.framework }}
|
||||
|
||||
- name: Remove deps.json from publish output
|
||||
run: rm -f ./publish/net9.0/PSProxmoxVE.deps.json
|
||||
shell: bash
|
||||
run: rm -f ./publish/${{ matrix.framework }}/PSProxmoxVE.deps.json
|
||||
|
||||
- name: Install Pester and deploy module
|
||||
- name: Install Pester 5 (PS 5.1)
|
||||
if: matrix.ps_version == '5.1'
|
||||
shell: powershell
|
||||
run: |
|
||||
Install-Module -Name Pester -MinimumVersion 5.0 -Force -Scope CurrentUser -SkipPublisherCheck
|
||||
|
||||
- name: Install Pester 5 (PS 7.x)
|
||||
if: matrix.ps_version != '5.1'
|
||||
shell: pwsh
|
||||
run: |
|
||||
Install-Module -Name Pester -MinimumVersion 5.0 -Force -Scope AllUsers
|
||||
$modulePath = "/usr/local/share/powershell/Modules/PSProxmoxVE"
|
||||
Install-Module -Name Pester -MinimumVersion 5.0 -Force -Scope CurrentUser
|
||||
|
||||
- name: Copy module to module path (PS 5.1)
|
||||
if: matrix.ps_version == '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/net9.0/* -Destination $modulePath -Recurse -Force
|
||||
Copy-Item -Path .\publish\${{ matrix.framework }}\* -Destination $modulePath -Recurse -Force
|
||||
|
||||
- name: Create TestResults directory
|
||||
run: mkdir -p TestResults
|
||||
- name: Copy module to module path (PS 7.x, Windows)
|
||||
if: matrix.ps_version != '5.1' && matrix.os == 'windows-latest'
|
||||
shell: pwsh
|
||||
run: |
|
||||
$modulePath = "$env:USERPROFILE\Documents\PowerShell\Modules\PSProxmoxVE"
|
||||
New-Item -ItemType Directory -Path $modulePath -Force | Out-Null
|
||||
Copy-Item -Path .\publish\${{ matrix.framework }}\* -Destination $modulePath -Recurse -Force
|
||||
|
||||
- name: Run Pester tests
|
||||
- name: Copy module to module path (PS 7.x, non-Windows)
|
||||
if: matrix.ps_version != '5.1' && matrix.os != 'windows-latest'
|
||||
shell: pwsh
|
||||
run: |
|
||||
$modulePath = "$HOME/.local/share/powershell/Modules/PSProxmoxVE"
|
||||
New-Item -ItemType Directory -Path $modulePath -Force | Out-Null
|
||||
Copy-Item -Path ./publish/${{ matrix.framework }}/* -Destination $modulePath -Recurse -Force
|
||||
|
||||
- name: Create TestResults directory (PS 5.1)
|
||||
if: matrix.ps_version == '5.1'
|
||||
shell: powershell
|
||||
run: New-Item -ItemType Directory -Path TestResults -Force | Out-Null
|
||||
|
||||
- name: Create TestResults directory (PS 7.x)
|
||||
if: matrix.ps_version != '5.1'
|
||||
shell: pwsh
|
||||
run: New-Item -ItemType Directory -Path TestResults -Force | Out-Null
|
||||
|
||||
- name: Run Pester tests (PS 5.1)
|
||||
if: matrix.ps_version == '5.1'
|
||||
shell: powershell
|
||||
run: |
|
||||
Import-Module Pester -MinimumVersion 5.0
|
||||
$config = New-PesterConfiguration
|
||||
$config.Run.Path = "tests/PSProxmoxVE.Tests"
|
||||
$config.Run.Exit = $true
|
||||
$config.Filter.ExcludeTag = @("Integration")
|
||||
$config.Output.Verbosity = "Detailed"
|
||||
$config.TestResult.Enabled = $true
|
||||
$config.TestResult.OutputFormat = "NUnitXml"
|
||||
$config.TestResult.OutputPath = "TestResults/pester-results.xml"
|
||||
Invoke-Pester -Configuration $config
|
||||
|
||||
- name: Run Pester tests (PS 7.x)
|
||||
if: matrix.ps_version != '5.1'
|
||||
shell: pwsh
|
||||
env:
|
||||
DOTNET_ROOT: ''
|
||||
@@ -63,5 +130,5 @@ jobs:
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: pester-results-linux-ps7
|
||||
name: pester-results-${{ matrix.os }}-ps${{ matrix.ps_version }}
|
||||
path: TestResults/
|
||||
|
||||
Reference in New Issue
Block a user