This action sets up a Grafana k6 environment for use in a GitHub Actions workflow by:
- Installing a specific version of k6.
- Installing Chrome for Browser Testing (optional).
After that we can use the run-k6-action to execute the k6 tests in the GitHub Actions workflow.
The following inputs can be used as step.with
key:
Name | Type | Required | Description |
---|---|---|---|
k6-version |
string | false |
Specify the k6 version to use. e.g. '0.49.0' . If not set, latest K6 version will be used. |
browser |
boolean | false |
Default false . If set to true chrome is also installed along with K6 for Browser testing. |
Following are some examples of using the workflow.
Uses the latest k6 version
on:
push:
jobs:
protocol:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: grafana/setup-k6-action@v1
- uses: grafana/run-k6-action@v1
with:
path: |
./tests/api*.js
Specify which k6 version to use
on:
push:
jobs:
protocol:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: grafana/setup-k6-action@v1
with:
k6-version: '0.49.0'
- uses: grafana/run-k6-action@v1
with:
path: |
./tests/api*.js
on:
push:
jobs:
protocol:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: grafana/setup-k6-action@v1
with:
k6-version: '0.49.0'
browser: true
- uses: grafana/run-k6-action@v1
with:
path: |
./tests/api*.js