Skip to content

Commit 7be3d41

Browse files
authored
Merge branch 'release/v7.6' into backport/release/v7.6/26233-5661a5152
2 parents 04edeea + 51e4d5c commit 7be3d41

14 files changed

Lines changed: 639 additions & 71 deletions

.github/actions/build/ci/action.yml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,8 @@ runs:
3131
Import-Module .\tools\ci.psm1
3232
Invoke-CIBuild
3333
shell: pwsh
34-
- name: xUnit Tests
35-
if: success()
36-
continue-on-error: true
37-
run: |-
38-
Write-Verbose -Verbose "Running xUnit tests..."
39-
Import-Module .\tools\ci.psm1
40-
Restore-PSOptions
41-
Invoke-CIxUnit -SkipFailing
42-
shell: pwsh
4334
- name: Upload build artifact
4435
uses: actions/upload-artifact@v4
4536
with:
4637
name: build
4738
path: ${{ runner.workspace }}/build
48-
- name: Upload xunit artifact
49-
uses: actions/upload-artifact@v4
50-
with:
51-
name: testResults-xunit
52-
path: ${{ runner.workspace }}/xunit

.github/actions/infrastructure/path-filters/action.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ outputs:
2626
buildModuleChanged:
2727
description: 'Build module changes'
2828
value: ${{ steps.filter.outputs.buildModuleChanged }}
29+
packagingChanged:
30+
description: 'Packaging related changes'
31+
value: ${{ steps.filter.outputs.packagingChanged }}
2932
runs:
3033
using: composite
3134
steps:
@@ -85,6 +88,19 @@ runs:
8588
8689
const globalConfigChanged = files.some(file => file.filename.startsWith('.globalconfig')) || files.some(file => file.filename.startsWith('nuget.config')) || files.some(file => file.filename.startsWith('global.json'));
8790
91+
const packagingChanged = files.some(file =>
92+
file.filename === '.github/workflows/windows-ci.yml' ||
93+
file.filename.startsWith('assets/wix/') ||
94+
file.filename === 'PowerShell.Common.props' ||
95+
file.filename.match(/^src\/.*\.csproj$/) ||
96+
file.filename.startsWith('test/packaging/windows/') ||
97+
file.filename.startsWith('tools/packaging/') ||
98+
file.filename.startsWith('tools/wix/')
99+
) ||
100+
buildModuleChanged ||
101+
globalConfigChanged ||
102+
toolsCiPsm1Changed;
103+
88104
const source = mainSourceChanged || toolsChanged || githubChanged || propsChanged || testsChanged || globalConfigChanged;
89105
90106
core.setOutput('toolsChanged', toolsChanged);
@@ -94,6 +110,7 @@ runs:
94110
core.setOutput('mainSourceChanged', mainSourceChanged);
95111
core.setOutput('buildModuleChanged', buildModuleChanged);
96112
core.setOutput('globalConfigChanged', globalConfigChanged);
113+
core.setOutput('packagingChanged', packagingChanged);
97114
core.setOutput('source', source);
98115
99116
@@ -106,4 +123,5 @@ runs:
106123
Write-Verbose -Verbose "tests: ${{ steps.filter.outputs.testsChanged }}"
107124
Write-Verbose -Verbose "mainSource: ${{ steps.filter.outputs.mainSourceChanged }}"
108125
Write-Verbose -Verbose "buildModule: ${{ steps.filter.outputs.buildModuleChanged }}"
126+
Write-Verbose -Verbose "packaging: ${{ steps.filter.outputs.packagingChanged }}"
109127
shell: pwsh

