Skip to content

krummbar/bruno-run-report

Repository files navigation

Bruno Run Report

Continuous Integration Lint Codebase

A GitHub Action attaching a Markdown summary to a bru cli run execution parsed from a JSON result. This can be a subsequent step to bruno-run-action to render a test run summary.

⚠️

Supports JSON reports generated by bru cli v1.20.0

Examples of the final summary attached to the job can be found here:

Usage

The listed example clones a repository source, executes the bru run command, and finally attaches a markdown summary at the end from the previous run.

Attach run summary
name: Bruno Test & Report

on:
  workflow_dispatch:

jobs:
  bruno-tests:
    name: Bruno test collection
    runs-on: ubuntu-latest
    steps:
      - name: Checkout  # (1)
        id: checkout
        uses: actions/checkout@v4

      - name: Bruno CLI runner  # (2)
        id: bru-cli
        uses: krummbar/bruno-run-action@main
        with:
          path: bruno/api-it
          output: bru-output.json # (3)
          outputFormat: json

      - name: Attach bru run summary # (4)
        uses: krummbar/bruno-run-report@main
        continue-on-error: true # (5)
        with:
          run-report-path: bru-output.json # (6)
  1. Clone repository

  2. Execute bru run with a collection located in folder bruno/api-it

  3. Specify the report result summary in JSON format

  4. Generates the Markdown summary and attaches it to ${GITHUB_SUMMARY}

  5. Optional make report step succeed even though report step potentially fails, see documentation

  6. Needs to match the path listed in callout 3`

Inputs

run-report-path:
  description: Path of the bru run execution summary.
  required: true
output-path:
  description: If provided the contents of the markdown report will be written to the given path.
  required: false
include-footer:
  description: En- or disable the report footer.
  required: false
  default: 'true'
include-report-sources:
  description: If enabled, each suite includes the raw JSON details of the run result.
  required: false
  default: 'false'
only-failed:
  description: Skips successful testsuites in the report if set true.
  required: false
  default: 'false'
report-title:
  description: Set a custom title for the report.
  required: false
  default: Bruno Run

Outputs

success:
  description: Indicates test run success status.
md-report-path:
  description: The contents of the markdown file.

Development

Test Locally

In order to execute the actual script the action’s input parameters must be set as environment variables, and jq needs to be available on the work station.

Prerequisites

The required input parameters are listed in docs/examples/.env.sample.

IN_REPORT_TITLE="Bruno Run"
IN_INCLUDE_FOOTER=true
IN_INCLUDE_REPORT_SOURCES=false
IN_ONLY_FAILED=false
# IN_OUTPUT_PATH=docs/examples/report-result.md
IN_RUN_REPORT_PATH=.github/bru-run-results/bru-output.json
GITHUB_OUTPUT=out/github-out.log
GITHUB_STEP_SUMMARY=out/github-step-summary.md

If the environment variables are set according to your needs, the main script can simply be executed.

./entrypoint.sh

If the above listed values are used, ensure the out folder exists and the project’s root folder. Otherwise the script execution may fail.

The markdown result is dumped to the configured path in GITHUB_STEP_SUMMARY, and if set copied to IN_OUTPUT_PATH

Explanation

The script uses jq to read the JSON report of a bru run process and markdown templates for generic information as the optional footer. The transform functions and templates are defined in the [src] folder.

Documentation

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.

In order to update the contents of the README.adoc run the following command.

Update README.adoc
asciidoctor-reducer --preserve-conditionals -o README.adoc docs/index.adoc

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published