Skip to content

Conversation

Copy link

Copilot AI commented Sep 5, 2025

The ./test/EFCore.MySql.IntegrationTests/scripts/rebuild.ps1 script was failing in GitHub Actions with "Build failed. Use dotnet build to see the errors." because it attempted to run Entity Framework Core commands without ensuring the project was properly restored and built first.

Problem

The original script sequence was:

  1. dotnet tool restore (fails due to network/package issues)
  2. Remove migration files
  3. dotnet ef database drop -f (fails: "Run dotnet tool restore")
  4. dotnet ef migrations add Initial (fails: "Run dotnet tool restore")
  5. dotnet ef database update (fails: "Run dotnet tool restore")

This caused cascading failures because EF Core tools require a successfully built project to operate.

Solution

Enhanced the rebuild script with proper .NET workflow:

  1. Package Restore - Added dotnet restore --ignore-failed-sources with error handling
  2. Build Verification - Added dotnet build -c Debug --no-restore with error handling
  3. Tool Setup - Improved dotnet tool restore with global fallback installation
  4. Migration Operations - All EF commands now run on a properly built project

Key Improvements

  • Network Resilience: Uses --ignore-failed-sources to handle connectivity issues
  • Early Exit: Script fails fast with clear error messages when restore/build fail
  • Tool Fallback: If local EF tool restore fails, attempts global installation
  • Progress Logging: Clear status messages for debugging
  • Safety Checks: Added Test-Path before file operations

The script now follows .NET best practices: restore → build → tools → EF operations, which should resolve the GitHub Actions CI failures.

Fixes #84.


💡 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 changed the title [WIP] Fix Run ./test/EFCore.MySql.IntegrationTests/scripts/rebuild.ps1 Fix rebuild.ps1 script failure in GitHub Actions by adding proper restore and build steps Sep 5, 2025
Copilot AI requested a review from renemadsen September 5, 2025 14:09
@renemadsen renemadsen marked this pull request as ready for review September 5, 2025 15:06
@renemadsen renemadsen merged commit cbeef22 into master Sep 5, 2025
1 of 55 checks passed
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.

Fix Run ./test/EFCore.MySql.IntegrationTests/scripts/rebuild.ps1

2 participants