.github/actions/test/verify_xunit/action.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# Build Configuration Guide
2+
3+
## Choosing the Right Configuration
4+
5+
### For Testing
6+
7+
**Use: Default (Debug)**
8+
9+
```yaml
10+
- name: Build for Testing
11+
shell: pwsh
12+
run: |
13+
Import-Module ./tools/ci.psm1
14+
Start-PSBuild
15+
```
16+
17+
**Why Debug:**
18+
- Includes debugging symbols
19+
- Better error messages
20+
- Faster build times
21+
- Suitable for xUnit and Pester tests
22+
23+
**Do NOT use:**
24+
- `-Configuration 'Release'` (unnecessary for tests)
25+
- `-ReleaseTag` (not needed for tests)
26+
- `-CI` (unless you specifically need Pester module)
27+
28+
### For Release/Packaging
29+
30+
**Use: Release with version tag**
31+
32+
```yaml
33+
- name: Build for Release
34+
shell: pwsh
35+
run: |
36+
Import-Module ./tools/ci.psm1
37+
$releaseTag = Get-ReleaseTag
38+
Start-PSBuild -Configuration 'Release' -ReleaseTag $releaseTag
39+
```
40+
41+
**Why Release:**
42+
- Optimized binaries
43+
- No debug symbols (smaller size)
44+
- Production-ready
45+
46+
### For Code Coverage
47+
48+
**Use: CodeCoverage configuration**
49+
50+
```yaml
51+
- name: Build with Coverage
52+
shell: pwsh
53+
run: |
54+
Import-Module ./tools/ci.psm1
55+
Start-PSBuild -Configuration 'CodeCoverage'
56+
```
57+
58+
## Platform Considerations
59+
60+
### All Platforms
61+
62+
Same commands work across Linux, Windows, and macOS:
63+
64+
```yaml
65+
strategy:
66+
matrix:
67+
os: [ubuntu-latest, windows-latest, macos-latest]
68+
runs-on: ${{ matrix.os }}
69+
steps:
70+
- name: Build PowerShell
71+
shell: pwsh
72+
run: |
73+
Import-Module ./tools/ci.psm1
74+
Start-PSBuild
75+
```
76+
77+
### Output Locations
78+
79+
**Linux/macOS:**
80+
```
81+
src/powershell-unix/bin/Debug/<netversion>/<runtime>/publish/
82+
```
83+
84+
**Windows:**
85+
```
86+
src/powershell-win-core/bin/Debug/<netversion>/<runtime>/publish/
87+
```
88+
89+
## Best Practices
90+
91+
1. Use default configuration for testing
92+
2. Avoid redundant parameters
93+
3. Match configuration to purpose
94+
4. Use `-CI` only when needed
95+
5. Always specify `-ReleaseTag` for release or packaging builds
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Git Requirements for Building PowerShell
2+
3+
## Fetch Depth
4+
5+
**Required:** `fetch-depth: 1000`
6+
7+
The PowerShell build process uses `git describe --abbrev=60 --long` to generate version information. This requires access to git history and tags.
8+
9+
### Problem
10+
11+
Without sufficient fetch depth, builds fail with:
12+
```
13+
error MSB3073: The command "git describe --abbrev=60 --long" exited with code 128.
14+
```
15+
16+
### Solution
17+
18+
Always use `fetch-depth: 1000` in the checkout step:
19+
20+
```yaml
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 1000
25+
```
26+
27+
## Tag Synchronization
28+
29+
**Required:** `Sync-PSTags -AddRemoteIfMissing`
30+
31+
The build process needs git tags to properly version the build.
32+
33+
### Problem
34+
35+
Without tag synchronization:
36+
- Version information is incorrect
37+
- Build versioning fails
38+
39+
### Solution
40+
41+
Include tag synchronization in the bootstrap step:
42+
43+
```yaml
44+
- name: Bootstrap
45+
shell: pwsh
46+
run: |
47+
Import-Module ./tools/ci.psm1
48+
Sync-PSTags -AddRemoteIfMissing
49+
```
50+
51+
## Complete Example
52+
53+
```yaml
54+
steps:
55+
- name: Checkout
56+
uses: actions/checkout@v4
57+
with:
58+
fetch-depth: 1000
59+
60+
- name: Setup .NET
61+
uses: actions/setup-dotnet@v4
62+
with:
63+
global-json-file: ./global.json
64+
65+
- name: Bootstrap
66+
shell: pwsh
67+
run: |
68+
Import-Module ./tools/ci.psm1
69+
Invoke-CIInstall -SkipUser
70+
Sync-PSTags -AddRemoteIfMissing
71+
```
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Start-PSBuild Basics
2+
3+
## Purpose
4+
5+
`Start-PSBuild` builds PowerShell from source. It's defined in `build.psm1` and used in CI/CD workflows.
6+
7+
## Default Usage
8+
9+
For most scenarios, use with no parameters:
10+
11+
```powershell
12+
Import-Module ./tools/ci.psm1
13+
Start-PSBuild
14+
```
15+
16+
**Default behavior:**
17+
- Configuration: `Debug`
18+
- PSModuleRestore: Enabled
19+
- Runtime: Auto-detected for platform
20+
21+
## Common Configurations
22+
23+
### Debug Build (Default)
24+
25+
```powershell
26+
Start-PSBuild
27+
```
28+
29+
Use for:
30+
- Testing (xUnit, Pester)
31+
- Development
32+
- Debugging
33+
34+
### Release Build
35+
36+
```powershell
37+
Start-PSBuild -Configuration 'Release'
38+
```
39+
40+
Use for:
41+
- Production packages
42+
- Distribution
43+
- Performance testing
44+
45+
### Code Coverage Build
46+
47+
```powershell
48+
Start-PSBuild -Configuration 'CodeCoverage'
49+
```
50+
51+
Use for:
52+
- Code coverage analysis
53+
- Test coverage reports
54+
55+
## Common Parameters
56+
57+
### -Configuration
58+
59+
Values: `Debug`, `Release`, `CodeCoverage`, `StaticAnalysis`
60+
61+
Default: `Debug`
62+
63+
### -CI
64+
65+
Restores Pester module for CI environments.
66+
67+
```powershell
68+
Start-PSBuild -CI
69+
```
70+
71+
### -PSModuleRestore
72+
73+
Now enabled by default. Use `-NoPSModuleRestore` to skip.
74+
75+
### -ReleaseTag
76+
77+
Specifies version tag for release builds:
78+
79+
```powershell
80+
$releaseTag = Get-ReleaseTag
81+
Start-PSBuild -Configuration 'Release' -ReleaseTag $releaseTag
82+
```
83+
84+
## Workflow Example
85+
86+
```yaml
87+
- name: Build PowerShell
88+
shell: pwsh
89+
run: |
90+
Import-Module ./tools/ci.psm1
91+
Start-PSBuild
92+
```

0 commit comments

Comments
 (0)