Skip to content

Commit 8fcca52

Browse files
build: modernize build system with PowerShellBuild and GitHub Actions (#163)
## Summary - Replaces `psake.ps1` with `psakeFile.ps1` using PowerShellBuild `-FromModule` task delegation - Rewrites `build.ps1` with `-Bootstrap` switch and PSDepend-managed dependencies (pinned to known-good versions) - Adds `requirements.psd1` with pinned versions: psake 4.9.1, PowerShellBuild 0.7.2, Pester 5.7.1, PSScriptAnalyzer 1.19.1, BuildHelpers 2.0.16 - Replaces `appveyor.yml` with `.github/workflows/ci.yml` (ubuntu/windows/macOS matrix, `./build.ps1 -Bootstrap -Task Test`) - Adds PlatyPS markdown stubs in `docs/en-US/` for all public functions - Removes `deploy.psdeploy.ps1` (superseded by PowerShellBuild `Publish` task) ## Test plan - [x] `./build.ps1 -Bootstrap -Task Test` passes locally on Windows - [ ] CI matrix passes on ubuntu/windows/macOS via GitHub Actions Closes #149 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 24a9271 commit 8fcca52

16 files changed

Lines changed: 1510 additions & 188 deletions

.github/workflows/ci.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@ on:
1010
- 'PSDepend/**'
1111
- 'Tests/**'
1212
- 'build.ps1'
13-
- 'psake.ps1'
13+
- 'psakeFile.ps1'
14+
- 'requirements.psd1'
1415
pull_request:
1516
paths:
1617
- 'PSDepend/**'
1718
- 'Tests/**'
1819
- 'build.ps1'
19-
- 'psake.ps1'
20+
- 'psakeFile.ps1'
21+
- 'requirements.psd1'
2022
workflow_dispatch:
2123

2224
jobs:
@@ -29,15 +31,15 @@ jobs:
2931
os: [ubuntu-latest, windows-latest, macOS-latest]
3032
steps:
3133
- uses: actions/checkout@v4
32-
- name: Test
34+
- name: Bootstrap and Test
3335
shell: pwsh
34-
run: ./build.ps1 -Task Test
36+
run: ./build.ps1 -Bootstrap -Task Test
3537
- name: Upload Test Results
3638
if: always()
3739
uses: actions/upload-artifact@v4
3840
with:
3941
name: testResults-${{ matrix.os }}
40-
path: ./Tests/out/testResults.xml
42+
path: ./Output/testResults.xml
4143

4244
publish-test-results:
4345
name: Publish Test Results

appveyor.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

build.ps1

Lines changed: 58 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,62 @@
1-
[CmdletBinding()]
2-
param (
3-
[parameter(Position = 0)]
4-
[ValidateSet('Default','Init','Test','Build','Deploy')]
5-
$Task = 'Default'
1+
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
2+
'PSReviewUnusedParameter',
3+
'Command',
4+
Justification = 'false positive'
5+
)]
6+
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
7+
'PSReviewUnusedParameter',
8+
'Parameter',
9+
Justification = 'false positive'
10+
)]
11+
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
12+
'PSReviewUnusedParameter',
13+
'CommandAst',
14+
Justification = 'false positive'
15+
)]
16+
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
17+
'PSReviewUnusedParameter',
18+
'FakeBoundParams',
19+
Justification = 'false positive'
20+
)]
21+
[CmdletBinding(DefaultParameterSetName = 'task')]
22+
param(
23+
[parameter(ParameterSetName = 'task', Position = 0)]
24+
[ArgumentCompleter( {
25+
param($Command, $Parameter, $WordToComplete, $CommandAst, $FakeBoundParams)
26+
try {
27+
Get-PSakeScriptTasks -BuildFile './psakeFile.ps1' -ErrorAction 'Stop' |
28+
Where-Object { $_.Name -like "$WordToComplete*" } |
29+
Select-Object -ExpandProperty 'Name'
30+
} catch {
31+
@()
32+
}
33+
})]
34+
[string[]]$Task = 'default',
35+
[switch]$Bootstrap,
36+
[parameter(ParameterSetName = 'Help')]
37+
[switch]$Help
638
)
739

8-
# Grab nuget bits, install modules, set build variables, start build.
9-
Get-PackageProvider -Name NuGet -ForceBootstrap | Out-Null
40+
$ErrorActionPreference = 'Stop'
41+
$psakeFile = './psakeFile.ps1'
1042

11-
Install-Module Psake, PSDeploy, BuildHelpers -force -AllowClobber -Scope CurrentUser
12-
Install-Module Pester -RequiredVersion 4.10.1 -Force -AllowClobber -SkipPublisherCheck -Scope CurrentUser
13-
Import-Module Psake, BuildHelpers
43+
if ($Bootstrap) {
44+
if (-not (Get-PackageProvider -Name NuGet -ErrorAction SilentlyContinue)) {
45+
Install-PackageProvider -Name NuGet -Force -Scope CurrentUser | Out-Null
46+
}
47+
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
48+
if (-not (Get-Module -Name PSDepend -ListAvailable)) {
49+
Install-Module -Name PSDepend -Repository PSGallery -Scope CurrentUser -Force -RequiredVersion '0.3.8'
50+
}
51+
Import-Module -Name PSDepend -Verbose:$false
52+
Invoke-PSDepend -Path './requirements.psd1' -Install -Import -Force -WarningAction SilentlyContinue
53+
}
1454

