Skip to content

Commit

Permalink
ci(stryker): support mutation testing (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
skarllot authored Oct 29, 2023
1 parent 48088f6 commit 709ca26
Show file tree
Hide file tree
Showing 5 changed files with 115 additions and 5 deletions.
12 changes: 12 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-stryker": {
"version": "3.11.0",
"commands": [
"dotnet-stryker"
]
}
}
}
36 changes: 36 additions & 0 deletions .config/stryker-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"stryker-config": {
"target-framework": "net6.0",
"reporters": [
"json",
"html",
"markdown",
"dashboard"
],
"ignore-methods": [
"*Exception.ctor",
"ConfigureAwait",
"Dispose",
"DisposeAsync",
"DisposeAsyncCore",
"SuppressFinalize"
],
"mutate": [
"!**/Helpdesk*/**/*.*",
"!**/Common.Tests/**/*.*"
],
"thresholds": {
"break": 50
},
"since": {
"ignore-changes-in": [
"*.md",
".config/**/*.*",
".idea/**/*.*",
".github/**/*.*",
"samples/**/*.*"
]
},
"ignore-mutations": []
}
}
6 changes: 2 additions & 4 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,8 @@ jobs:
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
- name: Autobuild
uses: github/codeql-action/autobuild@74483a38d39275f33fcff5f35b679b5ca4a26a99 # v2.22.5
- name: Build
run: dotnet build -c Release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@74483a38d39275f33fcff5f35b679b5ca4a26a99 # v2.22.5
Expand Down
63 changes: 63 additions & 0 deletions .github/workflows/mutation-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: Mutation Test

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
DOTNET_GENERATE_ASPNET_CERTIFICATE: false
DOTNET_NOLOGO: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest

steps:
- name: Harden Runner
uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0
with:
egress-policy: audit

- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0

- name: Setup .NET
uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3.2.0
with:
dotnet-version: 6.0.x

- name: Setup NuGet cache
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/*.props') }}
restore-keys: ${{ runner.os }}-nuget-

- name: Stryker
run: |
dotnet tool install dotnet-stryker
dotnet stryker -f .config/stryker-config.json -O StrykerOutput --dashboard-api-key ${{ secrets.STRYKER_DASHBOARD_API_KEY }} -v main
if: github.event_name != 'pull_request'

- name: Stryker (Diff)
run: |
dotnet tool install dotnet-stryker
dotnet stryker -f .config/stryker-config.json -O StrykerOutput -r html --since:main
if: github.event_name == 'pull_request'

- name: Upload Mutation Report
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: mutation-report
path: StrykerOutput/reports/mutation-report.html
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
[![Build status](https://github.com/skarllot/Expressions/actions/workflows/dotnet.yml/badge.svg?branch=main)](https://github.com/skarllot/Expressions/actions)
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/skarllot/Expressions/badge)](https://securityscorecards.dev/viewer/?uri=github.com/skarllot/Expressions)
[![Code coverage](https://codecov.io/gh/skarllot/Expressions/branch/main/graph/badge.svg)](https://codecov.io/gh/skarllot/Expressions)
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://raw.githubusercontent.com/skarllot/Expressions/master/LICENSE)
[![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fskarllot%2FExpressions%2Fmain)](https://dashboard.stryker-mutator.io/reports/github.com/skarllot/Expressions/main)
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://raw.githubusercontent.com/skarllot/Expressions/master/LICENSE)

_Raiqub.Expressions is a library that provides abstractions for creating specifications and query strategies using LINQ expressions. It also supports querying and writing to databases using various providers._

Expand Down

0 comments on commit 709ca26

Please sign in to comment.