Add export column format shortcuts #277
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: Test PowerShell | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - main | |
| paths-ignore: | |
| - '*.md' | |
| - 'Docs/**' | |
| - 'Examples/**' | |
| - '.gitignore' | |
| pull_request: | |
| branches: | |
| - master | |
| - main | |
| workflow_dispatch: | |
| env: | |
| DOTNET_VERSION: '8.x' | |
| BUILD_CONFIGURATION: 'Debug' | |
| jobs: | |
| refresh-psd1: | |
| name: 'Refresh PSD1' | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref }} | |
| - name: Setup PowerShell modules | |
| run: | | |
| Install-Module PSPublishModule -Force -Scope CurrentUser -AllowClobber | |
| shell: pwsh | |
| - name: Refresh module manifest | |
| env: | |
| RefreshPSD1Only: 'true' | |
| run: ./Build/Manage-PSWriteOffice.ps1 | |
| shell: pwsh | |
| - name: Refresh API snapshot | |
| run: ./Build/Export-ApiDocsSnapshot.ps1 | |
| shell: pwsh | |
| - name: Commit refreshed PSD1 | |
| if: github.event_name != 'pull_request' | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| HEAD_BRANCH: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref_name }} | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add PSWriteOffice.psd1 | |
| git add Docs/Generated/PSWriteOffice-help.xml | |
| git add WebsiteArtifacts | |
| git commit -m "chore: regenerate psd1" || echo "No changes to commit" | |
| git push origin HEAD:$Env:HEAD_BRANCH | |
| shell: pwsh | |
| - name: Upload refreshed manifest | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: psd1 | |
| path: PSWriteOffice.psd1 | |
| - name: Upload API snapshot | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: pswriteoffice-api-snapshot | |
| path: Docs/Generated/PSWriteOffice-help.xml | |
| - name: Upload website artifacts | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: pswriteoffice-website-artifacts | |
| path: WebsiteArtifacts/** | |
| test-windows-ps5: | |
| needs: refresh-psd1 | |
| name: 'Windows PowerShell 5.1' | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Download manifest | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: psd1 | |
| path: . | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Install PowerShell modules | |
| shell: powershell | |
| run: | | |
| Write-Host "PowerShell Version: $($PSVersionTable.PSVersion)" | |
| Install-Module -Name Pester -Repository PSGallery -Force -SkipPublisherCheck -AllowClobber | |
| Install-Module -Name PSWriteColor -Repository PSGallery -Force -SkipPublisherCheck -AllowClobber | |
| - name: Build .NET solution | |
| run: | | |
| dotnet restore Sources/PSWriteOffice.sln | |
| dotnet build Sources/PSWriteOffice.sln --configuration ${{ env.BUILD_CONFIGURATION }} --no-restore | |
| - name: Run PowerShell tests | |
| shell: powershell | |
| run: .\PSWriteOffice.Tests.ps1 | |
| test-windows-ps7: | |
| needs: refresh-psd1 | |
| name: 'Windows PowerShell 7' | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Download manifest | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: psd1 | |
| path: . | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Install PowerShell modules | |
| shell: pwsh | |
| run: | | |
| Write-Host "PowerShell Version: $($PSVersionTable.PSVersion)" | |
| Install-Module -Name Pester -Repository PSGallery -Force -SkipPublisherCheck -AllowClobber | |
| Install-Module -Name PSWriteColor -Repository PSGallery -Force -SkipPublisherCheck -AllowClobber | |
| Install-Module -Name PSPublishModule -Repository PSGallery -Force -SkipPublisherCheck -AllowClobber | |
| - name: Build .NET solution | |
| run: | | |
| dotnet restore Sources/PSWriteOffice.sln | |
| dotnet build Sources/PSWriteOffice.sln --configuration ${{ env.BUILD_CONFIGURATION }} --no-restore | |
| - name: Run PowerShell tests | |
| shell: pwsh | |
| run: .\PSWriteOffice.Tests.ps1 | |
| - name: Validate packaged artefact | |
| shell: pwsh | |
| run: .\Build\Validate-PackagedArtefact.ps1 -SkipBuild | |
| - name: Upload packaged artefacts | |
| if: always() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: packaged-artefacts-windows-ps7 | |
| path: | | |
| Artefacts/Packed/** | |
| Artefacts/Reports/** | |
| Artefacts/Unpacked/** | |
| packaged-alc-conflict: | |
| name: 'Windows Packaged ALC conflict' | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Install PowerShell modules | |
| shell: pwsh | |
| run: | | |
| if (-not (Get-PSRepository -Name PSGallery -ErrorAction SilentlyContinue)) { | |
| Register-PSRepository -Default | |
| } | |
| Install-Module -Name Pester -Repository PSGallery -Force -SkipPublisherCheck -AllowClobber | |
| Install-Module -Name PSWriteColor -Repository PSGallery -Force -SkipPublisherCheck -AllowClobber | |
| Install-Module -Name PSPublishModule -Repository PSGallery -MinimumVersion 3.0.5 -Force -SkipPublisherCheck -AllowClobber | |
| - name: Prepare default-context Open XML conflict | |
| shell: pwsh | |
| run: | | |
| $conflictRoot = Join-Path $env:RUNNER_TEMP 'pswriteoffice-conflict' | |
| $packagePath = Join-Path $conflictRoot 'DocumentFormat.OpenXml.2.20.0.nupkg' | |
| $extractPath = Join-Path $conflictRoot 'DocumentFormat.OpenXml.2.20.0' | |
| New-Item -Path $conflictRoot -ItemType Directory -Force | Out-Null | |
| Invoke-WebRequest -Uri 'https://www.nuget.org/api/v2/package/DocumentFormat.OpenXml/2.20.0' -OutFile $packagePath -ConnectionTimeoutSeconds 30 -OperationTimeoutSeconds 120 | |
| Expand-Archive -LiteralPath $packagePath -DestinationPath $extractPath -Force | |
| $openXmlPath = Join-Path $extractPath 'lib\netstandard2.0\DocumentFormat.OpenXml.dll' | |
| if (-not (Test-Path -LiteralPath $openXmlPath)) { | |
| throw "Conflict Open XML assembly not found: $openXmlPath" | |
| } | |
| "PSWRITEOFFICE_CONFLICT_OPENXML_PATH=$openXmlPath" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8 | |
| - name: Build packaged module with ALC | |
| env: | |
| RefreshPSD1Only: 'false' | |
| shell: pwsh | |
| run: | | |
| $env:OfficeIMORoot = Join-Path (Get-Location) '.missing-officeimo' | |
| ./Build/Manage-PSWriteOffice.ps1 | |
| - name: Run packaged ALC conflict test | |
| env: | |
| PSWRITEOFFICE_REQUIRE_ALC_SMOKE: 'true' | |
| shell: pwsh | |
| run: | | |
| Import-Module Pester -Force | |
| $config = [PesterConfiguration]::Default | |
| $config.Run.Path = 'Tests/AssemblyLoadContext.Conflict.Tests.ps1' | |
| $config.Run.Exit = $true | |
| $config.Output.Verbosity = 'Detailed' | |
| Invoke-Pester -Configuration $config | |
| test-ubuntu: | |
| needs: refresh-psd1 | |
| name: 'Ubuntu PowerShell 7' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Download manifest | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: psd1 | |
| path: . | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Install PowerShell modules | |
| shell: pwsh | |
| run: | | |
| Write-Host "PowerShell Version: $($PSVersionTable.PSVersion)" | |
| Install-Module -Name Pester -Repository PSGallery -Force -SkipPublisherCheck -AllowClobber | |
| Install-Module -Name PSWriteColor -Repository PSGallery -Force -SkipPublisherCheck -AllowClobber | |
| - name: Build .NET solution | |
| run: | | |
| dotnet restore Sources/PSWriteOffice.sln | |
| dotnet build Sources/PSWriteOffice.sln --configuration ${{ env.BUILD_CONFIGURATION }} --no-restore | |
| - name: Run PowerShell tests | |
| shell: pwsh | |
| run: ./PSWriteOffice.Tests.ps1 | |
| test-macos: | |
| needs: refresh-psd1 | |
| name: 'macOS PowerShell 7' | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Download manifest | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: psd1 | |
| path: . | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Install PowerShell modules | |
| shell: pwsh | |
| run: | | |
| Write-Host "PowerShell Version: $($PSVersionTable.PSVersion)" | |
| Install-Module -Name Pester -Repository PSGallery -Force -SkipPublisherCheck -AllowClobber | |
| Install-Module -Name PSWriteColor -Repository PSGallery -Force -SkipPublisherCheck -AllowClobber | |
| - name: Build .NET solution | |
| run: | | |
| dotnet restore Sources/PSWriteOffice.sln | |
| dotnet build Sources/PSWriteOffice.sln --configuration ${{ env.BUILD_CONFIGURATION }} --no-restore | |
| - name: Run PowerShell tests | |
| shell: pwsh | |
| run: ./PSWriteOffice.Tests.ps1 |