Skip to content

Split CI test execution by framework using matrix strategy and optimize workflow dependencies#320

Merged
witskeeper merged 8 commits into
mainfrom
copilot/split-test-framework-matrix
Dec 22, 2025
Merged

Split CI test execution by framework using matrix strategy and optimize workflow dependencies#320
witskeeper merged 8 commits into
mainfrom
copilot/split-test-framework-matrix

Conversation

Copilot AI commented Dec 22, 2025

Copy link
Copy Markdown
Contributor

Split dotnet test execution in CI workflows to run independently across net8.0, net9.0, and net10.0 using GitHub Actions matrix strategy for better visibility into framework-specific failures. Optimized workflow structure to ensure proper job dependencies and eliminate unnecessary builds in PR checks.

Changes

  • NetCorePal.SourceGenerator.UnitTests.csproj: Changed from single TargetFramework (net9.0) to multi-targeting TargetFrameworks (net8.0;net9.0;net10.0) to align with other test projects

  • .github/workflows/pr.yml:

    • Simplified to only include test job with matrix strategy
    • Removed build job (including docker build) to streamline PR checks
    • Added explicit contents: read permissions to test job
  • .github/workflows/dotnet.yml:

    • Restructured into 3 separate jobs: build, test, and pack-and-push
    • Test job runs with matrix strategy across frameworks
    • Pack and Push operations moved to separate pack-and-push job with needs: [build, test] dependency
    • Ensures package creation only happens after both build and all tests pass
    • Removed --settings .runsettings parameter from test commands
    • Added explicit contents: read permissions to test and pack-and-push jobs

Result

PR workflow runs only tests in parallel across all three framework versions for faster feedback.

Preview build workflow ensures proper job ordering:

  1. Build and test run independently in parallel
  2. Pack and push only execute after both succeed
test:
  strategy:
    matrix:
      framework: [net8.0, net9.0, net10.0]
  steps:
    - run: dotnet test --framework ${{ matrix.framework }}

pack-and-push:
  needs: [build, test]
  steps:
    - run: dotnet pack ...
    - run: dotnet nuget push ...
Original prompt

This section details on the original issue you should resolve

<issue_title>拆分test framework</issue_title>
<issue_description>1. 使用matrix 将CI的dotnet test按照 net8.0 、net9.0、 net10.0 分开

  1. 修改项目NetCorePal.SourceGenerator.UnitTests.csproj,改为net8.0;net9.0;net10.0</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 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.

Copilot AI and others added 3 commits December 22, 2025 06:39
…net10.0

Co-authored-by: witskeeper <5594094+witskeeper@users.noreply.github.com>
Co-authored-by: witskeeper <5594094+witskeeper@users.noreply.github.com>
Co-authored-by: witskeeper <5594094+witskeeper@users.noreply.github.com>
Copilot AI changed the title [WIP] Split CI dotnet test framework by version Split CI test execution by framework using matrix strategy Dec 22, 2025
Copilot AI requested a review from witskeeper December 22, 2025 06:43
@witskeeper

Copy link
Copy Markdown
Member

@copilot pr.yml 仅保留test即可,不需要build
dotnet.yml 需要test通过后再执行 Pack 和 Push

…/push after tests

Co-authored-by: witskeeper <5594094+witskeeper@users.noreply.github.com>

Copilot AI commented Dec 22, 2025

Copy link
Copy Markdown
Contributor Author

@copilot pr.yml 仅保留test即可,不需要build
dotnet.yml 需要test通过后再执行 Pack 和 Push

Done in commit 32ab482:

  • pr.yml: Removed build job, only test job remains
  • dotnet.yml: Split into build, test, and pack-and-push jobs where pack-and-push depends on both build and test passing via needs: [build, test]

Co-authored-by: witskeeper <5594094+witskeeper@users.noreply.github.com>
Copilot AI changed the title Split CI test execution by framework using matrix strategy Split CI test execution by framework using matrix strategy and optimize workflow dependencies Dec 22, 2025
@witskeeper
witskeeper marked this pull request as ready for review December 22, 2025 07:08
@witskeeper
witskeeper merged commit 0a954eb into main Dec 22, 2025
3 checks passed
@witskeeper
witskeeper deleted the copilot/split-test-framework-matrix branch December 22, 2025 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

拆分test framework

2 participants