name: Unit Tests on: push: branches: [ main ] pull_request: branches: [ main ] 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 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: Build module run: dotnet publish src/PSProxmoxVE/PSProxmoxVE.csproj --configuration Release --framework net9.0 --output ./publish/net9.0 - name: Remove deps.json from publish output run: rm -f ./publish/net9.0/PSProxmoxVE.deps.json - name: Install Pester and deploy module shell: pwsh run: | Install-Module -Name Pester -MinimumVersion 5.0 -Force -Scope AllUsers $modulePath = "/usr/local/share/powershell/Modules/PSProxmoxVE" New-Item -ItemType Directory -Path $modulePath -Force | Out-Null Copy-Item -Path ./publish/net9.0/* -Destination $modulePath -Recurse -Force - name: Create TestResults directory run: mkdir -p TestResults - name: Run Pester tests shell: pwsh env: DOTNET_ROOT: '' DOTNET_MULTILEVEL_LOOKUP: '' 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: Upload test results if: always() uses: actions/upload-artifact@v4 with: name: pester-results-linux-ps7 path: TestResults/