|
| 1 | +# Koshry |
| 2 | + |
| 3 | + |
| 4 | +## What's Koshry? |
| 5 | +**Koshry**: |
| 6 | +- is a dev tool, runs during your **CI Build** or on your **Local Machine Build**. |
| 7 | +- gives your team the ability to monitor **pull requests** and take automatic **actions** depend on your rules result. |
| 8 | +- create a report of the result of applying your rules on the pull request and post it back as a comment on the pull request. |
| 9 | +- is written in **Kotlin** and runs on JVM. |
| 10 | +- has some of the [ready rules](https://github.com/tarek360/koshry/wiki) for common use cases. |
| 11 | +- is **customizable**, you can [write your own **Custom Rule**](https://medium.com/@Tarek360/your-first-koshry-rule-c6648ac34ca2), everything is a **Rule** in Koshry. |
| 12 | +- works on any project whatever the programming language you use in your project |
| 13 | + |
| 14 | + |
| 15 | +## Run Koshry in 3 steps: |
| 16 | + |
| 17 | +**1-** Add Koshry to your build process: |
| 18 | + |
| 19 | +Gradle: |
| 20 | +```gradle |
| 21 | +implementation "io.github.tarek360.koshry:koshry:0.0.4" |
| 22 | +``` |
| 23 | + |
| 24 | +**2-** Invoke Koshry with one rule at least. |
| 25 | + |
| 26 | +```kotlin |
| 27 | +val koshryConfig = koshry { |
| 28 | + rules { |
| 29 | + rule = rule1 |
| 30 | + rule = rule2 |
| 31 | + } |
| 32 | +} |
| 33 | + |
| 34 | +Koshry.run(koshryConfig) |
| 35 | +``` |
| 36 | + |
| 37 | +**3-** Add one environment variable to your CI. |
| 38 | + |
| 39 | +Add your git host (Github for example) token as an environment variable to allow Koshry post a comment and update the commit status. |
| 40 | +Use `KOSHRY_GIT_HOST_TOKEN` as a key of the environment variable. |
| 41 | + |
| 42 | + |
| 43 | +## Koshry Rules: |
| 44 | +Each Koshry **Rule** does some work then returns a **Report** (or not) as a result of that work. |
| 45 | + |
| 46 | +While you can [create your own custom rule](https://medium.com/@Tarek360/your-first-koshry-rule-c6648ac34ca2), Koshry has some of the ready rules, you can make use of them directly. |
| 47 | +These rules are applied to the **git diff** of the **pull request**. |
| 48 | +- **LineRule**: Apply a **condition** to all of the **added** and **modified lines** in the pull request. |
| 49 | +- **FileRule**: Apply a **condition** to all of the **added** and **modified files** in the pull request. |
| 50 | +- **ProtectedFilesRule**: Protect a list of files to be changed by someone hasn't permission to make a change. |
| 51 | + |
| 52 | +**Check the [Wiki](https://github.com/tarek360/koshry/wiki) to know How to write Koshry Rules** |
| 53 | + |
| 54 | + |
| 55 | +## Koshry works automatically with: |
| 56 | +- CI |
| 57 | + - [Travis CI](https://travis-ci.com) |
| 58 | + - [circle ci](https://circleci.com) |
| 59 | + - [TeamCity](https://www.jetbrains.com/teamcity) |
| 60 | + |
| 61 | +- Git host: |
| 62 | + - Github |
| 63 | + |
| 64 | +## Contribution |
| 65 | +- Feel free to fork and open a pull request. |
| 66 | +- Open an issue if you found a bug or you need help. |
| 67 | + |
| 68 | + |
| 69 | +## How does Kosrhy work? |
| 70 | +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. |
| 71 | + |
| 72 | +**Note**: Kosrhy applies all of the rules sequentially. |
| 73 | + |
| 74 | +## I use Koshry in Koshry |
| 75 | +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](https://github.com/tarek360/koshry/pull/18) |
0 commit comments