|
| 1 | +<div align="center"> |
| 2 | + |
| 3 | + <img |
| 4 | + src="./images/k6.gif" |
| 5 | + width="600" |
| 6 | + style="pointer-events: none;" /> |
| 7 | + |
| 8 | + <br /> |
| 9 | + Open source performance testing tool and SaaS for ambitious engineering teams. |
| 10 | + |
| 11 | +</div> |
| 12 | + |
1 | 13 | # run-k6-action
|
2 | 14 | > This GitHub Action is under active development 🧑🏭
|
3 | 15 | > Please, use https://github.com/grafana/k6-action instead
|
4 | 16 |
|
5 | 17 | This action allows you to easily execute k6 tests as part of your GitHub Actions workflow.
|
6 | 18 |
|
7 |
| -It is a wrapper over `k6 run`, with support for globs, parallel execution, and fail-fast. |
| 19 | +It is a wrapper over `k6 run`, with support for globs, parallel execution, fail-fast, and many other features. |
8 | 20 |
|
9 | 21 | > This action won't setup/install k6. That functionality is provided by [grafana/setup-k6-action](https://github.com/grafana/setup-k6-action)
|
10 | 22 |
|
| 23 | +## Inputs |
| 24 | + |
| 25 | +The following inputs can be used as `step.with` key: |
| 26 | + |
| 27 | +| Name | Type | Required | Description |
| 28 | +| --- | --- | --- | --- | |
| 29 | +| `path` | string | `true` | Glob pattern to select one or multiple test scripts to run. <br/> e.g. `./tests/api*.js` <br/> One can also supply multiple patterns by separating them with new line.<br/><code>path: \|<br/> ./tests/api*.js<br/> ./tests/app*.js</code> |
| 30 | +| `cloud-run-locally` | boolean | `false` | If `true`, the tests are executed locally and the results are uploaded to Grafana Cloud k6 |
| 31 | +| `parallel` | boolean | `false` | If `true` and multiple tests are executed, all them run in parallel. |
| 32 | +| `fail-fast` | boolean | `false` | If `true`, the whole pipeline fails as soon as the first test fails |
| 33 | +| `flags` | string | `false` | Additional flags to be passed on to the `k6 run` command.<br/>e.g. `--vus 10 --duration 20s` |
| 34 | +| `cloud-comment-on-pr` | boolean | `false` | If `true`, the workflow comments a link to the cloud test run on the pull request (if present) |
| 35 | +| `only-verify-scripts` | boolean | `false` | If `true`, only check if the test scripts are valid and skip the test execution' |
| 36 | + |
11 | 37 | ## Usage
|
12 | 38 |
|
13 |
| -See [action.yml](action.yaml). |
| 39 | +Following are some examples of using the workflow. |
14 | 40 |
|
15 | 41 | ### Basic
|
16 | 42 |
|
@@ -94,3 +120,24 @@ jobs:
|
94 | 120 | parallel: true # optional: run tests in parallel (default: false)
|
95 | 121 | fail-fast: false # optional: fail the step early if any test fails (default: true)
|
96 | 122 | ```
|
| 123 | + |
| 124 | +Comment Grafana cloud k6 test URL on PR |
| 125 | + |
| 126 | +```yaml |
| 127 | + |
| 128 | + env: |
| 129 | + K6_CLOUD_TOKEN: ${{ secrets.K6_CLOUD_TOKEN }} |
| 130 | + K6_CLOUD_PROJECT_ID: ${{ secrets.K6_CLOUD_PROJECT_ID }} |
| 131 | + with: |
| 132 | + path: | |
| 133 | + ./tests/api*.js |
| 134 | + cloud-run-locally: false |
| 135 | + cloud-comment-on-pr: true |
| 136 | +``` |
| 137 | + |
| 138 | +<div align="center"> |
| 139 | + <img |
| 140 | + src="./images/pr-comment.png" |
| 141 | + width="600" |
| 142 | + style="pointer-events: none;" /> |
| 143 | +</div> |
0 commit comments