Containerized GitHub Action executing bruno cli runner.
Can be used to execute sanity checks and integration tests via bruno collections.
Internally executes @usebruno/[email protected]
, passing the action’s input parameters to the command line interface.
The following example runs a collection located in the folder bruno/api-it
.
It uses the bruno environment integration
,
and provides the secret environment variables foo=bar
and say=hello
.
The runner results are dumped to the JSON file ./output.json
.
name: Bruno Test Collection
on:
workflow_dispatch:
jobs:
bruno-tests:
name: Bruno test collection
runs-on: ubuntu-latest
steps:
- name: Bruno CLI runner
id: bru-cli
uses: krummbar/bruno-run-action@main # (1)
with:
path: bruno/api-it
env: integration
env-vars: |- # (2)
foo=bar
say='${{ secrets.MESSAGE }}'
output: output.json
output-format: json
-
Change
@main
to a specific commit SHA or version tag, e.g.:
krummbar/bruno-run-action@e76147da8e5c81eaf017dede5645551d4b94427b
krummbar/[email protected]
-
envVars need to be separated with line breaks
name: Bruno Run Individual Folder
on:
workflow_dispatch:
jobs:
bruno-tests:
name: Bruno test collection
runs-on: ubuntu-latest
steps:
- name: Bruno CLI runner
id: bru-cli
uses: krummbar/bruno-run-action@main
with:
path: bruno/api-it # (1)
filename: echo # (2)
recursive: true # (3)
-
Path to bruno collection
-
Relative path of the request folder inside the collection
-
Includes all requests in subfolders
csv-file-path:
description: CSV file pat for input parameters
required: false
path:
# prettier-ignore
description: >-
Path of the target bruno collection.
Should point to the root directory of the collection.
If not provided it uses the current working directory.
required: false
default: .
filename:
# prettier-ignore
description: >-
File or folder name of the requests to run.
It is relative to the `path` input.
required: false
recursive:
description: Indicate a recursive run.
required: false
default: 'false'
ca-cert:
description: CA certificate to verify peer against.
required: false
env:
description: Select a collection environment.
required: false
default: ''
env-vars:
description: List of environment variables to set with the run.
required: false
default: ''
ignore-truststore:
# prettier-ignore
description: >-
The specified custom CA certificate (--cacert) will be used exclusively and the default truststore is ignored,
if this option is specified.
Evaluated in combination with "--cacert" only.
required: false
default: 'false'
output:
# prettier-ignore
description: >-
Output file containing test results.
The path is relative to the current working-directory and not to the targeted bruno collection.
required: false
output-format:
# prettier-ignore
description: >-
The output format of the test results.
Possible values `html|json|junit`.
required: false
default: json
insecure:
description: Allow insecure server connections.
required: false
default: 'false'
sandbox:
description: Javscript sandbox to use. Available sandboxes are 'developer|safe'
required: false
default: ''
tests-only:
description: Only run requests that have a test.
required: false
bail:
description: Stop execution after a failure of a request, test, or assertion.
required: false
After you’ve cloned the repository to your local machine or codespace, you’ll need to perform some initial setup steps before you can test your action.
ℹ️
|
You’ll need to have a reasonably modern version of Docker handy (e.g. docker engine version 20 or later). |
-
🛠️ Build the container
docker build -t bruno-run-action-local .
-
✅ Test the container
You can pass individual environment variables using the
--env
or-e
flag.$ docker run --env INPUT_PATH=".github/bruno-collection" --env INPUT_ENV="cicd" --env BRUNO_ACTION_DRY_RUN="true" -v ${PWD}:/usr/src bruno-run-action-local ::notice::collection directory: '/usr/src/.github/bruno-collection' ::notice::bru run --env cicd ::notice::Executed in dry mode, skipped executing bruno collection
Or you can pass a file with environment variables using
--env-file
.$ docker run --env-file .github/workflows/ci.env -v ${PWD}/.github:/usr/src/.github bruno-run-action-local ::notice::collection directory: '/usr/src/.github/bruno-collection' ::notice::bru run users/get-user.bru -r --env cicd --output /usr/src/output.html --format html --insecure --tests-only --bail --env-var apikey=myPassword --env-var id=myId ::notice::Executed in dry mode, skipped executing bruno collection
💡If
BRUNO_ACTION_DRY_RUN=true
is provided, execution of the actual collection is skipped. Only the fully composed bru run command with all arguments is dumped.
The README.adoc
file is generated from the sources in the docs folder.
Any documentation changes must be applied to the files located in there.
- Prerequisites
In order to update the contents of the README.adoc
run the following command.
asciidoctor-reducer --preserve-conditionals -o README.adoc docs/index.adoc