Run on CI, Apply Rules on the Build and Get the Result back to the Pull Request.
Koshry:
1- Add Koshry to your build process:
Gradle:
implementation "io.github.tarek360.koshry:koshry:0.0.4"
2- Invoke Koshry with one rule at least.
val koshryConfig = koshry {
rules {
rule = rule1
rule = rule2
}
}
Koshry.run(koshryConfig)
3- Add one environment variable to your CI.
Add your git host (Github for example) token as an environment variable to allow Koshry post a comment and update the commit status.
Use KOSHRY_GIT_HOST_TOKEN
as a key of the environment variable.
Each Koshry Rule does some work then returns a Report (or not) as a result of that work.
While you can create your own custom rule, Koshry has some of the ready rules, you can make use of them directly. These rules are applied to the git diff of the pull request.
Check the Wiki to know How to write Koshry Rules
In a brief, when you call Koshry.run(koshryConfig)
, Koshry applies all the rules you have set and it aggregates all of the reports returned from the rules to one report, then it posts that report as a comment on the pull request.
Note: Kosrhy applies all of the rules sequentially.
I use Koshry here in this repository to apply some rules like JaCoCo Test Coverage rule to set the minimum percentage of test coverage of PRs, check Koshry report on one of my PRs here