Update Pester tests #244
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: Validate module | |
| on: | |
| push: | |
| paths: | |
| - 'VcRedist/**' | |
| - 'tests/**' | |
| branches-ignore: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| - 'VcRedist/**' | |
| workflow_dispatch: | |
| jobs: | |
| run-pester: | |
| name: Test with Pester | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [windows-2025, windows-11-arm] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| # Run Pester tests | |
| - name: Run Pester tests | |
| shell: powershell | |
| working-directory: "${{ github.workspace }}" | |
| env: | |
| TENANT_ID: ${{ secrets.TENANT_ID }} | |
| CLIENT_ID: ${{ secrets.CLIENT_ID }} | |
| CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} | |
| run: | | |
| .\tests\Install-Pester.ps1 | |
| Import-Module -Name "Pester" -Force -ErrorAction "Stop" | |
| Import-Module -Name "$env:GITHUB_WORKSPACE\VcRedist" -Force | |
| $Config = New-PesterConfiguration | |
| $Config.Run.Path = "$env:GITHUB_WORKSPACE\tests" | |
| $Config.Run.PassThru = $True | |
| $Config.CodeCoverage.Enabled = $True | |
| $Config.CodeCoverage.Path = "$env:GITHUB_WORKSPACE\VcRedist" | |
| $Config.CodeCoverage.OutputFormat = "JaCoCo" | |
| $Config.CodeCoverage.OutputPath = "$env:GITHUB_WORKSPACE\CodeCoverage-${{ matrix.os }}.xml" | |
| $Config.TestResult.Enabled = $True | |
| $Config.TestResult.OutputFormat = "NUnitXml" | |
| $Config.TestResult.OutputPath = "$env:GITHUB_WORKSPACE\tests\TestResults-${{ matrix.os }}.xml" | |
| $Config.Output.Verbosity = "Detailed" | |
| Invoke-Pester -Configuration $Config | |
| - name: Upload artifacts | |
| id: upload-artifacts | |
| if: always() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: 'pester-test-results-${{ matrix.os }}' | |
| path: | | |
| ${{ github.workspace }}\tests\TestResults-${{ matrix.os }}.xml | |
| # Publish Pester test results | |
| - name: Publish Pester test results | |
| uses: EnricoMi/publish-unit-test-result-action/windows@v2 | |
| if: always() | |
| with: | |
| files: "${{ github.workspace }}//tests//TestResults-${{ matrix.os }}.xml" | |
| # - name: Upload to Codecov | |
| # id: codecov | |
| # if: always() | |
| # uses: codecov/codecov-action@v5 | |
| # with: | |
| # token: ${{ secrets.CODECOV_TOKEN }} | |
| # files: ./CodeCoverage-${{ matrix.os }}.xml | |
| # verbose: true | |
| update-module-version: | |
| name: Update module version | |
| needs: [run-pester] | |
| runs-on: 'windows-latest' | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install and cache PowerShell modules | |
| id: psmodulecache | |
| uses: potatoqualitee/psmodulecache@v6.2.1 | |
| with: | |
| modules-to-cache: BuildHelpers | |
| shell: pwsh | |
| - name: Update module version | |
| shell: pwsh | |
| working-directory: "${{ github.workspace }}" | |
| run: | | |
| Import-Module -Name BuildHelpers | |
| Step-ModuleVersion -Path .\VcRedist\VcRedist.psd1 -By Build | |
| # Import GPG key so that we can sign the commit | |
| - name: Import GPG key | |
| id: import_gpg | |
| uses: crazy-max/ghaction-import-gpg@v7 | |
| with: | |
| gpg_private_key: ${{ secrets.GPGKEY }} | |
| passphrase: ${{ secrets.GPGPASSPHRASE }} | |
| git_user_signingkey: true | |
| git_commit_gpgsign: true | |
| git_config_global: true | |
| git_tag_gpgsign: true | |
| git_push_gpgsign: false | |
| git_committer_name: ${{ secrets.COMMIT_NAME }} | |
| git_committer_email: ${{ secrets.COMMIT_EMAIL }} | |
| - name: Commit changes | |
| id: commit | |
| uses: stefanzweifel/git-auto-commit-action@v7 | |
| with: | |
| commit_message: "Update module version" | |
| commit_user_name: ${{ secrets.COMMIT_NAME }} | |
| commit_user_email: ${{ secrets.COMMIT_EMAIL }} |