Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 66 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,43 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Detect Python project
id: python_project
shell: bash
run: |
if [[ -f pyproject.toml || -f setup.py || -f setup.cfg || -f requirements.txt ]]; then
echo "present=true" >> "$GITHUB_OUTPUT"
else
echo "present=false" >> "$GITHUB_OUTPUT"
echo "No Python project files found; skipping Python CI."
fi

- name: Set up Python
if: steps.python_project.outputs.present == 'true'
uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: "3.13"

- name: Install dependencies
if: steps.python_project.outputs.present == 'true'
shell: bash
run: |
pip install -r requirements.txt
python -m pip install --upgrade pip
if [[ -f requirements.txt ]]; then
pip install -r requirements.txt
fi
pip install ruff pytest build

- name: Lint (ruff)
if: steps.python_project.outputs.present == 'true'
run: ruff check .

- name: Test (pytest)
if: steps.python_project.outputs.present == 'true'
run: pytest

- name: Build package
if: steps.python_project.outputs.present == 'true' && hashFiles('pyproject.toml', 'setup.py') != ''
run: python -m build

# ─── Go ───────────────────────────────────────────────────
Expand All @@ -41,18 +61,33 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Detect Go project
id: go_project
shell: bash
run: |
if [[ -f go.mod ]]; then
echo "present=true" >> "$GITHUB_OUTPUT"
else
echo "present=false" >> "$GITHUB_OUTPUT"
echo "No go.mod found; skipping Go CI."
fi

- name: Set up Go
if: steps.go_project.outputs.present == 'true'
uses: actions/setup-go@v5
with:
go-version: "1.22"

- name: Lint (go vet)
if: steps.go_project.outputs.present == 'true'
run: go vet ./...

- name: Test
if: steps.go_project.outputs.present == 'true'
run: go test ./...

- name: Build
if: steps.go_project.outputs.present == 'true'
run: go build ./...

# ─── Shell Scripts ────────────────────────────────────────
Expand All @@ -62,8 +97,34 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Install shellcheck
run: sudo apt-get install -y shellcheck
- name: Install shell tooling
run: |
sudo apt-get update
sudo apt-get install -y bats shellcheck zsh

- name: Lint shell scripts
run: find . -name "*.sh" -exec shellcheck {} +
shell: bash
run: |
mapfile -t shell_files < <(
find cli \
-type f \
\( -name "*.sh" -o -name "bash-wrapper" \) \
-print | sort
)

if ((${#shell_files[@]} == 0)); then
echo "No shell scripts found."
exit 0
fi

shellcheck -x -e SC1090,SC1091 "${shell_files[@]}"

- name: Run Bash tests
run: |
bats \
cli/env/tests/banyanenv.bats \
cli/bash/bin/tests/bash-wrapper.bats \
cli/bash/commands/setup/tests/setup.bats \
cli/bash/lib/std/tests/lib_std.bats \
cli/bash/lib/file/tests/lib_file.bats \
cli/bash/lib/git/tests/lib_git.bats
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ __pycache__/
.ruff_cache/
.coverage
htmlcov/

# Temporary files
test.log
run.log
2 changes: 1 addition & 1 deletion cli/bash/bin/bash-wrapper
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ main() {
stdlib_path="$bash_root/lib/std/lib_std.sh"
[[ -f "$stdlib_path" ]] || die "Required stdlib '$stdlib_path' was not found."

BANYAN_BASH_BOOTSTRAP_SOURCE="$command_script"
export BANYAN_BASH_BOOTSTRAP_SOURCE="$command_script"
# Source the stdlib in the wrapper shell so command scripts inherit the shared helpers.
source "$stdlib_path"
unset BANYAN_BASH_BOOTSTRAP_SOURCE
Expand Down
30 changes: 27 additions & 3 deletions cli/bash/commands/setup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ The command is intentionally small and idempotent.
## Commands

- `install`
Installs Homebrew, Xcode Command Line Tools, Python, and creates `$HOME/.banyan_venv`.
Installs Homebrew, Xcode Command Line Tools, Python 3.13, BATS, and creates `$HOME/.banyanlabs.d/.venv`.
- `check`
Verifies the required local CLI setup without making changes. Exits non-zero if anything is missing.
- `update-profile`
Reserved for future shell profile updates. This subcommand is not implemented yet.

Expand All @@ -19,8 +21,23 @@ The `install` command performs these steps:

1. install Homebrew if it is not already installed
2. install Xcode Command Line Tools if they are not already installed
3. install Python via Homebrew if it is not already installed
4. create `$HOME/.banyan_venv` if it does not already exist
3. install Python 3.13 via Homebrew if it is not already installed
4. install BATS via Homebrew if it is not already installed
5. create `$HOME/.banyanlabs.d/.venv` if it does not already exist

The `.banyanlabs.d` directory is intended to hold additional Banyan Labs CLI state in the future, so the virtual environment now lives under that shared home.

## Check Behavior

The `check` command verifies the same base requirements as `install`:

1. Homebrew is installed
2. Xcode Command Line Tools are installed
3. Python 3.13 is installed via Homebrew
4. BATS is installed via Homebrew
5. `$HOME/.banyanlabs.d/.venv` exists

It exits with status `0` when everything is present and `1` when any required item is missing.

## What It Does Not Do Yet

Expand All @@ -42,6 +59,12 @@ Via the symlinked entrypoint:
cli/bash/bin/setup.sh install
```

Check:

```bash
cli/bash/bin/setup.sh check
```

Help:

```bash
Expand All @@ -66,6 +89,7 @@ The command supports a few environment-variable overrides, mainly for automation

- `BANYAN_SETUP_VENV_DIR`
- `BANYAN_SETUP_PYTHON_FORMULA`
- `BANYAN_SETUP_BATS_FORMULA`
- `BANYAN_SETUP_PYTHON_BIN`
- `BANYAN_SETUP_BREW_BIN`
- `BANYAN_SETUP_HOMEBREW_INSTALLER_SCRIPT`
Expand Down
Loading
Loading