I've successfully set up a modern GitHub Actions CI/CD workflow for your MCEControl project. Here's what was added:
- Triggers on:
- Push to
developbranch - Pull requests targeting
developbranch
- Push to
- Features:
- ? Builds the solution using .NET 10.0
- ? Runs all xUnit tests
- ? Generates code coverage reports (using coverlet)
- ? Publishes test results with visual reports
- ? Uploads artifacts (coverage & test results)
- ? Adds coverage summary to PR comments
- ? Validates coverage thresholds
- Validates PR title format (conventional commits)
- Checks for merge conflicts
- Skips draft PRs automatically
- Standardized PR description template
- Checklists for code quality
- Links to related issues
- Structured bug report template
- Environment details section
- Log attachment guidelines
- Feature request template
- Alternative solutions section
- Contribution willingness checkbox
- Automated dependency updates
- Groups minor/patch updates together
- Separate configs for main project and tests
- Weekly schedule on Mondays
- Complete documentation of all workflows
- Status badge example
- Local testing instructions
- Troubleshooting guide
Add this to your main README.md:
[](https://github.com/kindel/mcec/actions/workflows/ci.yml)Create a test PR to the develop branch to see the workflow in action:
git checkout -b test/github-actions
git add .github/
git commit -m "ci: Add GitHub Actions CI/CD workflows"
git push origin test/github-actionsThen create a PR targeting develop.
In .github/workflows/ci.yml, line 96, you can adjust the coverage threshold:
$threshold = 0 # Change to desired percentage (e.g., 70 for 70%)In your GitHub repository settings, consider adding:
- Require PR reviews before merging
- Require status checks to pass (select "Build and Test")
- Require branches to be up to date before merging
- Checkout - Gets your code
- Setup .NET - Installs .NET 10.0 SDK
- Restore - Downloads NuGet packages
- Build - Compiles the solution in Release mode
- Test - Runs all xUnit tests with coverage collection
- Report - Generates HTML coverage reports
- Upload - Stores test results and coverage as artifacts
- Validate - Checks coverage thresholds
- Windows-specific: Uses
windows-latestrunner (required for Windows Forms) - Fast feedback: Builds and tests on every PR
- Code coverage: Tracks test coverage with visual reports
- Test results: Beautiful test result summaries in PR checks
- Artifacts: 30-day retention of test results and coverage reports
- Dependabot: Automatic dependency updates
Run the same checks locally:
# From repository root
dotnet restore src/MCEControl.sln
dotnet build src/MCEControl.sln --configuration Release
dotnet test src/MCEControl.sln --configuration Release --collect:"XPlat Code Coverage"- See
.github/workflows/README.mdfor detailed documentation - GitHub Actions docs: https://docs.github.com/en/actions
- Dependabot docs: https://docs.github.com/en/code-security/dependabot
Once you push these changes, you can view workflow runs at:
https://github.com/kindel/mcec/actions
All files are ready to commit! The CI workflow will automatically run when you push to develop or create a PR.