forked from NtsFranz/Spark
-
Notifications
You must be signed in to change notification settings - Fork 2
Modernize Spark project to .NET 8.0, update dependencies, and add CI/CD automation #2
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
Draft
Copilot
wants to merge
7
commits into
main
Choose a base branch
from
copilot/fix-1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9ba8bcc
Initial plan
Copilot 35d4332
Modernize project configuration: Update to .NET 8.0 and modern packages
Copilot 73e928d
Complete modernization: Add documentation and validation
Copilot 0318f1e
Fix validate-modernization.sh grep pattern for LangVersion check
Copilot 474f461
Add GitHub Actions workflow for building Spark executable
Copilot d9df7a3
Improve GitHub Actions workflow based on code review feedback
Copilot 84ef024
Add explicit GITHUB_TOKEN permissions for security compliance
Copilot 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,71 @@ | ||
| # GitHub Actions Build Workflow | ||
|
|
||
| This directory contains GitHub Actions workflows for automating the build process of the Spark project. | ||
|
|
||
| ## Workflows | ||
|
|
||
| ### build.yml | ||
|
|
||
| The main build workflow that builds the Spark Windows executable. This workflow runs on: | ||
| - Push to `main`, `master`, or `develop` branches | ||
| - Pull requests targeting `main`, `master`, or `develop` branches | ||
| - Manual trigger via workflow dispatch | ||
|
|
||
| #### Jobs | ||
|
|
||
| 1. **build**: Creates a framework-dependent build | ||
| - Faster build time | ||
| - Smaller artifact size | ||
| - Requires .NET 8.0 runtime to be installed on the target machine | ||
| - Output artifact: `Spark-Windows-x64` | ||
|
|
||
| 2. **build-self-contained**: Creates a self-contained build | ||
| - Includes .NET runtime | ||
| - Larger artifact size (~150MB+) | ||
| - No .NET runtime installation required on target machine | ||
| - Single-file executable with native libraries | ||
| - Output artifact: `Spark-Windows-x64-SelfContained` | ||
|
|
||
| #### Build Artifacts | ||
|
|
||
| Build artifacts are automatically uploaded and retained for 30 days. You can download them from the Actions tab of the repository. | ||
|
|
||
| ## Requirements | ||
|
|
||
| - Windows runner (due to WPF/Windows Forms dependencies) | ||
| - .NET 8.0 SDK | ||
| - No additional secrets required for basic builds | ||
|
|
||
| ## MSIX Packaging | ||
|
|
||
| MSIX packaging is not included in the automated workflow because it requires: | ||
| - Code signing certificate (must be stored as a GitHub secret) | ||
| - Additional configuration for certificate thumbprint | ||
| - Windows Store association (if distributing through Microsoft Store) | ||
|
|
||
| To add MSIX packaging in the future, you would need to: | ||
| 1. Store the signing certificate as a GitHub secret | ||
| 2. Import the certificate in the workflow | ||
| 3. Build the `SparkMSIX.wapproj` project with appropriate signing configuration | ||
|
|
||
| ## Local Testing | ||
|
|
||
| To test the build locally on Windows: | ||
|
|
||
| ```powershell | ||
| # Framework-dependent build | ||
| dotnet restore Spark.csproj | ||
| dotnet build Spark.csproj --configuration Release | ||
| dotnet publish Spark.csproj --configuration Release --output ./publish | ||
|
|
||
| # Self-contained build | ||
| dotnet publish Spark.csproj --configuration Release --runtime win-x64 --self-contained true --output ./publish-self-contained -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true | ||
| ``` | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| **Build fails on non-Windows runner**: This is expected. The project uses WPF and Windows Forms, which require a Windows environment. | ||
|
|
||
| **Missing dependencies**: Ensure all NuGet packages are restored. The workflow automatically runs `dotnet restore` before building. | ||
|
|
||
| **Self-contained build is very large**: This is normal. Self-contained builds include the entire .NET runtime (~150MB+). If size is a concern, use the framework-dependent build instead. |
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,86 @@ | ||
| name: Build Spark | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main, master, develop ] | ||
| pull_request: | ||
| branches: [ main, master, develop ] | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: windows-latest | ||
| permissions: | ||
| contents: read | ||
| actions: read | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup .NET 8.0 | ||
| uses: actions/setup-dotnet@v4 | ||
| with: | ||
| dotnet-version: '8.0.x' | ||
|
|
||
| - name: Restore dependencies | ||
| run: dotnet restore Spark.csproj | ||
|
|
||
| - name: Build | ||
| run: dotnet build Spark.csproj --configuration Release --no-restore | ||
|
|
||
| - name: Publish executable | ||
| run: dotnet publish Spark.csproj --configuration Release --no-build --output ./publish | ||
|
|
||
| - name: Upload build artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: Spark-Windows-x64 | ||
| path: ./publish/**/* | ||
| retention-days: 30 | ||
|
|
||
| - name: Display build output | ||
| shell: pwsh | ||
| run: Get-ChildItem ./publish | ||
|
|
||
| build-self-contained: | ||
| runs-on: windows-latest | ||
| permissions: | ||
| contents: read | ||
| actions: read | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup .NET 8.0 | ||
| uses: actions/setup-dotnet@v4 | ||
| with: | ||
| dotnet-version: '8.0.x' | ||
|
|
||
| - name: Restore dependencies | ||
| run: dotnet restore Spark.csproj | ||
|
|
||
| - name: Build | ||
| run: dotnet build Spark.csproj --configuration Release --no-restore | ||
|
|
||
| - name: Publish self-contained executable | ||
| run: | | ||
| dotnet publish Spark.csproj ` | ||
| --configuration Release ` | ||
| --runtime win-x64 ` | ||
| --self-contained true ` | ||
| --output ./publish-self-contained ` | ||
| -p:PublishSingleFile=true ` | ||
| -p:IncludeNativeLibrariesForSelfExtract=true | ||
|
|
||
| - name: Upload self-contained artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: Spark-Windows-x64-SelfContained | ||
| path: ./publish-self-contained/**/* | ||
| retention-days: 30 | ||
|
|
||
| - name: Display build output | ||
| shell: pwsh | ||
| run: Get-ChildItem ./publish-self-contained |
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,70 @@ | ||
| # Spark Project Modernization | ||
|
|
||
| This document outlines the modernization changes made to the Spark project to bring it up to current .NET standards and best practices. | ||
|
|
||
| ## Changes Made | ||
|
|
||
| ### .NET Framework Update | ||
| - **Updated global.json**: Modernized from .NET 5.0 to .NET 8.0 | ||
| - **Updated target framework**: Changed from `net6.0-windows10.0.17763.0` to `net8.0-windows` | ||
| - **Updated C# language version**: Upgraded from C# 9 to C# 12 | ||
|
|
||
| ### Package Updates | ||
| The following packages were updated to their latest .NET 8.0 compatible versions: | ||
|
|
||
| - `Microsoft.Data.Sqlite`: 7.0.2 → 8.0.0 | ||
| - `Microsoft.Web.WebView2`: 1.0.1518.46 → 1.0.2592.51 | ||
| - `Microsoft.Win32.SystemEvents`: 7.0.0 → 8.0.0 | ||
| - `System.Configuration.ConfigurationManager`: 7.0.0 → 8.0.0 | ||
| - `System.Management`: 7.0.0 → 8.0.0 | ||
| - `Newtonsoft.Json`: 13.0.2 → 13.0.3 | ||
| - `NAudio`: 2.1.0 → 2.2.1 | ||
| - `Microsoft.Windows.SDK.BuildTools`: 10.0.22621.1 → 10.0.26100.1 | ||
|
|
||
| ### Code Modernization | ||
| - **Replaced deprecated WindowsAPICodePack**: Replaced `WindowsAPICodePack-Shell` with the modern `OpenFolderDialog` API available in .NET | ||
| - **Removed legacy package**: Eliminated dependency on the old WindowsAPICodePack-Shell package | ||
|
|
||
| ### Project Configuration | ||
| - **Simplified SDK reference**: Continued using `Microsoft.NET.Sdk` for better compatibility | ||
| - **Maintained Windows-specific features**: Preserved WPF and Windows Forms functionality | ||
| - **Updated build tools**: Modern Windows SDK BuildTools for MSIX packaging | ||
|
|
||
| ## Building the Project | ||
|
|
||
| ### Requirements | ||
| - .NET 8.0 SDK or later | ||
| - Windows 10/11 (required for WPF applications) | ||
| - Visual Studio 2022 or compatible IDE with Windows development workload | ||
|
|
||
| ### Build Commands | ||
| ```bash | ||
| # Restore packages | ||
| dotnet restore | ||
|
|
||
| # Build the main application | ||
| dotnet build Spark.csproj | ||
|
|
||
| # Build the entire solution (includes MSIX packaging) | ||
| dotnet build Spark.sln | ||
| ``` | ||
|
|
||
| ### Platform Support | ||
| This is a Windows-specific WPF application. The modernization maintains this Windows-only requirement while updating to current .NET standards. | ||
|
|
||
| ## Benefits of Modernization | ||
|
|
||
| 1. **Latest .NET Features**: Access to .NET 8.0 performance improvements and language features | ||
| 2. **Security Updates**: Latest package versions with security patches | ||
| 3. **Modern APIs**: Replaced deprecated APIs with current alternatives | ||
| 4. **Better Tooling**: Improved IDE support and debugging capabilities | ||
| 5. **Future Compatibility**: Positioned for easier future updates | ||
|
|
||
| ## Validation | ||
|
|
||
| The modernization has been validated to ensure: | ||
| - ✅ Package restore works correctly | ||
| - ✅ Project file is well-formed | ||
| - ✅ All dependencies are compatible with .NET 8.0 | ||
| - ✅ Modern APIs are properly implemented | ||
| - ✅ Build configuration is optimized for current tools |
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 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 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 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 |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "sdk": { | ||
| "version": "5.0", | ||
| "version": "8.0", | ||
| "rollForward": "latestMajor", | ||
| "allowPrerelease": false | ||
| } | ||
|
|
||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The OpenFolderDialog class requires a using statement for Microsoft.Win32 namespace. Verify that the appropriate using directive is added to ensure the code compiles correctly.