CI: Add Windows matrix leg with platform-conditional testing#143
CI: Add Windows matrix leg with platform-conditional testing#143
Conversation
Co-authored-by: benaadams <1142958+benaadams@users.noreply.github.com>
Co-authored-by: benaadams <1142958+benaadams@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds a GitHub Actions CI workflow to provide cross-platform coverage for Magma’s Linux- and Windows-specific components, ensuring the solution is built and tests are executed appropriately per runner OS.
Changes:
- Introduces an OS matrix (
ubuntu-latest,windows-latest) with restore/build/test steps. - Runs all tests on Linux, while running a curated subset of test projects on Windows to avoid Linux-only test projects.
- Adds a Windows-only build verification step for the WinTun sample and sets minimal workflow permissions.
.github/workflows/ci.yml
Outdated
| - name: Setup .NET | ||
| uses: actions/setup-dotnet@v4 | ||
| with: | ||
| dotnet-version: '10.0.x' |
There was a problem hiding this comment.
actions/setup-dotnet installs 10.0.x, but global.json pins the repo to SDK 10.0.102 (roll-forward only within the same feature band). If setup-dotnet installs a different feature band (e.g., 10.0.3xx), dotnet build/test can fail because the required SDK isn’t present. Use 10.0.102 (or a 10.0.1xx range) to match global.json.
| dotnet-version: '10.0.x' | |
| dotnet-version: '10.0.102' |
.github/workflows/ci.yml
Outdated
| - name: Cache NuGet packages | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: ~/.nuget/packages | ||
| key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-nuget- |
There was a problem hiding this comment.
NuGet cache path: ~/.nuget/packages is not reliably portable on Windows runners (the cache action doesn’t consistently expand ~ on Windows). Prefer actions/setup-dotnet's built-in NuGet caching (cache: true) or cache ${{ env.USERPROFILE }}\.nuget\packages / ${{ env.NUGET_PACKAGES }} after setting it explicitly.
|
@copilot apply changes based on the comments in this thread |
|
@copilot try again |
- Fix YAML indentation: properly indent steps under steps key - Use exact .NET SDK version (10.0.102) to match global.json - Replace manual NuGet cache with setup-dotnet built-in cache - Remove redundant WinTun sample build verification step Co-authored-by: benaadams <1142958+benaadams@users.noreply.github.com>
Applied all review feedback in commit 85cd4f8:
|
benaadams
left a comment
There was a problem hiding this comment.
Both CI jobs fail at the Setup .NET step with:
Dependencies lock file is not found in /home/runner/work/Magma/Magma. Supported file patterns: packages.lock.json
The actions/setup-dotnet@v4 with cache: true requires a packages.lock.json file to exist in the repo for NuGet package caching. Since this project doesn't use NuGet lock files, the step fails before build/test even run.
Fix: Remove cache: true from the setup-dotnet step:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.102'Alternatively, if NuGet caching is desired, you'd need to either:
- Add
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>toDirectory.Build.propsand commit the generatedpackages.lock.jsonfiles, or - Switch to
actions/cache@v4with a custom key based on**/*.csprojfiles instead.
Add RestorePackagesWithLockFile to Directory.Build.props and commit generated packages.lock.json files so setup-dotnet cache: true works. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The setup-dotnet action looks for packages.lock.json in the repo root by default. Point it at the per-project lock files with a glob. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
.github/workflows/ci.ymlwith Linux and Windows matrixubuntu-latestandwindows-latestOriginal prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.