From e3a5bf6d6f8d7c546cb35c4ef10254cd352b9f40 Mon Sep 17 00:00:00 2001 From: Shresht Srivastav <59516096+Shresht7@users.noreply.github.com> Date: Tue, 31 Mar 2026 19:31:37 +0530 Subject: [PATCH 1/4] Update target framework to net9.0 --- Build.ps1 | 8 ++++---- Predictor/PSFavoritePredictor.csproj | 5 ++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Build.ps1 b/Build.ps1 index 8fcd8ca..c9c9da4 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -6,7 +6,7 @@ .PARAMETER Configuration The configuration of the build (`Debug` or `Release`) [Default: `Debug`] .PARAMETER TargetFramework - The target framework of the build (`net7.0` or `net8.0`) [Default: `net8.0`] + The target framework of the build (`net8.0`, `net9.0` or `net10.0`) [Default: `net9.0`] .PARAMETER Clean If specified, cleans the project before building. .EXAMPLE @@ -24,10 +24,10 @@ param( [ValidateSet('Debug', 'Release')] [string] $Configuration = 'Debug', - # The target framework of the build (`net7.0` or `net8.0`) [Default: `net8.0`] - [ValidateSet("net7.0", "net8.0")] + # The target framework of the build (`net8.0`, `net9.0` or `net10.0`) [Default: `net9.0`] + [ValidateSet("net8.0", "net9.0", "net10.0")] [ValidateNotNullOrEmpty()] - [string] $TargetFramework = "net8.0", + [string] $TargetFramework = "net9.0", # Clean the project before building [switch] $Clean diff --git a/Predictor/PSFavoritePredictor.csproj b/Predictor/PSFavoritePredictor.csproj index c7a8bbf..e0f9a00 100644 --- a/Predictor/PSFavoritePredictor.csproj +++ b/Predictor/PSFavoritePredictor.csproj @@ -1,12 +1,11 @@ - - + - net8.0 + net9.0 enable enable PSFavoritePredictor From 60a940a646ce55ab64883d9e6e8833589a7daa21 Mon Sep 17 00:00:00 2001 From: Shresht Srivastav <59516096+Shresht7@users.noreply.github.com> Date: Tue, 31 Mar 2026 19:32:47 +0530 Subject: [PATCH 2/4] Refactor `Build.ps1` to use Join-Path for file paths --- Build.ps1 | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Build.ps1 b/Build.ps1 index c9c9da4..22b6f6b 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -34,7 +34,7 @@ param( ) # Path to the Predictor project -$Project = "$PSScriptRoot\Predictor\PSFavoritePredictor.csproj" +$Project = Join-Path $PSScriptRoot "Predictor" "PSFavoritePredictor.csproj" # Clean the project if the -Clean switch is specified if ($Clean) { @@ -55,16 +55,16 @@ if ($LASTEXITCODE -ne 0) { # Items to copy to the Module directory $Items = @( @{ - Source = "$PSScriptRoot\Predictor\bin\$Configuration\$TargetFramework\PSFavoritePredictor.dll" - Destination = "$PSScriptRoot\Module\Library\PSFavoritePredictor.dll" + Source = Join-Path $PSScriptRoot "Predictor" "bin" $Configuration $TargetFramework "PSFavoritePredictor.dll" + Destination = Join-Path $PSScriptRoot "Module" "Library" "PSFavoritePredictor.dll" }, @{ - Source = "$PSScriptRoot\README.md" - Destination = "$PSScriptRoot\Module\README.md" + Source = Join-Path $PSScriptRoot "README.md" + Destination = Join-Path $PSScriptRoot "Module" "README.md" }, @{ - Source = "$PSScriptRoot\LICENSE" - Destination = "$PSScriptRoot\Module\LICENSE" + Source = Join-Path $PSScriptRoot "LICENSE" + Destination = Join-Path $PSScriptRoot "Module" "LICENSE" } ) From 2bada0fae06f3337aac98a950cde2c65b9893684 Mon Sep 17 00:00:00 2001 From: Shresht Srivastav <59516096+Shresht7@users.noreply.github.com> Date: Tue, 31 Mar 2026 19:33:22 +0530 Subject: [PATCH 3/4] Update .NET version to 9.0.x in workflow files --- .github/workflows/publish.yml | 2 +- .github/workflows/test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 3b45e0e..d5e6103 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -20,7 +20,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v5 with: - dotnet-version: 8.0.x + dotnet-version: 9.0.x # Build the C# predictor and copy the DLL to the Module directory - name: Build Module diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7fc4651..56801f3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,7 +28,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v5 with: - dotnet-version: 8.0.x + dotnet-version: 9.0.x - name: Build Module shell: pwsh From 9025cae6ab71e490716c4c3eaf04e51bf78d39e4 Mon Sep 17 00:00:00 2001 From: Shresht Srivastav <59516096+Shresht7@users.noreply.github.com> Date: Tue, 31 Mar 2026 19:49:47 +0530 Subject: [PATCH 4/4] Remove workflow files GitHub Actions is a terrible place to test this with all these moving parts like PowerShell, PSReadline and .NET versions --- .github/workflows/publish.yml | 80 ----------------------------------- .github/workflows/test.yml | 55 ------------------------ 2 files changed, 135 deletions(-) delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index d5e6103..0000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,80 +0,0 @@ -name: Publish PowerShell Module - -on: - push: - tags: - - "v*.*.*" - -permissions: - contents: write - id-token: write - attestations: write - -jobs: - publish: - runs-on: ubuntu-latest - steps: - - name: Checkout Repository Code - uses: actions/checkout@v6 - - - name: Setup .NET - uses: actions/setup-dotnet@v5 - with: - dotnet-version: 9.0.x - - # Build the C# predictor and copy the DLL to the Module directory - - name: Build Module - shell: pwsh - run: ./Build.ps1 -Configuration Release - - # Ensure the config directory and file exist for both Linux and Windows runners, since the tests expect them to be present. - - name: Create Config Directory and File (Linux) - if: runner.os == 'Linux' - run: | - mkdir -p ~/.local/share/PSFavorite - echo '' > ~/.local/share/PSFavorite/Favorites.txt - - - name: Create Config Directory and File (Windows) - if: runner.os == 'Windows' - shell: pwsh - run: | - $configPath = "$env:LOCALAPPDATA\PSFavorite" - New-Item -ItemType Directory -Path $configPath -Force | Out-Null - New-Item -ItemType File -Path "$configPath\Favorites.txt" -Force | Out-Null - - # Ensure the built module passes all tests before proceeding - - name: Run Tests - shell: pwsh - run: | - Import-Module ./Module/PSFavorite.psd1 -Force - Invoke-Pester -Path ./Module/Tests -Output Detailed -PassThru - - # Zip the entire module directory (including the DLL) for attestation and release - - name: Zip Module - shell: pwsh - run: Compress-Archive -Path ./Module -DestinationPath ./PSFavorite.zip - - # actions/attest@v4 is the modern, consolidated action for all attestations. - # See: https://docs.github.com/en/actions/how-tos/secure-your-work/use-artifact-attestations/use-artifact-attestations - - name: Attest Build Provenance - uses: actions/attest@v4 - with: - subject-path: ${{ github.workspace }}/PSFavorite.zip - - # Create a release, attach the zipped module, and auto-generate notes from commits - # See: https://cli.github.com/manual/gh_release - - name: Create GitHub Release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh release create ${{ github.ref_name }} ./PSFavorite.zip \ - --title "Release ${{ github.ref_name }}" \ - --generate-notes - - # TODO: Enable this when ready to publish to PowerShell Gallery - # - name: Publish to PowerShell Gallery - # env: - # NUGET_KEY: ${{ secrets.NUGET_KEY }} - # shell: pwsh - # run: | - # Publish-Module -Path "./Module" -NuGetApiKey $env:NUGET_KEY -Verbose diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 56801f3..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: Test - -on: - push: - branches: ["main"] - paths: - - "Module/**" - - "Predictor/**" - - "Build.ps1" - pull_request: - branches: ["main"] - -jobs: - test: - name: Pester test (${{ matrix.os }}) - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, windows-latest] - - steps: - - name: Checkout Repository Code - uses: actions/checkout@v6 - with: - fetch-depth: 1 # Fetch only the latest commit to speed up the checkout process - - - name: Setup .NET - uses: actions/setup-dotnet@v5 - with: - dotnet-version: 9.0.x - - - name: Build Module - shell: pwsh - run: ./Build.ps1 -Configuration Release - - - name: Create Config Directory and File (Linux) - if: runner.os == 'Linux' - run: | - mkdir -p ~/.local/share/PSFavorite - echo '' > ~/.local/share/PSFavorite/Favorites.txt - - - name: Create Config Directory and File (Windows) - if: runner.os == 'Windows' - shell: pwsh - run: | - $configPath = "$env:LOCALAPPDATA\PSFavorite" - New-Item -ItemType Directory -Path $configPath -Force | Out-Null - New-Item -ItemType File -Path "$configPath\Favorites.txt" -Force | Out-Null - - - name: Run Tests - shell: pwsh - run: | - Import-Module ./Module/PSFavorite.psd1 -Force - Invoke-Pester -Path ./Module/Tests -Output Detailed -PassThru