Team Ai
Datasetpublic

MegaBites-AI/Windows-powershell

sourceHugging Facemitupdated 6mo agoView on Hugging Face
0likes372downloads
action.yml108 linesDownload Raw Back to windows
1name: windows_test2description: 'Test PowerShell on Windows'3 4inputs:5  purpose:6    required: false7    default: ''8    type: string9  tagSet:10    required: false11    default: CI12    type: string13  ctrfFolder:14    required: false15    default: ctrf16    type: string17  GITHUB_TOKEN:18    description: 'GitHub token for API authentication'19    required: true20 21runs:22  using: composite23  steps:24  - name: Capture Environment25    if: success() || failure()26    run: |-27      Import-Module ./tools/ci.psm128      Show-Environment29    shell: pwsh30 31  - name: Download Build Artifacts32    uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.033    with:34      path: "${{ github.workspace }}"35 36  - name: Capture Artifacts Directory37    continue-on-error: true38    run: |-39      Import-Module ./build.psm140      Write-LogGroupStart -Title 'Artifacts Directory'41      Get-ChildItem "${{ github.workspace }}/build/*" -Recurse42      Write-LogGroupEnd -Title 'Artifacts Directory'43    shell: pwsh44 45  - uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.146    with:47      global-json-file: .\global.json48 49  - name: Get Latest DSC Package Version50    shell: pwsh51    run: |-52      Import-Module .\.github\workflows\GHWorkflowHelper\GHWorkflowHelper.psm153      $headers = @{54        Authorization = "Bearer ${{ inputs.GITHUB_TOKEN }}"55      }56      $releases = Invoke-RestMethod -Uri "https://api.github.com/repos/PowerShell/Dsc/releases" -Headers $headers57      $latestRelease = $releases | Where-Object { $v = $_.name.trim("v"); $semVer = [System.Management.Automation.SemanticVersion]::new($v); if ($semVer.Major -eq 3 -and $semVer.Minor -ge 2) { $_ } } | Select-Object -First 158      $latestVersion = $latestRelease.tag_name.TrimStart("v")59      Write-Host "Latest DSC Version: $latestVersion"60 61      $downloadUrl = $latestRelease.assets | Where-Object { $_.name -like "DSC-*-x86_64-pc-windows-msvc.zip" } | Select-Object -First 1 | Select-Object -ExpandProperty browser_download_url62      Write-Host "Download URL: $downloadUrl"63      $tempPath = Get-GWTempPath64      Invoke-RestMethod -Uri $downloadUrl -OutFile "$tempPath\DSC.zip" -Headers $headers65 66      $null = New-Item -ItemType Directory -Path "$tempPath\DSC" -Force67      Expand-Archive -Path "$tempPath\DSC.zip" -DestinationPath "$tempPath\DSC" -Force68      $dscRoot = "$tempPath\DSC"69      Write-Host "DSC Root: $dscRoot"70      Set-GWVariable -Name "DSC_ROOT" -Value $dscRoot71 72  - name: Bootstrap73    shell: powershell74    run: |-75      Import-Module ./build.psm176      Write-LogGroupStart -Title 'Bootstrap'77      Write-Host "Old Path:"78      Write-Host $env:Path79      $dotnetPath = Join-Path $env:SystemDrive 'Program Files\dotnet'80      $paths = $env:Path -split ";" | Where-Object { -not $_.StartsWith($dotnetPath) }81      $env:Path = $paths -join ";"82      Write-Host "New Path:"83      Write-Host $env:Path84      # Bootstrap85      Import-Module .\tools\ci.psm186      Invoke-CIInstall87      Write-LogGroupEnd -Title 'Bootstrap'88 89  - name: Test90    if: success()91    run: |-92      Import-Module .\build.psm1 -force93      Import-Module .\tools\ci.psm194      Restore-PSOptions -PSOptionsPath '${{ github.workspace }}\build\psoptions.json'95      $options = (Get-PSOptions)96      $path = split-path -path $options.Output97      $rootPath = split-Path -path $path98      Expand-Archive -Path '${{ github.workspace }}\build\build.zip' -DestinationPath $rootPath -Force99      Invoke-CITest -Purpose '${{ inputs.purpose }}' -TagSet '${{ inputs.tagSet }}' -OutputFormat NUnitXml100    shell: pwsh101 102  - name: Convert, Publish, and Upload Pester Test Results103    uses: "./.github/actions/test/process-pester-results"104    with:105      name: "${{ inputs.purpose }}-${{ inputs.tagSet }}"106      testResultsFolder: ${{ runner.workspace }}\testResults107      ctrfFolder: "${{ inputs.ctrfFolder }}"108