Integration
CI/CD integration
The clean contract is simple: analyze everywhere, protect the committed baseline with diff on pull requests, and publish the HTML report when people need a shareable artifact. Keep the first run simple; add gates only after the team agrees on the baseline.
Minimal pattern
This is the smallest pipeline shape that preserves the zero-config first-run story while still enforcing regressions where it matters.
- Install the .NET SDK required by the repo.
- Install the global SimplicityTools CLI in the job.
- Run
dotnet simplicity analyzeon all relevant builds. - Run
dotnet simplicity diff --fail-on-regressionon pull requests once the baseline is committed. - Optionally generate
dotnet simplicity reportand publishsimplicity-report/as an artifact.
GitHub Actions
The GitHub Actions flow mirrors the docs source exactly: setup SDK, install tool, restore, analyze, and gate PRs with diff.
name: Complexity Check
on: [pull_request, push]
jobs:
simplicity:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- run: dotnet tool install --global SimplicityTools.Cli
- run: echo "$HOME/.dotnet/tools" >> $GITHUB_PATH
- run: dotnet restore
- run: dotnet simplicity analyze YourSolution.sln
- if: github.event_name == 'pull_request'
run: dotnet simplicity diff YourSolution.sln --fail-on-regression Azure Pipelines and GitLab CI
The contract does not change. Only the setup step syntax is platform-specific.
Azure Pipelines
- task: UseDotNet@2
inputs:
version: '10.0.x'
- script: dotnet tool install --global SimplicityTools.Cli
- script: echo "##vso[task.prependpath]$HOME/.dotnet/tools"
- script: dotnet restore
- script: dotnet simplicity diff $(Build.SourcesDirectory)/YourSolution.sln --fail-on-regression GitLab CI
complexity-check:
image: mcr.microsoft.com/dotnet/sdk:10.0
script:
- dotnet tool install --global SimplicityTools.Cli
- export PATH="$HOME/.dotnet/tools:$PATH"
- dotnet restore
- dotnet simplicity analyze $CI_PROJECT_DIR/YourSolution.sln
- dotnet simplicity diff $CI_PROJECT_DIR/YourSolution.sln --fail-on-regression Do not skip these operational details
The common failures are boring, which is exactly why they keep breaking otherwise good pipelines.
- Commit
.simplicity-baseline.jsonif you expect diff to work in CI. - Add
~/.dotnet/tools(or the Windows equivalent) to PATH explicitly in every job. - Restore the solution before running the CLI so analyzers and project references resolve consistently.
- Publish
simplicity-report/as an artifact if you want the HTML output to survive the job.