---
title: 🔄 CI Integration
description: Running ZUnit tests in CI — GitHub Actions (recommended) and Travis CI (legacy).
canonical_url: https://wiki.zshell.dev/community/zunit/zunit-ci
markdown_url: https://wiki.zshell.dev/community/zunit/zunit-ci/index.md
locale: en
source_path: community/03_zunit/06_ci.mdx
---

<!-- Generated from the canonical Z-Shell Wiki build. The linked human-facing page remains the editorial source of truth. -->

# 🔄 CI Integration

<a id="generate-ci-config-with-zunit-init"></a>

## Generate CI config with `zunit init`

The fastest way to get a CI workflow is to use the scaffolding command:

```zunit
zunit init --github-actions   # GitHub Actions (recommended)
zunit init --travis           # Travis CI (legacy)
```

Both flags can be combined with the regular `zunit init` run.

<a id="github-actions-recommended"></a>

## GitHub Actions (recommended)

.github/workflows/zunit.yml

```yaml
---
name: "ZUnit"

on:
  push:
  pull_request:
  workflow_dispatch: {}

permissions:
  contents: read

jobs:
  zunit:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install dependencies
        run: |
          sudo apt-get update
          sudo apt-get install -yq zsh
          mkdir -p .bin
          curl -fsSL 'https://github.com/z-shell/zunit/releases/latest/download/zunit' > .bin/zunit
          curl -fsSL 'https://raw.githubusercontent.com/z-shell/src/d38202ee20efeec42900ce26f747a3024028845f/public/zsh/snippets/revolver' > .bin/revolver
          curl -fsSL 'https://raw.githubusercontent.com/z-shell/src/d38202ee20efeec42900ce26f747a3024028845f/public/zsh/snippets/color.zsh' > .bin/color
          chmod u+x .bin/{color,revolver,zunit}

      - name: Test
        run: PATH="$PWD/.bin:$PATH" zunit --tap tests
```

tip

The `--tap` flag produces machine-readable output. You can pipe it through a TAP reporter (e.g., `tap-junit`) to generate JUnit XML for GitHub Actions test summary annotations.

<a id="using-a-pinned-zunit-release"></a>

### Using a pinned ZUnit release

Replace `latest/download/zunit` with a versioned URL to pin to a specific release:

```yaml
curl -fsSL 'https://github.com/z-shell/zunit/releases/download/v0.9.0/zunit' > .bin/zunit
```

<a id="travis-ci-legacy"></a>

## Travis CI (legacy)

warning

Travis CI is a legacy option. GitHub Actions is the recommended CI platform for new projects.

.travis.yml

```yaml
addons:
  apt:
    packages:
      - zsh

install:
  - mkdir .bin
  - curl -L https://github.com/z-shell/zunit/releases/latest/download/zunit > .bin/zunit
  - curl -L https://raw.githubusercontent.com/z-shell/src/d38202ee20efeec42900ce26f747a3024028845f/public/zsh/snippets/revolver > .bin/revolver
  - curl -L https://raw.githubusercontent.com/z-shell/src/d38202ee20efeec42900ce26f747a3024028845f/public/zsh/snippets/color.zsh > .bin/color

before_script:
  - chmod u+x .bin/{color,revolver,zunit}
  - export PATH="$PWD/.bin:$PATH"

script: zunit
```

<a id="macos-github-actions"></a>

## macOS (GitHub Actions)

ZUnit works on macOS via `brew install zsh` (Zsh is already available on `macos-latest` runners, but may be an older version):

```yaml
jobs:
  zunit-macos:
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@v4
      - name: Install dependencies
        run: |
          mkdir -p .bin
          curl -fsSL 'https://github.com/z-shell/zunit/releases/latest/download/zunit' > .bin/zunit
          curl -fsSL 'https://raw.githubusercontent.com/z-shell/src/d38202ee20efeec42900ce26f747a3024028845f/public/zsh/snippets/revolver' > .bin/revolver
          curl -fsSL 'https://raw.githubusercontent.com/z-shell/src/d38202ee20efeec42900ce26f747a3024028845f/public/zsh/snippets/color.zsh' > .bin/color
          chmod u+x .bin/{color,revolver,zunit}
      - name: Test
        run: PATH="$PWD/.bin:$PATH" zunit --tap tests
```
