-
Notifications
You must be signed in to change notification settings - Fork 10
CI/CD setup, deprecate appveyor #60
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
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
59503ad
Add GitHub Actions CI/CD, replace AppVeyor
wardbox ec8f4fb
Address code review nitpicks for CI/CD
wardbox 7471aad
Fix Get-StorePath not in scope for Application Management tests
wardbox a0d2218
Bump version to 1.2.0
wardbox e7a38a5
Add module path validation before publish
wardbox 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| branches: [main] | ||
|
|
||
| jobs: | ||
| lint: | ||
| name: PSScriptAnalyzer | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Run PSScriptAnalyzer | ||
| shell: pwsh | ||
| run: | | ||
| Install-Module -Name PSScriptAnalyzer -Force -Scope CurrentUser | ||
| $results = Invoke-ScriptAnalyzer -Path ./Spotishell -Recurse -Settings ./PSScriptAnalyzerSettings.psd1 | ||
| $results | Format-Table -AutoSize | ||
| if ($results) { | ||
| Write-Error "PSScriptAnalyzer found $($results.Count) issue(s)" | ||
| exit 1 | ||
| } | ||
|
|
||
| test: | ||
| name: Pester Tests | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: [ubuntu-latest, windows-latest, macos-latest] | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Run Pester Tests | ||
| shell: pwsh | ||
| run: | | ||
| Install-Module -Name Pester -Force -Scope CurrentUser -MinimumVersion 5.0.0 | ||
| Import-Module Pester | ||
|
|
||
| $config = New-PesterConfiguration | ||
| $config.Run.Path = './Tests' | ||
| $config.Run.Exit = $true | ||
| $config.TestResult.Enabled = $true | ||
| $config.TestResult.OutputPath = 'testResults.xml' | ||
| $config.Output.Verbosity = 'Detailed' | ||
|
|
||
| Invoke-Pester -Configuration $config | ||
|
|
||
| - name: Upload Test Results | ||
| uses: actions/upload-artifact@v4 | ||
| if: always() | ||
| with: | ||
| name: test-results-${{ matrix.os }} | ||
| path: testResults.xml | ||
|
|
||
| module-validation: | ||
| name: Module Validation | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Validate Module Manifest | ||
| shell: pwsh | ||
| run: | | ||
| $manifest = Test-ModuleManifest -Path ./Spotishell/Spotishell.psd1 -ErrorAction Stop | ||
| Write-Host "Module: $($manifest.Name)" | ||
| Write-Host "Version: $($manifest.Version)" | ||
| Write-Host "Description: $($manifest.Description)" | ||
|
|
||
| - name: Test Module Import | ||
| shell: pwsh | ||
| run: | | ||
| Import-Module ./Spotishell/Spotishell.psd1 -Force -ErrorAction Stop | ||
| $commands = Get-Command -Module Spotishell | ||
| Write-Host "Exported $($commands.Count) commands" | ||
| if ($commands.Count -eq 0) { | ||
| Write-Error "No commands exported from module" | ||
| exit 1 | ||
| } |
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,75 @@ | ||
| name: Publish to PowerShell Gallery | ||
|
|
||
| on: | ||
| release: | ||
| types: [published] | ||
|
|
||
| jobs: | ||
| publish: | ||
| name: Publish Module | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Validate Release Tag | ||
| shell: pwsh | ||
| run: | | ||
| $tag = "${{ github.ref_name }}" | ||
| $manifest = Test-ModuleManifest -Path ./Spotishell/Spotishell.psd1 | ||
| $moduleVersion = $manifest.Version.ToString() | ||
|
|
||
| # Strip 'v' prefix if present | ||
| $tagVersion = $tag -replace '^v', '' | ||
|
|
||
| Write-Host "Release tag: $tag" | ||
| Write-Host "Tag version: $tagVersion" | ||
| Write-Host "Module version: $moduleVersion" | ||
|
|
||
| if ($tagVersion -ne $moduleVersion) { | ||
| Write-Error "Version mismatch! Tag '$tagVersion' does not match module version '$moduleVersion'" | ||
| Write-Error "Update ModuleVersion in Spotishell.psd1 to match the release tag" | ||
| exit 1 | ||
| } | ||
|
|
||
| Write-Host "Version validation passed!" | ||
|
|
||
| - name: Run Tests | ||
| shell: pwsh | ||
| run: | | ||
| Install-Module -Name Pester -Force -Scope CurrentUser -MinimumVersion 5.0.0 | ||
| Import-Module Pester | ||
|
|
||
| $config = New-PesterConfiguration | ||
| $config.Run.Path = './Tests' | ||
| $config.Run.Exit = $true | ||
| $config.Output.Verbosity = 'Detailed' | ||
|
|
||
| Invoke-Pester -Configuration $config | ||
|
|
||
| - name: Publish to PowerShell Gallery | ||
| shell: pwsh | ||
| env: | ||
| PSGALLERY_API_KEY: ${{ secrets.PSGALLERY_API_KEY }} | ||
| run: | | ||
| $modulePath = './Spotishell' | ||
| $manifestPath = './Spotishell/Spotishell.psd1' | ||
|
|
||
| if (-not (Test-Path $modulePath -PathType Container)) { | ||
| Write-Error "Module directory not found: $modulePath" | ||
| exit 1 | ||
| } | ||
|
|
||
| if (-not (Test-Path $manifestPath -PathType Leaf)) { | ||
| Write-Error "Module manifest not found: $manifestPath" | ||
| exit 1 | ||
| } | ||
|
|
||
| if (-not $env:PSGALLERY_API_KEY) { | ||
| Write-Error "PSGALLERY_API_KEY secret is not set" | ||
| exit 1 | ||
| } | ||
|
|
||
| Write-Host "Publishing Spotishell to PowerShell Gallery..." | ||
| Publish-Module -Path $modulePath -NuGetApiKey $env:PSGALLERY_API_KEY -Verbose -ErrorAction Stop | ||
| Write-Host "Successfully published to PowerShell Gallery!" | ||
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,33 @@ | ||
| @{ | ||
| # PSScriptAnalyzer settings for Spotishell | ||
| # https://github.com/PowerShell/PSScriptAnalyzer | ||
| # | ||
| # Note: Many rules are excluded due to pre-existing code patterns. | ||
| # TODO: Address these in a dedicated code quality improvement PR | ||
|
|
||
| Severity = @('Error', 'Warning') | ||
|
|
||
| ExcludeRules = @( | ||
| # Existing function names use plural nouns (Get-PlaylistItems, etc.) | ||
| # Changing would break backward compatibility | ||
| 'PSUseSingularNouns' | ||
|
|
||
| # ShouldProcess support requires significant refactoring | ||
| 'PSUseShouldProcessForStateChangingFunctions' | ||
|
|
||
| # Write-Host is used intentionally for user feedback during OAuth flow | ||
| 'PSAvoidUsingWriteHost' | ||
|
|
||
| # Pipeline commands use ForEach instead of process blocks (existing pattern) | ||
| 'PSUseProcessBlockForPipelineCommand' | ||
|
|
||
| # Manifest uses wildcards for exports (working as intended) | ||
| 'PSUseToExportFieldsInManifest' | ||
|
|
||
| # Some files don't have BOM (not causing issues) | ||
| 'PSUseBOMForUnicodeEncodedFile' | ||
|
|
||
| # False positives on parameters used in child scopes | ||
| 'PSReviewUnusedParameter' | ||
| ) | ||
| } |
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
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.