Merge pull request #43 from AsBuiltReport/dev #150
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: Pester Tests | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - dev | |
| - master | |
| pull_request: | |
| branches: | |
| - main | |
| - dev | |
| - master | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| name: Pester Tests - ${{ matrix.os }} - ${{ matrix.shell }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [windows-latest, ubuntu-latest, macos-latest] | |
| shell: [pwsh] | |
| include: | |
| - os: windows-latest | |
| shell: powershell | |
| exclude: | |
| - os: ubuntu-latest | |
| shell: powershell | |
| - os: macos-latest | |
| shell: powershell | |
| defaults: | |
| run: | |
| shell: ${{ matrix.shell }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v7 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: "8.0.x" | |
| - name: Restore dependencies | |
| run: dotnet restore ./Sources | |
| - name: Build the library for MacOS | |
| run: dotnet publish ./Sources -c Release -r osx-arm64 | |
| if: matrix.os == 'macos-latest' | |
| - name: Copy the library for MacOS | |
| run: Copy-Item -Path ./Sources/bin/Release/netstandard2.0/osx-arm64/publish/* -Destination ./AsBuiltReport.Chart/Src/Assemblies/Core/mac-osx/osx-arm64 -Recurse | |
| if: matrix.os == 'macos-latest' | |
| - name: Build the library for Linux | |
| run: dotnet publish ./Sources -c Release -r linux-x64 | |
| if: matrix.os == 'ubuntu-latest' | |
| - name: Copy the library for Linux | |
| run: Copy-Item -Path ./Sources/bin/Release/netstandard2.0/linux-x64/publish/* -Destination ./AsBuiltReport.Chart/Src/Assemblies/Core/linux-x64 -Recurse | |
| if: matrix.os == 'ubuntu-latest' | |
| - name: Build the library for Windows | |
| run: dotnet publish ./Sources -c Release -r win-x64 | |
| if: matrix.os == 'windows-latest' && matrix.shell == 'pwsh' | |
| - name: Copy the library for Windows | |
| run: Copy-Item -Path ./Sources/bin/Release/netstandard2.0/win-x64/publish/* -Destination ./AsBuiltReport.Chart/Src/Assemblies/Core/windows-x64 -Recurse | |
| if: matrix.os == 'windows-latest' && matrix.shell == 'pwsh' | |
| - name: Build the library for Windows PowerShell | |
| run: dotnet publish ./Sources -c Release -r win-x64 | |
| if: matrix.os == 'windows-latest' && matrix.shell == 'powershell' | |
| - name: Copy the library for Windows PowerShell | |
| run: Copy-Item -Path ./Sources/bin/Release/netstandard2.0/win-x64/publish/* -Destination ./AsBuiltReport.Chart/Src/Assemblies/Desktop/windows-x64 -Recurse | |
| if: matrix.os == 'windows-latest' && matrix.shell == 'powershell' | |
| - name: Run tests | |
| run: dotnet test --no-build --verbosity normal ./Sources | |
| - name: Set up PowerShell Gallery | |
| run: | | |
| Set-PSRepository -Name PSGallery -InstallationPolicy Trusted | |
| - name: Install Pester | |
| run: | | |
| Install-Module -Name Pester -MinimumVersion 5.0.0 -Repository PSGallery -Force -AllowClobber -Scope CurrentUser | |
| - name: Run Pester Tests | |
| run: | | |
| $CodeCoverageParam = @{} | |
| $OutputFormatParam = @{ OutputFormat = 'NUnitXml' } | |
| .\Tests\Invoke-Tests.ps1 @CodeCoverageParam @OutputFormatParam | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: test-results-${{ matrix.os }}-${{ matrix.shell }} | |
| path: Tests/testResults.xml | |
| retention-days: 30 |