Add portable PowerShell formatter packages #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI Tests | |
| on: | |
| workflow_dispatch: # to allow contributors to trigger CI manually in their fork | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| ci: | |
| name: pester | |
| strategy: | |
| matrix: | |
| os: [ windows-latest, macos-latest, ubuntu-latest ] | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| DOTNET_NOLOGO: true | |
| DOTNET_GENERATE_ASPNET_CERTIFICATE: false | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v7 | |
| - name: Set up WASI SDK | |
| uses: jdx/mise-action@v4 | |
| with: | |
| install: true | |
| install_args: github:WebAssembly/wasi-sdk | |
| export_path: false | |
| - name: Install dotnet | |
| uses: actions/setup-dotnet@v6 | |
| with: | |
| cache: true | |
| cache-dependency-path: '**/*.csproj' | |
| - name: Install PSResources | |
| run: ./tools/installPSResources.ps1 | |
| shell: pwsh | |
| - name: Install formatter workloads | |
| run: | | |
| $arguments = @( | |
| "workload", "install", "wasm-tools", "wasi-experimental", | |
| "--skip-manifest-update", | |
| "--source", "https://api.nuget.org/v3/index.json" | |
| ) | |
| & dotnet @arguments | |
| if ($LASTEXITCODE -ne 0) { | |
| $message = "Installing the formatter workloads failed with exit code $LASTEXITCODE." | |
| "::error::$message" | |
| throw $message | |
| } | |
| shell: pwsh | |
| - name: Build | |
| run: ./build.ps1 -Configuration Release -All -Verbose | |
| shell: pwsh | |
| - name: Package | |
| run: ./build.ps1 -BuildNupkg -Verbose | |
| shell: pwsh | |
| - name: Test | |
| run: ./build.ps1 -Test -Verbose | |
| shell: pwsh | |
| - name: Test Windows PowerShell | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| Install-Module Pester -Scope CurrentUser -Force -SkipPublisherCheck | |
| ./build.ps1 -Test -Verbose | |
| shell: powershell | |
| - name: Download PowerShell install script | |
| uses: actions/checkout@v7 | |
| with: | |
| repository: PowerShell/PowerShell | |
| path: pwsh | |
| sparse-checkout: tools/install-powershell.ps1 | |
| sparse-checkout-cone-mode: false | |
| - name: Install preview | |
| continue-on-error: true | |
| run: ./pwsh/tools/install-powershell.ps1 -Preview -Destination ./preview | |
| shell: pwsh | |
| - name: Test preview | |
| run: | | |
| $PwshPreview = if ($isWindows) { "./preview/pwsh.exe" } else { "./preview/pwsh" } | |
| ./build.ps1 -Test -WithPowerShell:$PwshPreview -Verbose | |
| shell: pwsh | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v7 | |
| if: always() | |
| with: | |
| name: PSScriptAnalyzer-package-${{ matrix.os }} | |
| path: out/**/*.nupkg | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v7 | |
| if: always() | |
| with: | |
| name: PSScriptAnalyzer-tests-${{ matrix.os }} | |
| path: testResults.xml |