Skip to content

Commit 90c99d6

Browse files
authored
Merge pull request #12 from kurnakovv/sna-9
Sna 9
2 parents c4eeaf6 + b048173 commit 90c99d6

File tree

2 files changed

+40
-9
lines changed

2 files changed

+40
-9
lines changed

.github/workflows/all-params-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ jobs:
2626
config-path: ".config/stryker-config.json"
2727
dashboard-api-key: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
2828
report-source-branch: "true"
29-
report-source-branch-diff: "false"
29+
report-source-branch-diff: "true"
3030
upload-report: "true"
3131
send-report-message: "true"

action.yml

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,16 @@ runs:
3838
3939
echo "Target branch is $PR_BASE_REF"
4040
echo "TARGET_BRANCH=$PR_BASE_REF" >> $GITHUB_ENV
41-
echo "SINCE_PARAM=--since:$PR_BASE_REF" >> $GITHUB_ENV
4241
4342
echo "Source branch is $PR_REF"
4443
echo "SOURCE_BRANCH=$PR_REF" >> $GITHUB_ENV
44+
45+
if [[ "$REPORT_SOURCE_BRANCH_DIFF" == "true" ]]; \
46+
then
47+
echo "SINCE_PARAM=--since:$PR_BASE_REF" >> $GITHUB_ENV
48+
fi
49+
50+
echo "FULL_REPO_NAME=$PR_REPO_NAME" >>$GITHUB_ENV
4551
else
4652
echo "This is not a pull request"
4753
@@ -51,13 +57,19 @@ runs:
5157
5258
echo "Target branch is $DEFAULT_BRANCH"
5359
echo "TARGET_BRANCH=$DEFAULT_BRANCH" >> $GITHUB_ENV
54-
echo "SINCE_PARAM=--since:$DEFAULT_BRANCH" >> $GITHUB_ENV
60+
61+
if [[ "$REPORT_SOURCE_BRANCH_DIFF" == "true" ]]; \
62+
then
63+
echo "SINCE_PARAM=--since:$DEFAULT_BRANCH" >> $GITHUB_ENV
64+
fi
5565
else
5666
echo "Current branch is default ($REF_NAME == $DEFAULT_BRANCH)"
5767
fi
5868
5969
echo "Source branch is $REF_NAME"
6070
echo "SOURCE_BRANCH=$REF_NAME" >> $GITHUB_ENV
71+
72+
echo "FULL_REPO_NAME=$GITHUB_REPOSITORY" >>$GITHUB_ENV
6173
fi
6274
6375
if [[ "$CONFIG_PATH" != "" ]]; \
@@ -69,12 +81,6 @@ runs:
6981
then
7082
echo "DASHBOARD_API_KEY_PARAM=--dashboard-api-key $DASHBOARD_API_KEY" >> $GITHUB_ENV
7183
fi
72-
73-
if [ ${{ github.event_name }} = 'pull_request' ]; then
74-
echo "FULL_REPO_NAME=$PR_REPO_NAME" >>$GITHUB_ENV
75-
else
76-
echo "FULL_REPO_NAME=$GITHUB_REPOSITORY" >>$GITHUB_ENV
77-
fi
7884
env:
7985
PR_BASE_REF: ${{ github.event.pull_request.base.ref }}
8086
PR_REF: ${{ github.ref }}
@@ -83,6 +89,7 @@ runs:
8389
CONFIG_PATH: ${{ inputs.config-path }}
8490
DASHBOARD_API_KEY: ${{ inputs.dashboard-api-key }}
8591
PR_REPO_NAME: ${{ github.event.pull_request.head.repo.full_name }}
92+
REPORT_SOURCE_BRANCH_DIFF: ${{ inputs.report-source-branch-diff }}
8693
shell: bash
8794

8895
- name: Install Stryker.NET
@@ -101,6 +108,17 @@ runs:
101108
--output StrykerOutput
102109
shell: bash
103110

