Skip to content

Commit dfcecbd

Browse files
authored
Merge pull request #20301 from Homebrew/copilot
Add Copilot instructions and setup steps
2 parents c46a6b9 + 985a919 commit dfcecbd

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed

.github/copilot-instructions.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Copilot Instructions for Homebrew/brew
2+
3+
This is a Ruby based repository with Bash scripts for faster execution.
4+
It is primarily responsible for providing the `brew` command for the Homebrew package manager.
5+
Please follow these guidelines when contributing:
6+
7+
## Code Standards
8+
9+
### Required Before Each Commit
10+
11+
- Run `brew typecheck` to verify types are declared correctly using Sorbet.
12+
- Run `brew style --fix` to lint code formatting using RuboCop.
13+
Individual files can be checked/fixed by passing them as arguments.
14+
- Run `brew tests --online` to ensure that RSpec unit tests are passing (although some online tests may be flaky so can be ignored if they pass on a rerun).
15+
Individual test files can be passed with `--only` e.g. to test `Library/Homebrew/cmd/reinstall.rb` with `Library/Homebrew/test/cmd/reinstall_spec.rb` run `brew tests --only=cmd/reinstall`.
16+
17+
### Development Flow
18+
19+
- Write new code (using Sorbet `sig` type signatures and `typed: strict` files whenever possible)
20+
- Write new tests (avoid more than one `:integration_test` per file for speed)
21+
22+
## Repository Structure
23+
24+
- `bin/brew`: Homebrew's `brew` command main Bash entry point script
25+
- `completions/`: Generated shell (`bash`/`fish`/`zsh`) completion files. Don't edit directly, regenerate with `brew generate-man-completions`
26+
- `Library/Homebrew/`: Homebrew's core Ruby (with a little bash) logic.
27+
- `Library/Homebrew/bundle/`: Homebrew's `brew bundle` command.
28+
- `Library/Homebrew/cask/`: Homebrew's Cask classes and DSL.
29+
- `Library/Homebrew/extend/os/`: Homebrew's OS-specific (i.e. macOS or Linux) class extension logic.
30+
- `Library/Homebrew/formula.rb`: Homebrew's Formula class and DSL.
31+
- `docs/`: Documentation for Homebrew users, contributors and maintainers. Consult these for best practices and help.
32+
- `manpages/`: Generated `man` documentation files. Don't edit directly, regenerate with `brew generate-man-completions`
33+
- `package/`: Files to generate the macOS `.pkg` file.
34+
35+
## Key Guidelines
36+
37+
1. Follow Ruby best practices and idiomatic patterns
38+
2. Maintain existing code structure and organisation
39+
3. Write unit tests for new functionality. Use one assertion per test where possible.
40+
4. Document public APIs and complex logic. Suggest changes to the `docs/` folder when appropriate
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Copilot Setup Steps
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
paths:
7+
- .github/workflows/copilot-setup-steps.yml
8+
9+
jobs:
10+
# The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.
11+
copilot-setup-steps:
12+
runs-on: ubuntu-latest
13+
14+
permissions:
15+
contents: read
16+
17+
steps:
18+
- name: Set up Homebrew
19+
id: set-up-homebrew
20+
uses: Homebrew/actions/setup-homebrew@main
21+
with:
22+
core: true
23+
cask: true
24+
test-bot: true
25+
26+
- run: brew install-bundler-gems --groups=all
27+
28+
# install Homebrew formulae we might need
29+
- run: brew install shellcheck shfmt gh gnu-tar subversion curl
30+
31+
# brew tests doesn't like world writable directories
32+
- run: sudo chmod -R g-w,o-w /home/linuxbrew/.linuxbrew/Homebrew

0 commit comments

Comments
 (0)