-
Notifications
You must be signed in to change notification settings - Fork 222
Add github release logic when creating a release #3523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 2 commits
7672c87
3ac9c39
44ae6db
faf99ad
971b29b
47230cf
cf69d4b
ac928ee
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,11 +21,13 @@ Stryker.NET is a mutation testing framework for .NET projects. It allows you to | |
| ## Contributing Workflow | ||
|
|
||
| ### Code Standards | ||
|
|
||
| - Follow the repository's `.editorconfig` and [Microsoft C# coding guidelines](https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/inside-a-program/coding-conventions) | ||
| - Create or edit unit tests or integration tests for all changes | ||
| - Update documentation when adding features | ||
|
|
||
| ### Pull Request Title Convention | ||
|
|
||
| When creating or updating pull requests, **always** use Angular-style conventional commit format for PR titles: | ||
| - Format: `<type>(<scope>): <subject>` | ||
| - Types: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert` | ||
|
|
@@ -38,13 +40,15 @@ When creating or updating pull requests, **always** use Angular-style convention | |
| **Why**: The project uses squash merging, so the PR title becomes the commit message in the main branch history. | ||
|
|
||
| ### Running Tests | ||
| - **Unit tests**: Run `dotnet test` in the `/src` directory | ||
|
|
||
| - **Unit tests**: Run `dotnet test` in the `/src` directory or use your IDE's test runner | ||
| - **Integration tests**: | ||
| - On **Windows**: Run `.\integration-tests.ps1` in the root of the repo (PowerShell 7 recommended) | ||
| - On **macOS/Linux**: Run `pwsh ./integration-tests.ps1` in the root of the repo (requires [PowerShell 7](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell)) | ||
| - Always run unit tests and integration tests before committing changes | ||
| - Always run unit tests and integration after making a change to ensure nothing is broken | ||
|
|
||
| ### Testing Locally | ||
|
|
||
| To test Stryker.NET on a project: | ||
| 1. In `Stryker.CLI`, open `properties > Debug` | ||
| 2. Create a new Debug profile | ||
|
|
@@ -55,31 +59,3 @@ To test Stryker.NET on a project: | |
|
|
||
| **Note**: Running Stryker on itself doesn't work as assemblies will be in use. To run Stryker on the stryker codebase, use the official nuget release via `dotnet tool install dotnet-stryker` and then `dotnet stryker`. | ||
|
|
||
|
Comment on lines
55
to
61
|
||
| ## Adding a New Mutator | ||
|
|
||
| See the full guide in [adding_a_mutator.md](../adding_a_mutator.md). | ||
|
|
||
| ### Key Points for Mutators | ||
| 1. **Purpose**: Generate mutations that look like possible human errors, not just any mutation | ||
| 2. **Performance**: Keep mutators fast - they're called on every syntax element | ||
| 3. **Buildable**: Generated mutations should compile in most situations | ||
| 4. **Killable**: Avoid mutations that always raise exceptions or are semantically equivalent | ||
| 5. **General**: Mutators should work for all projects, not be framework-specific | ||
|
|
||
| ### Implementation Steps | ||
| 1. Create a class inheriting from `MutatorBase<T>` and implementing `IMutator` | ||
| 2. Specify the expected `SyntaxNode` class you can mutate (e.g., `StatementSyntax`) | ||
| 3. Override the `MutationLevel` property (typically `Complete` or `Advanced`) | ||
| 4. Override `ApplyMutation<T>` to generate mutations | ||
| 5. Add an entry in the `Mutator` enum | ||
| 6. Create an instance in the `CsharpMutantOrchestrator` constructor | ||
| 7. Add comprehensive unit tests | ||
| 8. Update [docs/mutations.md](../docs/mutations.md) | ||
|
|
||
| ### Mutator Guidelines | ||
| - Use Roslyn APIs to work with syntax trees, not text transformations | ||
| - Each mutator is called on every syntax element recursively | ||
| - Return an empty list or `yield break` if no mutation can be generated | ||
| - Mutators must not throw exceptions | ||
| - Support various C# syntax versions (expression body vs block statement) | ||
| - Invest in unit tests early - look at existing mutator tests for examples | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,10 @@ | ||
| # Change Log | ||
|
|
||
| All notable changes to this project will be documented in a package specific changelog file: | ||
| All notable changes will be documented in this file. | ||
|
|
||
| * [Change log for stryker](/src/Stryker.Core/CHANGELOG.md) | ||
| * [Change log for dotnet-stryker](/src/Stryker.CLI/CHANGELOG.md) | ||
| For historical release notes prior to the consolidated changelog, see the package-specific files: | ||
|
|
||
| * [Historical change log for stryker](/src/Stryker.Core/CHANGELOG.md) | ||
| * [Historical change log for dotnet-stryker](/src/Stryker.CLI/CHANGELOG.md) | ||
|
|
||
| <!-- changelog --> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,8 +2,8 @@ | |
| Releasing a new version of the Stryker.NET packages can be done by following these steps: | ||
| 1. Clone the repo or checkout (and pull) the master branch. | ||
| 2. Look at the commits since the last release and determine the next version number. If we are on 0.11.0 and there are only bugfixes and refactorings: we go to 0.11.1. If there are also new features or breaking changes, we go to 0.12.0. | ||
| 3. Run `npm run prepare-release` from the root of the repo and enter the new version number. | ||
| 4. Verify that the commit is on GitHub and the releases in GitHub have been made. | ||
| 3. Run `npm run prepare-release` from the root of the repo and enter the new version number. This will automatically create GitHub releases for the new tags with the correct release notes from the changelogs. | ||
| 4. Verify that the commit is on GitHub and that the GitHub releases for the new version have been created. | ||
|
Comment on lines
+5
to
+6
|
||
| 5. Wait for build on master to complete on Azure Pipelines and then start the Production environment on Azure Pipelines. | ||
| 6. Approve the Production environment on Azure Pipelines (this approval prevents accidental releases). | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -48,21 +48,32 @@ | |||||||
| console.log(`Updating version numbers in ${pckg.csproj}`); | ||||||||
| replaceVersionNumber(pckg.csproj, `<VersionPrefix>${oldVersionPrefix}</VersionPrefix>`, `<VersionPrefix>${versionPrefix}</VersionPrefix>`); | ||||||||
| replaceVersionNumber(pckg.csproj, `<VersionSuffix>${oldVersionSuffix}</VersionSuffix>`, `<VersionSuffix>${versionSuffix}</VersionSuffix>`); | ||||||||
| }); | ||||||||
|
|
||||||||
| if (!versionSuffix) { | ||||||||
| console.log(`Updating changelog for ${pckg.name}`); | ||||||||
| commitMessageLines.push(`- ${pckg.name}@${newVersionNumber}`); | ||||||||
| exec(`npx conventional-changelog-cli -p angular --infile "${pckg.path}/CHANGELOG.md" --same-file --commit-path ${pckg.path} --tag-prefix "${pckg.name}@"`); | ||||||||
| let releaseNotes = ''; | ||||||||
| if (!versionSuffix) { | ||||||||
| console.log(`Updating changelog`); | ||||||||
| commitMessageLines.push(`- dotnet-stryker@${newVersionNumber}`); | ||||||||
| releaseNotes = execSync(`npx conventional-changelog-cli -p angular --tag-prefix "dotnet-stryker@"`, { encoding: 'utf8' }).trim(); | ||||||||
|
||||||||
| releaseNotes = execSync(`npx conventional-changelog-cli -p angular --tag-prefix "dotnet-stryker@"`, { encoding: 'utf8' }).trim(); | |
| const changelogCommand = 'npx conventional-changelog-cli -p angular --tag-prefix "dotnet-stryker@" --release-count 1'; | |
| releaseNotes = execSync(changelogCommand, { encoding: 'utf8' }).trim(); |
Copilot
AI
Apr 4, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The temp file .release-notes.md is deleted only if git tag succeeds; if git tag throws, the file is left behind in the repo root. Using a try/finally cleanup (and ideally a unique temp file location such as os.tmpdir()/fs.mkdtemp) would prevent leftover files and avoid collisions if the script is re-run.
Copilot
AI
Apr 4, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newVersionNumber is interpolated into shell commands (git tag ...${newVersionNumber}... and gh release create ...${newVersionNumber}...) executed via execSync with a string, which runs through a shell. Even though this is a maintainer script, it’s safer to validate the version input (e.g., strict semver) and/or use execFileSync/spawnSync with an argument array to avoid shell injection and quoting issues.
Check warning on line 87 in prepare-release.js
SonarQubeCloud / SonarCloud Code Analysis
Prefer `node:child_process` over `child_process`.
See more on https://sonarcloud.io/project/issues?id=stryker-net&issues=AZ1ZCz9Vmm9_Jq1qJrTV&open=AZ1ZCz9Vmm9_Jq1qJrTV&pullRequest=3523
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,4 +11,4 @@ | |
| "ms-vscode.powershell" | ||
| ] | ||
| } | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sentence is missing a word and reads incorrectly; update 'integration' to 'integration tests' for clarity and grammar.