Skip to content

Enhance GitHub Actions to build on ubuntu-latest and windows-latest#2162

Merged
jzabroski merged 2 commits into
mainfrom
copilot/fix-2161
Sep 7, 2025
Merged

Enhance GitHub Actions to build on ubuntu-latest and windows-latest#2162
jzabroski merged 2 commits into
mainfrom
copilot/fix-2161

Conversation

Copilot AI commented Sep 7, 2025

Copy link
Copy Markdown
Contributor

This PR enhances the CI/CD pipeline to run tests on both Linux and Windows platforms, addressing the need for broader platform testing while maintaining efficient use of TestContainers.

Changes Made

1. GitHub Actions Workflow Enhancement

  • Added OS Matrix: Extended the strategy matrix to include both ubuntu-latest and windows-latest
  • Conditional TestContainer Support: Moved TestContainer environment variables from global scope to step-level, enabling them only on Linux where they are supported
  • Artifact Management: Updated artifact names to include OS information to prevent conflicts between matrix jobs

2. Test Project Platform Detection

  • Replaced CI Environment Variable: Changed from using $(CI) to MSBuild's $([MSBuild]::IsOSPlatform('Linux')) for more accurate platform detection
  • Cross-Platform Target Framework Selection:
    • Linux builds target net8.0 with full TestContainer integration test support
    • Windows builds target net48 (.NET Framework) focusing on unit tests

Benefits

  • Increased Test Coverage: Validates FluentMigrator functionality on both major platforms
  • .NET Framework Validation: Ensures compatibility with .NET Framework 4.8 on Windows
  • Efficient Resource Usage: TestContainers only run where supported (Linux), avoiding Windows compatibility issues
  • Better OS Detection: Uses MSBuild's native platform detection instead of CI environment variables

Testing Behavior

Ubuntu (Linux):

  • Target Framework: net8.0
  • TestContainers: Enabled (all integration tests with database containers)
  • Environment Variables: All TestContainer settings set to true

Windows:

  • Target Framework: net48 (.NET Framework 4.8)
  • TestContainers: Disabled (unit tests only)
  • Environment Variables: All TestContainer settings set to false

This approach maximizes test coverage while working within the constraints that database vendors like Microsoft don't publish Windows images for SQL Server containers.

Fixes #2161.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI changed the title [WIP] Enhance GitHub Actions to build on ubuntu-latest and windows-latesr Enhance GitHub Actions to build on ubuntu-latest and windows-latest Sep 7, 2025
Copilot AI requested a review from jzabroski September 7, 2025 01:42
@github-actions

github-actions Bot commented Sep 7, 2025

Copy link
Copy Markdown

Test Results

    1 files      1 suites   33s ⏱️
5 326 tests 4 994 ✅ 332 💤 0 ❌
5 807 runs  5 211 ✅ 596 💤 0 ❌

Results for commit 187ce2a.

♻️ This comment has been updated with latest results.

@jzabroski
jzabroski marked this pull request as ready for review September 7, 2025 01:52
@jzabroski
jzabroski requested a review from PhenX September 7, 2025 01:52
@jzabroski
jzabroski merged commit d8df7ba into main Sep 7, 2025
4 checks passed
@jzabroski
jzabroski deleted the copilot/fix-2161 branch September 7, 2025 02:10
<PropertyGroup>
<TargetFramework Condition="'$(CI)' == 'true'">net8.0</TargetFramework>
<TargetFramework Condition="'$(CI)' == ''">net48</TargetFramework>
<TargetFramework Condition="$([MSBuild]::IsOSPlatform('Linux'))">net8.0</TargetFramework>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's far better than what I did

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.

Enhance GitHub Actions to build on ubuntu-latest and windows-latesr

3 participants