How to Run Bruno API Collections in CI
Bruno stores collections as files in the repo and its CLI runs them, so API tests live next to the code.
Install @usebruno/cli, then bru run the collection folder with an environment and --reporter-junit so results publish like any other test.
Steps
- Keep the
.brucollection files in the repo. - Install with
npm install -g @usebruno/cli. - Run
bru run <dir> --env <name>with--reporter-junit.
Workflow
.github/workflows/ci.yml
jobs:
bruno:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: npm install -g @usebruno/cli
- run: |
npm start &
npx wait-on http://localhost:3000/health
- run: bru run ./api --env ci --reporter-junit results/bruno.xml
env:
API_TOKEN: ${{ secrets.API_TOKEN }}Gotchas
- Bruno reads environment secrets from process env, so pass tokens via
env:rather than committing them. - The CLI exits non-zero on a failed assertion, which correctly fails the job.
Related guides
How to Run Postman Collections With Newman in CIRun a Postman collection in GitHub Actions with the Newman CLI, passing an environment file and emitting a JU…
How to Run Hurl API Tests in CIRun plain-text Hurl files in GitHub Actions to send HTTP requests and assert on status, headers, and JSON bod…
How to Publish an API Test JUnit Report in CIEmit a JUnit XML report from any API test runner in GitHub Actions and publish it, so passed and failed reque…