111+
- name: Report stryker (diff)
112+
if: "${{ github.ref_name != github.event.repository.default_branch && inputs.report-source-branch-diff == 'true' }}"
113+
run: |
114+
dotnet stryker \
115+
${{ env.CONFIG_PATH_PARAM }} \
116+
${{ env.SINCE_PARAM }} \
117+
${{ env.DASHBOARD_API_KEY_PARAM }} \
118+
--version ${{ env.SOURCE_BRANCH }}-diff \
119+
--output StrykerOutputDiff
120+
shell: bash
121+
104122
- name: Upload Stryker Report
105123
if: ${{ inputs.upload-report == 'true' }}
106124
id: artifact-upload-step
@@ -112,6 +130,10 @@ runs:
112130
${{github.workspace}}/StrykerOutput/**/**/*.md
113131
${{github.workspace}}/StrykerOutput/**/**/*.json
114132
133+
${{github.workspace}}/StrykerOutputDiff/**/**/*.html
134+
${{github.workspace}}/StrykerOutputDiff/**/**/*.md
135+
${{github.workspace}}/StrykerOutputDiff/**/**/*.json
136+
115137
- name: Add report message text
116138
run: |
117139
if [[ "$REPORT_SOURCE_BRANCH" == "true" ]]; \
@@ -121,6 +143,13 @@ runs:
121143
echo "REPORT_SOURCE_BRANCH_BADGE=---" >> $GITHUB_ENV
122144
fi
123145
146+
if [[ "$REPORT_SOURCE_BRANCH_DIFF" == "true" ]]; \
147+
then
148+
echo "REPORT_SOURCE_BRANCH_DIFF_BADGE=[![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https://badge-api.stryker-mutator.io/github.com/${{ env.FULL_REPO_NAME }}/${{ env.SOURCE_BRANCH }}-diff)](https://dashboard.stryker-mutator.io/reports/github.com/${{ env.FULL_REPO_NAME }}/${{ env.SOURCE_BRANCH }}-diff#mutant)" >> $GITHUB_ENV
149+
else
150+
echo "REPORT_SOURCE_BRANCH_DIFF_BADGE=---" >> $GITHUB_ENV
151+
fi
152+
124153
if [[ "$UPLOAD_REPORT" == "true" ]]; \
125154
then
126155
echo "UPLOAD_REPORT_BADGE=[![Static Badge](https://img.shields.io/badge/download-report-blue)](${{ steps.artifact-upload-step.outputs.artifact-url }})" >> $GITHUB_ENV
@@ -129,6 +158,7 @@ runs:
129158
fi
130159
env:
131160
REPORT_SOURCE_BRANCH: ${{ inputs.report-source-branch }}
161+
REPORT_SOURCE_BRANCH_DIFF: ${{ inputs.report-source-branch-diff }}
132162
UPLOAD_REPORT: ${{ inputs.upload-report }}
133163
shell: bash
134164

@@ -140,6 +170,7 @@ runs:
140170
141171
| Description | Badge |
142172
| ------------ | ----- |
173+
| Diff between `${{ env.TARGET_BRANCH }}` (target branch) and `${{ env.SOURCE_BRANCH }}` (source branch) | ${{ env.REPORT_SOURCE_BRANCH_DIFF_BADGE }} |
143174
| `${{ env.SOURCE_BRANCH }}` (source branch) statistics | ${{ env.REPORT_SOURCE_BRANCH_BADGE }} |
144175
| `${{ env.TARGET_BRANCH }}` (target branch) statistics | [![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https://badge-api.stryker-mutator.io/github.com/${{ env.FULL_REPO_NAME }}/${{ env.TARGET_BRANCH }})](https://dashboard.stryker-mutator.io/reports/github.com/${{ env.FULL_REPO_NAME }}/${{ env.TARGET_BRANCH }}#mutant) |
145176
| Download report from GitHub storage | ${{ env.UPLOAD_REPORT_BADGE }} |

0 commit comments

Comments
 (0)