Skip to content

Commit c457897

Browse files
Updated user guide testing on ci to include a github action section (#315)
1 parent 41c30f0 commit c457897

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

docs/user_guide.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,30 @@ Note that the Gradlew wrapper is not automatically created by `kscript --idea` s
163163

164164
To streamline testing there is also [helper script](https://gist.github.com/elihart/019bd116d3fa0d6214b7396eedc4b206) by [@elihart](https://gist.github.com/elihart) that runs `gradle clean test` on other scripts to easily build and test them (using kscript). This script takes the name of another kts script as an argument, builds that script with gradle, and runs its tests via gradle clean test.
165165

166+
#### Github Action
167+
168+
If you want to run your unit tests on every pull request to your `main` branch in Github, there is a Github Action called [kscript-action](https://github.com/plusmobileapps/kscript-action) which will utilize the helper script mentioned above to run your unit tests in a docker container. To use the Github action, create a `.github/workflows` folder in your project and create a `your-name.yml` file. Then in this `.yml` file add the following if you would like the unit tests to be run on every pull request against your main branch. An example project that utilizes this action can be found [here](https://github.com/plusmobileapps/kotlin-scripting/blob/main/.github/workflows/main.yml)
169+
170+
```yml
171+
on:
172+
pull_request:
173+
branches:
174+
- main
175+
176+
jobs:
177+
test:
178+
runs-on: ubuntu-latest
179+
name: Run tests in kscript project
180+
steps:
181+
- name: Checkout the project into the container
182+
uses: actions/checkout@v2.3.4
183+
- name: Run testing script to generate mock IDEA project and run gradle test
184+
id: hello
185+
uses: plusmobileapps/kscript-action@v1
186+
with:
187+
kts-file: 'the-path-to-script-in-github-repository.kts'
188+
```
189+
166190
## Text Processing
167191
168192
`kscript` allows to perform `sed`/`awk` text streaming/processing.

0 commit comments

Comments
 (0)