This is a GitHub action that runs the Stryker.NET tool π½
- π‘ Generate a report for source branch
- πΎ Download the report
- π Upload the report to the dashboard
- π© Send a report message when PR is opened
- π Compare source and target branches
1οΈβ£ Install dotnet-stryker
(optional) | how?
2οΈβ£ Add a config file via terminal
dotnet stryker init --config-file ".config/stryker-config.json"
Or just create an empty file .config/stryker-config.json
3οΈβ£ Open .config/stryker-config.json
and set minimum parameters
{
"stryker-config": {
"reporters": [
"html",
"dashboard",
"progress",
],
"project-info": {
"name": "github.com/OWNER/YOUR_REPOSITORY_NAME"
}
}
}
Replace:
- OWNER - with your GitHub username (e.g.
kurnakovv
) - YOUR_REPOSITORY_NAME - with your repository name (e.g.
stryker-net-action
)
4οΈβ£ Add GitHub secret (how?):
- Name -
STRYKER_DASHBOARD_API_KEY
- Value - dashboard API key (how to get?)
5οΈβ£ Add the GitHub Action workflow at .github/workflows/stryker-net.yml
name: Stryker.NET mutation testing
on: [push, pull_request]
jobs:
stryker_net:
runs-on: ubuntu-latest
# permissions.pull-request:write is required to send a report message to a pull request (when send-report-message: "true")
permissions:
pull-requests: write
name: Stryker.NET GitHub action
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
- name: Stryker.NET
uses: kurnakovv/stryker-net-action@v1.0.0
with:
config-path: ".config/stryker-config.json"
dashboard-api-key: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
6οΈβ£ Push all changes and open a PR on the default branch (what is it?).
Once the pipeline completes successfully, you'll see something like this:
Note
If some steps do not suit you (e.g. you don't want to use the dashboard or send PR report message), you can disable/remove those options
Input | Location | Description | Required | Default |
---|---|---|---|---|
config-path | with | File path where configuration is located, for example .config/stryker-config.json / docs |
false | --- |
dashboard-api-key | with | Stryker dashboard API key / docs | false | --- |
report-source-branch | with | Run stryker report in current source branch (for default branch this parameter is always true) | false | true |
report-source-branch-diff | with | Run Stryker report and compare default branch with current source branch. I do not recommend using it, as it works with bugs, this feature is waiting for a fix in this issue | false | false |
upload-report | with | Upload report to GitHub cloud / what's under the hood? | false | true |
send-report-message | with | Send report message when PR is opened (add permissions.pull-requests: write to action / how?) / what's under the hood? |
false | --- |
Note
if you are missing some configurations, you can add them to your configuration file .config/stryker-config.json
| docs
- The official docs use Azure DevOps syntax, not GitHub Action
- The official repository doesn't work properly and has limited functionality. As the author stated (source):
This project is a proof of concept created during a hackfest, there is no active maintainer for this project at this time
- The unofficial repository contains no code and hasn't been updated in over 3 years
- You can use the source code, but it is too large to duplicate it in each repository, which violates the DRY principle
That's why I decided to create this action π₯
If you'd like to contribute and help improve this project β your support is very welcome β€οΈ
Instructions for all members are here
If you like this project, please give it a β β thanks! π€