-
Notifications
You must be signed in to change notification settings - Fork 8.1k
[release/v7.6] Refactor: Centralize xUnit tests into reusable workflow and remove legacy verification #26488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
TravisEz13
merged 1 commit into
PowerShell:release/v7.6
from
TravisEz13:backport/release/v7.6/26243-90e9159cb
Nov 19, 2025
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
This file was deleted.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| # Build Configuration Guide | ||
|
|
||
| ## Choosing the Right Configuration | ||
|
|
||
| ### For Testing | ||
|
|
||
| **Use: Default (Debug)** | ||
|
|
||
| ```yaml | ||
| - name: Build for Testing | ||
| shell: pwsh | ||
| run: | | ||
| Import-Module ./tools/ci.psm1 | ||
| Start-PSBuild | ||
| ``` | ||
|
|
||
| **Why Debug:** | ||
| - Includes debugging symbols | ||
| - Better error messages | ||
| - Faster build times | ||
| - Suitable for xUnit and Pester tests | ||
|
|
||
| **Do NOT use:** | ||
| - `-Configuration 'Release'` (unnecessary for tests) | ||
| - `-ReleaseTag` (not needed for tests) | ||
| - `-CI` (unless you specifically need Pester module) | ||
|
|
||
| ### For Release/Packaging | ||
|
|
||
| **Use: Release with version tag** | ||
|
|
||
| ```yaml | ||
| - name: Build for Release | ||
| shell: pwsh | ||
| run: | | ||
| Import-Module ./tools/ci.psm1 | ||
| $releaseTag = Get-ReleaseTag | ||
| Start-PSBuild -Configuration 'Release' -ReleaseTag $releaseTag | ||
| ``` | ||
|
|
||
| **Why Release:** | ||
| - Optimized binaries | ||
| - No debug symbols (smaller size) | ||
| - Production-ready | ||
|
|
||
| ### For Code Coverage | ||
|
|
||
| **Use: CodeCoverage configuration** | ||
|
|
||
| ```yaml | ||
| - name: Build with Coverage | ||
| shell: pwsh | ||
| run: | | ||
| Import-Module ./tools/ci.psm1 | ||
| Start-PSBuild -Configuration 'CodeCoverage' | ||
| ``` | ||
|
|
||
| ## Platform Considerations | ||
|
|
||
| ### All Platforms | ||
|
|
||
| Same commands work across Linux, Windows, and macOS: | ||
|
|
||
| ```yaml | ||
| strategy: | ||
| matrix: | ||
| os: [ubuntu-latest, windows-latest, macos-latest] | ||
| runs-on: ${{ matrix.os }} | ||
| steps: | ||
| - name: Build PowerShell | ||
| shell: pwsh | ||
| run: | | ||
| Import-Module ./tools/ci.psm1 | ||
| Start-PSBuild | ||
| ``` | ||
|
|
||
| ### Output Locations | ||
|
|
||
| **Linux/macOS:** | ||
| ``` | ||
| src/powershell-unix/bin/Debug/<netversion>/<runtime>/publish/ | ||
| ``` | ||
|
|
||
| **Windows:** | ||
| ``` | ||
| src/powershell-win-core/bin/Debug/<netversion>/<runtime>/publish/ | ||
| ``` | ||
|
|
||
| ## Best Practices | ||
|
|
||
| 1. Use default configuration for testing | ||
| 2. Avoid redundant parameters | ||
| 3. Match configuration to purpose | ||
| 4. Use `-CI` only when needed | ||
| 5. Always specify `-ReleaseTag` for release or packaging builds | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| # Git Requirements for Building PowerShell | ||
|
|
||
| ## Fetch Depth | ||
|
|
||
| **Required:** `fetch-depth: 1000` | ||
|
|
||
| The PowerShell build process uses `git describe --abbrev=60 --long` to generate version information. This requires access to git history and tags. | ||
|
|
||
| ### Problem | ||
|
|
||
| Without sufficient fetch depth, builds fail with: | ||
| ``` | ||
| error MSB3073: The command "git describe --abbrev=60 --long" exited with code 128. | ||
| ``` | ||
|
|
||
| ### Solution | ||
|
|
||
| Always use `fetch-depth: 1000` in the checkout step: | ||
|
|
||
| ```yaml | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 1000 | ||
| ``` | ||
| ## Tag Synchronization | ||
| **Required:** `Sync-PSTags -AddRemoteIfMissing` | ||
|
|
||
| The build process needs git tags to properly version the build. | ||
|
|
||
| ### Problem | ||
|
|
||
| Without tag synchronization: | ||
| - Version information is incorrect | ||
| - Build versioning fails | ||
|
|
||
| ### Solution | ||
|
|
||
| Include tag synchronization in the bootstrap step: | ||
|
|
||
| ```yaml | ||
| - name: Bootstrap | ||
| shell: pwsh | ||
| run: | | ||
| Import-Module ./tools/ci.psm1 | ||
| Sync-PSTags -AddRemoteIfMissing | ||
| ``` | ||
|
|
||
| ## Complete Example | ||
|
|
||
| ```yaml | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 1000 | ||
| - name: Setup .NET | ||
| uses: actions/setup-dotnet@v4 | ||
| with: | ||
| global-json-file: ./global.json | ||
| - name: Bootstrap | ||
| shell: pwsh | ||
| run: | | ||
| Import-Module ./tools/ci.psm1 | ||
| Invoke-CIInstall -SkipUser | ||
| Sync-PSTags -AddRemoteIfMissing | ||
| ``` |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| # Start-PSBuild Basics | ||
|
|
||
| ## Purpose | ||
|
|
||
| `Start-PSBuild` builds PowerShell from source. It's defined in `build.psm1` and used in CI/CD workflows. | ||
|
|
||
| ## Default Usage | ||
|
|
||
| For most scenarios, use with no parameters: | ||
|
|
||
| ```powershell | ||
| Import-Module ./tools/ci.psm1 | ||
| Start-PSBuild | ||
| ``` | ||
|
|
||
| **Default behavior:** | ||
| - Configuration: `Debug` | ||
| - PSModuleRestore: Enabled | ||
| - Runtime: Auto-detected for platform | ||
|
|
||
| ## Common Configurations | ||
|
|
||
| ### Debug Build (Default) | ||
|
|
||
| ```powershell | ||
| Start-PSBuild | ||
| ``` | ||
|
|
||
| Use for: | ||
| - Testing (xUnit, Pester) | ||
| - Development | ||
| - Debugging | ||
|
|
||
| ### Release Build | ||
|
|
||
| ```powershell | ||
| Start-PSBuild -Configuration 'Release' | ||
| ``` | ||
|
|
||
| Use for: | ||
| - Production packages | ||
| - Distribution | ||
| - Performance testing | ||
|
|
||
| ### Code Coverage Build | ||
|
|
||
| ```powershell | ||
| Start-PSBuild -Configuration 'CodeCoverage' | ||
| ``` | ||
|
|
||
| Use for: | ||
| - Code coverage analysis | ||
| - Test coverage reports | ||
|
|
||
| ## Common Parameters | ||
|
|
||
| ### -Configuration | ||
|
|
||
| Values: `Debug`, `Release`, `CodeCoverage`, `StaticAnalysis` | ||
|
|
||
| Default: `Debug` | ||
|
|
||
| ### -CI | ||
|
|
||
| Restores Pester module for CI environments. | ||
|
|
||
| ```powershell | ||
| Start-PSBuild -CI | ||
| ``` | ||
|
|
||
| ### -PSModuleRestore | ||
|
|
||
| Now enabled by default. Use `-NoPSModuleRestore` to skip. | ||
|
|
||
| ### -ReleaseTag | ||
|
|
||
| Specifies version tag for release builds: | ||
|
|
||
| ```powershell | ||
| $releaseTag = Get-ReleaseTag | ||
| Start-PSBuild -Configuration 'Release' -ReleaseTag $releaseTag | ||
| ``` | ||
|
|
||
| ## Workflow Example | ||
|
|
||
| ```yaml | ||
| - name: Build PowerShell | ||
| shell: pwsh | ||
| run: | | ||
| Import-Module ./tools/ci.psm1 | ||
| Start-PSBuild | ||
| ``` |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| # Troubleshooting Build Issues | ||
|
|
||
| ## Git Describe Error | ||
|
|
||
| **Error:** | ||
| ``` | ||
| error MSB3073: The command "git describe --abbrev=60 --long" exited with code 128. | ||
| ``` | ||
|
|
||
| **Cause:** Insufficient git history (shallow clone) | ||
|
|
||
| **Solution:** Add `fetch-depth: 1000` to checkout step | ||
|
|
||
| ```yaml | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 1000 | ||
| ``` | ||
| ## Version Information Incorrect | ||
| **Symptom:** Build produces wrong version numbers | ||
| **Cause:** Git tags not synchronized | ||
| **Solution:** Run `Sync-PSTags -AddRemoteIfMissing`: | ||
|
|
||
| ```yaml | ||
| - name: Bootstrap | ||
| shell: pwsh | ||
| run: | | ||
| Import-Module ./tools/ci.psm1 | ||
| Invoke-CIInstall -SkipUser | ||
| Sync-PSTags -AddRemoteIfMissing | ||
| ``` | ||
|
|
||
| ## PowerShell Binary Not Built | ||
|
|
||
| **Error:** | ||
| ``` | ||
| Exception: CoreCLR pwsh.exe was not built | ||
| ``` | ||
| **Causes:** | ||
| 1. Build failed (check logs) | ||
| 2. Wrong configuration used | ||
| 3. Build output location incorrect | ||
| **Solutions:** | ||
| 1. Check build logs for errors | ||
| 2. Verify correct configuration for use case | ||
| 3. Use default parameters: `Start-PSBuild` | ||
| ## Module Restore Issues | ||
| **Symptom:** Slow build or module restore failures | ||
| **Causes:** | ||
| - Network issues | ||
| - Module cache problems | ||
| - Package source unavailable | ||
| **Solutions:** | ||
| 1. Retry the build | ||
| 2. Check network connectivity | ||
| 3. Use `-NoPSModuleRestore` if modules not needed | ||
| 4. Clear package cache if persistent | ||
| ## .NET SDK Not Found | ||
| **Symptom:** Build can't find .NET SDK | ||
| **Solution:** Ensure .NET setup step runs first: | ||
| ```yaml | ||
| - name: Setup .NET | ||
| uses: actions/setup-dotnet@v4 | ||
| with: | ||
| global-json-file: ./global.json | ||
| ``` | ||
|
|
||
| ## Bootstrap Failures | ||
|
|
||
| **Symptom:** Invoke-CIInstall fails | ||
|
|
||
| **Causes:** | ||
| - Missing dependencies | ||
| - Network issues | ||
| - Platform-specific requirements not met | ||
|
|
||
| **Solution:** Check prerequisites for your platform in build system docs |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.