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
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ indent_size = 2

[*.sh]
indent_size = 2

[Makefile]
indent_style = tab
11 changes: 5 additions & 6 deletions .github/workflows/ci.yml → .github/workflows/lint_test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: lint_test
on:
push:
pull_request:
Expand All @@ -10,15 +10,14 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install tools
- name: Install dependencies
run: |
sudo apt-get update -y
sudo apt-get install -y shellcheck curl
git clone https://github.com/bats-core/bats-core /tmp/bats
sudo /tmp/bats/install.sh /usr/local
sudo apt-get install -y shellcheck shfmt bats curl
pip install pre-commit editorconfig-checker
- name: Lint
run: make lint
- name: Tests
- name: Test
env:
MONA_NONINTERACTIVE: "1"
run: make test
26 changes: 26 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
default_install_hook_types: [pre-commit, pre-push]
default_stages: [commit, push]
repos:
- repo: local
hooks:
- id: shfmt
name: shfmt
entry: shfmt -i 2 -ci -sr
language: system
files: \.sh$
- id: shellcheck
name: shellcheck
entry: shellcheck -x
language: system
files: \.sh$
- id: editorconfig-checker
name: editorconfig-checker
entry: ec
language: system
pass_filenames: false
- id: bats
name: bats
entry: make test
language: system
pass_filenames: false
stages: [push]
2 changes: 1 addition & 1 deletion .shellcheckrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Be strict but allow some practical patterns.
disable=SC1090,SC2155
disable=SC1090,SC2155,SC1091,SC2317,SC2031
external-sources=true
17 changes: 13 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
SHELL := /bin/bash

.PHONY: lint test ci
.PHONY: install-dev fmt lint test ci

install-dev:
sudo apt-get update -y
sudo apt-get install -y shellcheck shfmt bats curl
pip install --upgrade pre-commit editorconfig-checker
pre-commit install --install-hooks
pre-commit install --hook-type pre-push --install-hooks

fmt:
shfmt -w bin modules recipes tests

lint:
@command -v shellcheck >/dev/null || { echo 'Install shellcheck'; exit 1; }
shellcheck -x bin/mona modules/**/*.sh || true
shellcheck -x bin/mona modules/**/*.sh
shfmt -d bin modules recipes tests

test:
@command -v bats >/dev/null || { echo 'Install bats-core'; exit 1; }
bats -r tests

ci: lint test
28 changes: 25 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,36 @@ Use this as the starting point for Codex/agents to extend modules and recipes.
# clone
git clone <your-repo> monarepo && cd monarepo

# (optional) add simple curses as submodule (or rely on runtime downloader in bin/mona)
git submodule add https://github.com/metal3d/bashsimplecurses ui/bashsimplecurses
git submodule update --init --recursive
# install development dependencies and git hooks
make install-dev

# run full test suite
make test

# run TUI (recommended with sudo/root)
sudo ./bin/mona
```

### Local hooks

This repository uses [pre-commit](https://pre-commit.com/) hooks. Formatting
(`shfmt`) and linting (`shellcheck`, `editorconfig-checker`) run on every
commit. The BATS tests run automatically on `git push`. Hooks are installed by
`make install-dev`. You can manually trigger them for all files with:

```bash
pre-commit run --all-files
```

### Run CI tasks locally

The same checks used in GitHub Actions can be executed locally:

```bash
make lint
make test
```

### Non-interactive/CI flags
- `--version` : prints version and exits
- `--help` : prints help and exits
Expand Down
Loading