15-
Set-BuildEnvironment -ErrorAction SilentlyContinue
16-
17-
Invoke-psake -buildFile $ENV:BHProjectPath\psake.ps1 -taskList $Task -nologo
18-
exit ( [int]( -not $psake.build_success ) )
55+
if ($PSCmdlet.ParameterSetName -eq 'Help') {
56+
Get-PSakeScriptTasks -BuildFile $psakeFile |
57+
Format-Table -Property Name, Description, Alias, DependsOn
58+
} else {
59+
Set-BuildEnvironment -Force
60+
Invoke-Psake -BuildFile $psakeFile -TaskList $Task -NoLogo
61+
exit ([int](-not $psake.build_success))
62+
}

deploy.psdeploy.ps1

Lines changed: 0 additions & 29 deletions
This file was deleted.

docs/en-US/Get-Dependency.md

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
---
2+
external help file: PSDepend-help.xml
3+
Module Name: PSDepend
4+
online version: https://github.com/PowerShellOrg/PSDepend
5+
schema: 2.0.0
6+
---
7+
8+
# Get-Dependency
9+
10+
## SYNOPSIS
11+
12+
Read a dependency psd1 file.
13+
14+
## SYNTAX
15+
16+
### File (Default)
17+
```
18+
Get-Dependency [-Path <String[]>] [-Tags <String[]>] [-Recurse] [-Credentials <Hashtable>]
19+
[-ProgressAction <ActionPreference>] [<CommonParameters>]
20+
```
21+
22+
### Hashtable
23+
```
24+
Get-Dependency [-Tags <String[]>] [-InputObject <Hashtable[]>] [-Credentials <Hashtable>]
25+
[-ProgressAction <ActionPreference>] [<CommonParameters>]
26+
```
27+
28+
## DESCRIPTION
29+
30+
Reads a PSDepend dependency file (.psd1) and returns structured dependency objects.
31+
32+
## EXAMPLES
33+
34+
### Example 1
35+
36+
```powershell
37+
Get-Dependency -Path .\requirements.psd1
38+
```
39+
40+
Returns all dependencies defined in requirements.psd1.
41+
42+
### Example 2
43+
44+
```powershell
45+
Get-Dependency -Path . -Recurse -Tags 'prod'
46+
```
47+
48+
Recursively finds all dependency files under the current directory and returns dependencies tagged 'prod'.
49+
50+
## PARAMETERS
51+
52+
### -Path
53+
54+
Path to project root or a specific dependency file.
55+
56+
```yaml
57+
Type: String[]
58+
Parameter Sets: File
59+
Aliases:
60+
61+
Required: False
62+
Position: Named
63+
Default value: None
64+
Accept pipeline input: False
65+
Accept wildcard characters: False
66+
```
67+
68+
### -Tags
69+
70+
Limit results to dependencies with one or more matching tags.
71+
72+
```yaml
73+
Type: String[]
74+
Parameter Sets: (All)
75+
Aliases:
76+
77+
Required: False
78+
Position: Named
79+
Default value: None
80+
Accept pipeline input: False
81+
Accept wildcard characters: False
82+
```
83+
84+
### -Recurse
85+
86+
Search recursively for dependency files under Path.
87+
88+
```yaml
89+
Type: SwitchParameter
90+
Parameter Sets: File
91+
Aliases:
92+
93+
Required: False
94+
Position: Named
95+
Default value: None
96+
Accept pipeline input: False
97+
Accept wildcard characters: False
98+
```
99+
100+
### -InputObject
101+
102+
Treat a hashtable as dependency file contents rather than reading from disk.
103+
104+
```yaml
105+
Type: Hashtable[]
106+
Parameter Sets: Hashtable
107+
Aliases:
108+
109+
Required: False
110+
Position: Named
111+
Default value: None
112+
Accept pipeline input: False
113+
Accept wildcard characters: False
114+
```
115+
116+
### -Credentials
117+
118+
Hashtable of PSCredentials keyed by credential name for private feeds.
119+
120+
```yaml
121+
Type: Hashtable
122+
Parameter Sets: (All)
123+
Aliases:
124+
125+
Required: False
126+
Position: Named
127+
Default value: None
128+
Accept pipeline input: False
129+
Accept wildcard characters: False
130+
```
131+
132+
### -ProgressAction
133+
{{ Fill ProgressAction Description }}
134+
135+
```yaml
136+
Type: ActionPreference
137+
Parameter Sets: (All)
138+
Aliases: proga
139+
140+
Required: False
141+
Position: Named
142+
Default value: None
143+
Accept pipeline input: False
144+
Accept wildcard characters: False
145+
```
146+
147+
### CommonParameters
148+
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
149+
150+
## INPUTS
151+
152+
### System.Collections.Hashtable[]
153+
154+
## OUTPUTS
155+
156+
### PSDepend.Dependency
157+
158+
## NOTES
159+
160+
## RELATED LINKS
161+
162+
[Invoke-PSDepend](Invoke-PSDepend.md)

0 commit comments

Comments
 (0)