This repository has been archived by the owner on Sep 2, 2023. It is now read-only.
build(deps): bump Microsoft.NET.Test.Sdk from 17.7.1 to 17.7.2 #75
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'Mutation tests' | |
on: | |
workflow_dispatch: # To can dispatch manually | |
push: # First pipeline to run when deploy a new version | |
branches: | |
- main | |
paths: | |
- "src/**" # Only run when exists changes in source code | |
- "tests/**" # Only run when exists changes in tests code | |
pull_request: | |
types: [opened, reopened, edited, synchronize] | |
branches: | |
- main | |
env: | |
SDK_VERSION: '7.0.306' | |
FRAMEWORK_VERSION: 'net7.0' | |
GIT_ORGANIZATION: 'TechNobre' | |
PROJECT_NAME: 'PowerUtils.GuardClauses.Validations' | |
TEST_PROJECT_PATH: 'tests/PowerUtils.GuardClauses.Validations.Tests/PowerUtils.GuardClauses.Validations.Tests.csproj' | |
permissions: | |
pull-requests: write # To can create a comment with the results | |
jobs: | |
test-project: | |
name: "Mutation tests" | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@v3 | |
- name: "Setup .NET" | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: ${{ env.SDK_VERSION }} | |
# Hack because the last version of the `xunit.runner.visualstudio` doesn't generate the report for some OLD SDK versions like .net 5 | |
- name: "Replace TargetFrameworks" | |
run: | | |
find . -type f -name "*.csproj" -exec sed -i 's/<TargetFrameworks>.*<\/TargetFrameworks>/<TargetFrameworks>${{ env.FRAMEWORK_VERSION }}<\/TargetFrameworks>/g' {} + | |
- name: "Restore .NET Tools" | |
run: dotnet tool restore | |
- name: "Restore dependencies" | |
run: dotnet restore | |
- name: "Build" | |
run: dotnet build --configuration Release --no-restore | |
- name: "Test for main version" | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
run: dotnet stryker -tp ${{ env.TEST_PROJECT_PATH }} --reporter markdown --reporter progress --reporter dashboard --dashboard-api-key ${{ secrets.STRYKER_API_KEY }} --version main | |
- name: "Get branch name" | |
if: github.event_name == 'pull_request' | |
id: branch-name | |
uses: tj-actions/branch-names@v7 | |
- name: "Display branch details" | |
if: github.event_name == 'pull_request' | |
run: | | |
echo "Branch name is ${{ steps.branch-name.outputs.current_branch }}" | |
- name: "Test for PR" | |
if: github.event_name == 'pull_request' | |
run: dotnet stryker -tp ${{ env.TEST_PROJECT_PATH }} --reporter markdown --reporter progress --reporter dashboard --dashboard-api-key ${{ secrets.STRYKER_API_KEY }} --version ${{ steps.branch-name.outputs.current_branch }}-${{ github.run_number }} | |
- name: "Comment PR" | |
uses: actions/github-script@v6.4.1 | |
if: github.event_name == 'pull_request' | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const { issue: { number: issue_number }, repo: { owner, repo } } = context; | |
const message = `🚀 **Stryker report generated** 🚀 | |
[![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2F${{ env.GIT_ORGANIZATION }}%2F${{ env.PROJECT_NAME }}%2F${{ steps.branch-name.outputs.current_branch }}-${{ github.run_number }})](https://dashboard.stryker-mutator.io/reports/github.com/${{ env.GIT_ORGANIZATION }}/${{ env.PROJECT_NAME }}/${{ steps.branch-name.outputs.current_branch }}-${{ github.run_number }}) | |
To more details: https://dashboard.stryker-mutator.io/reports/github.com/${{ env.GIT_ORGANIZATION }}/${{ env.PROJECT_NAME }}/${{ steps.branch-name.outputs.current_branch }}-${{ github.run_number }}`; | |
github.rest.issues.createComment({ | |
issue_number, | |
owner, | |
repo, | |
body: message | |
}); | |
- name: "Publish report" | |
run: | | |
cat $(find ./StrykerOutput/* -name "*.md") > $GITHUB_STEP_SUMMARY |