Kait.Tool
0.0.6
dotnet tool install --global Kait.Tool --version 0.0.6
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest # if you are setting up this repo dotnet tool install --local Kait.Tool --version 0.0.6
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=Kait.Tool&version=0.0.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
nuke :add-package Kait.Tool --version 0.0.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
kait
.NET tool to determine changed projects in a git repository, heavily inspired by dotnet-affected. Think of it as a more opinionated version with less features, less tests and more bugs.
Description:
Usage:
kait [<directory>] [options]
Arguments:
<directory> Directory to operate on, if not specified current directory will be used. [default: {CurrentDirectory}]
Options:
--base, --base-reference <base-reference>
--format <Json|Plain|Slnf|Traversal> Format of the output file
--out, --output <output> Path to output file, if not specified stdout will be used.
--loglevel <Critical|Debug|Error|Information|None|Trace|Warning> [default: Warning]
--project <project> Project or solution to derive entrypoints from
--relative-output Output paths should be relative to current directory or output file if specified
--version Show version information
-?, -h, --help Show help and usage information
Examples
Github Actions
Test all affected projects in pull request
name: Test affected projects
on:
pull_request:
branches: [ "main" ]
jobs:
test_affected_projects:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install kait
run: dotnet tool install --global Kait.Tool
# GitHub automatically creates a merge commit, use this to diff files
- name: Calculate affected projects
run: kait --base=HEAD~1 --project Kait.sln --output affected.slnf --loglevel=Debug
- name: Test affected projects
run: dotnet test affected.slnf --verbosity normal
Publish affected projects on main branch
jobs:
publish_affected_projects:
runs-on: ubuntu-latest
permissions:
contents: 'read'
actions: 'read'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install kait
run: dotnet tool install --global Kait.Tool
- name: Derive appropriate SHA for base
uses: nrwl/nx-set-shas@v4
- name: Print sha
run: |
echo "BASE: ${{ env.NX_BASE }}"
- name: Calculate affected projects
run: kait --base=${{ env.NX_BASE }} --project Kait.sln --output affected.slnf
- name: Publish affected projects
run: dotnet publish affected.slnf
Azure Pipelines
Test all affected projects in pull request
# This has not been tested yet
# Assume this is triggered via a branch policy in Azure DevOps
trigger: none
pool:
vmImage: 'ubuntu-latest'
steps:
- checkout: self
fetchDepth: 0
persistCredentials: true
# Azure DevOps creates a merge commit with the target branch, use this to diff files
- bash: kait --base=HEAD~1 --project Kait.sln --output affected.slnf
displayName: Calculate affected projects
- bash: dotnet test affected.slnf
displayName: Publish affected projects
Publish affected projects on main branch
# This has not been tested yet
trigger:
- main
pool:
vmImage: 'ubuntu-latest'
variables:
BASE_SHA: HEAD~1
steps:
- checkout: self
fetchDepth: 0
persistCredentials: true
- bash: az devops configure --defaults organization=$(System.TeamFoundationCollectionUri) project=$(System.TeamProject)
displayName: 'Set default Azure DevOps organization and project'
- bash: |
LAST_SHA=$(az pipelines build list --branch $(Build.SourceBranchName) --definition-ids $(System.DefinitionId) --result succeeded --top 1 --query "[0].triggerInfo.\"ci.sourceSha\"")
if [ -z "$LAST_SHA" ]
then
echo "Last successful commit not found. Using fallback 'HEAD~1'"
else
echo "Last successful commit SHA: $LAST_SHA"
echo "##vso[task.setvariable variable=BASE_SHA]$LAST_SHA"
fi
- bash: kait --base=$(BASE_SHA) --project Kait.sln --output affected.slnf
displayName: Calculate affected projects
- bash: dotnet publish affected.slnf
displayName: Publish affected projects
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.