Homebrew Pipeline
GitHub Action to provide a simple CI pipeline for your Homebrew tap,
using test-bot
and the included lint
command.
Input | Required | Default | Description |
---|---|---|---|
include |
false | **.rb |
Extended glob pattern matching files to check. |
exclude |
false | Extended glob pattern matching files to exclude from checks. |
.github/workflows/ci.yml
:
name: CI
on:
push:
branches: [master, main]
paths: '**.rb'
pull_request:
paths:
- Formula/*.rb
- Casks/*.rb
- cmd/*rb
- lib/**.rb
schedule:
- cron: 0 5 * * * # 5AM daily
jobs:
CI:
runs-on: macos-latest
steps:
- name: ${{github.workflow}}
uses: danielbayley/homebrew-pipeline@main
env:
ACTIONS_STEP_DEBUG: ${{secrets.ACTIONS_STEP_DEBUG}}
with:
skip-install: cask,tokens
lint
command
Easily lint
formulae, casks, and Ruby files with a single command. lint
is a simple
Homebrew
external command wrapper around existing audit
, style
, livecheck
and other commands.
brew lint
[--option
s] file
s|tap
|formula
e|cask
s […]
Option | Description |
---|---|
--style |
Only run rubocop style checks. |
--fail-fast /--ff |
Stop after the first file containing offenses. Particularly useful in a pre-commit hook. |
--fix |
Fix style violations automatically using RuboCop's auto-correct feature. |
--online |
Run additional, slower style checks that require a network connection. |
- [-f ]ormat [= ] |
Choose an output format ter. |
--install |
Also run [un ]install along with any test step in formulae. |
--skip-install |
Skip [un ]install steps for specified cask, s. |
Preferred style checks can be configured with a .rubocop.yml
file in your tap,
which can inherit_from
the base Homebrew config:
inherit_from: /usr/local/Homebrew/Library/.rubocop.yml
# or /opt/homebrew/Homebrew/… if running on Apple Silicon.
Style/FrozenStringLiteralComment:
Enabled: false
Any HOMEBREW_
[RUBOCOP
|LIVECHECK
]_OPTS
will be appended to rubocop
and livecheck
commands,
respectively. For example, you might add something like the following to your ~/.zshenv
:
export HOMEBREW_RUBOCOP_OPTS="--display-cop-names --format simple"
export HOMEBREW_LIVECHECK_OPTS=--debug
Running brew lint
in a GITHUB_ACTIONS
environment implies --online
,
--install
/test
steps, and output --format github
.
pre-commit
hook
The supplied pre-commit
command is available for the corresponding git
hook.
It will detect any --staged
**.rb
files, and --fail-fast
, stopping after the first file containing offenses.
For example, you might add the following to .git/hooks/pre-commit
or git config core.hooksPath
:
#! /bin/sh
brew pre-commit
brew tap danielbayley/lint
brew lint **.rb #formulae #cask #Brewfile