Skip to content

Add CI to test formula installs#14

Merged
marcqualie merged 8 commits into
mainfrom
ci-test-formula
May 28, 2026
Merged

Add CI to test formula installs#14
marcqualie merged 8 commits into
mainfrom
ci-test-formula

Conversation

@marcqualie

@marcqualie marcqualie commented May 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds .github/workflows/test-formula.yml that runs on PRs touching Formula/*.rb. Matrix over macos-latest / ubuntu-latest × denvig / denvig-alpha, executing brew audit --strict, brew install --build-from-source, and brew test against each formula by name (relying on the auto-tap that Homebrew/actions/setup-homebrew performs in tap repos).
  • Updates update-formula.yml to open its version-bump PRs as --draft so the new test workflow gates them before merge. PRs are promoted to ready-for-review manually after review.
  • Pins both formulae's completion generation to zsh only with shell_parameter_format: :none, so the executable is invoked as denvig zsh completions (the previous default invoked it as denvig zsh completions <shell>, which 0.6.7 silently ignored but 0.7.0-alpha rejects).

Test plan

  • Test Formula workflow runs on this PR and passes for both denvig and denvig-alpha on macOS.
  • Ubuntu jobs surface any Linux-specific gaps (not blocking merge — kept in matrix to start planning Linux support).
  • Next Update Formula dispatch opens its PR as a draft, gated by the test workflow.

Adds a test-formula workflow that runs on PRs touching Formula/*.rb:
audits, installs from source, and tests each formula across Ubuntu
and macOS. Once all matrix jobs pass, a follow-up job flips draft PRs
to ready-for-review.

Switches update-formula.yml to open its bump PRs as drafts so the new
test workflow gates them before merge.
@marcqualie marcqualie self-assigned this May 28, 2026
In 0.7.0, 'denvig zsh completions' rejects extra arguments. The default
generate_completions_from_executable iterates over bash/zsh/fish and
appends the shell name, producing 'denvig zsh completions bash' which
errors. Pin shells to zsh only and use shell_parameter_format :none so
the command runs as 'denvig zsh completions'.
Matches the denvig-alpha formula. Previously the default behavior ran
'denvig zsh completions <shell>' for bash/zsh/fish; the extra argument
was silently ignored in 0.6.7 but will fail on future versions.
@marcqualie marcqualie marked this pull request as ready for review May 28, 2026 13:38
@marcqualie marcqualie merged commit b5f7ee1 into main May 28, 2026
4 checks passed
@marcqualie marcqualie deleted the ci-test-formula branch May 28, 2026 13:38
marcqualie added a commit that referenced this pull request Jun 3, 2026
## Problem

The `test-formula` workflow never ran on PR #17 (or #15) — confirmed via
the API: `0` check runs on #17's head SHA. `test-formula` has only ever
run on the branch where it was introduced (#14). As a result, a broken
install merged with **no CI**.

The path filter is fine (#17 edits `Formula/denvig-alpha.rb`). The real
cause:

The `Update Formula` workflow opens its PRs using the default
`GITHUB_TOKEN`:

```yaml
env:
  GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```

> When you use the repository's `GITHUB_TOKEN`, events triggered by the
`GITHUB_TOKEN` **will not create a new workflow run.** This prevents
accidental recursive runs.

So the `pull_request` event for the update PR is suppressed and
`test-formula` never triggers.

## Fix

Open the PR (and push the branch) with a **fine-grained PAT** stored as
the `FORMULA_UPDATE_TOKEN` secret, so the `pull_request` event fires and
`test-formula` runs before merge.

## Required setup (repo admin)

1. Create a **fine-grained PAT** scoped to `denvig/homebrew-tap` with:
   - **Contents:** Read and write
   - **Pull requests:** Read and write
2. Add it as a repository **Actions secret** named
`FORMULA_UPDATE_TOKEN`.

Without the secret, the `Update Formula` workflow will fail at checkout
— so add it before the next run.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant