Skip to content

Commit

Permalink
Snazz up the build code a little bit
Browse files Browse the repository at this point in the history
* Add help target
  - woot
* Rename make check to make pass
  - It was originally this way and it was better. I immediately
    regretted changing it.
* Rename make typecheck to make check
  - yeah hopefully not too confusing. Probably nobody uses this
    but me anyways.
  • Loading branch information
aaronik committed Jan 25, 2025
1 parent 38733b8 commit c12a16c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ jobs:
mv nvim-treesitter $HOME/.local/share/nvim/lazy/
nvim --headless --noplugin -u tests/minimal_init.lua -c "TSInstall! python rust haskell" -c "quit"
- name: Run luacheck type check
- name: Run luacheck type check / linter
run: |
sudo apt-get install lua-check -y --no-install-recommends
make typecheck
make check
- name: Check for errant util calls
run: make no-utils
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Thank you for contributing to Treewalker!
## Things to know

* See the Makefile for tasks
* `make check` will run everything you need to be sure things are healthy
* `make pass` will run everything you need to be sure things are healthy
* in your lazy config, set dir = "<the plugin's dir>"
* use util.R in init.lua for the plugin to hot reload in your current dev environment
* use `util.log` to print to the fs, and `tail -f ~/.local/share/nvim/treewalker/debug.log` to read from it
Expand Down
21 changes: 14 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,32 @@ MINIMAL_INIT=tests/minimal_init.lua
TESTS_DIR=tests
NO_UTIL_SPEC=checks

test:
.PHONY: test

test: ## Run the whole test suite
@nvim \
--headless \
--noplugin \
-u ${MINIMAL_INIT} \
-c "PlenaryBustedDirectory ${TESTS_DIR} { minimal_init = '${MINIMAL_INIT}' }"

test-watch:
test-watch: ## Watching for changes to lua files
nodemon -e lua -x "$(MAKE) test || exit 1"

typecheck:
luacheck . --globals vim it describe before_each --exclude-files tests/fixtures --max-comment-line-length 140
check: ## Run luacheck on the project
luacheck . --globals vim it describe before_each after_each --exclude-files tests/fixtures --max-comment-line-length 140

no-utils:
no-utils: ## Make sure there are no errant utils hanging around
@nvim \
--headless \
--noplugin \
-u ${MINIMAL_INIT} \
-c "PlenaryBustedDirectory ${NO_UTIL_SPEC} { minimal_init = '${MINIMAL_INIT}' }"

# Run this to be sure all's well
check: test typecheck no-utils
pass: test no-utils check ## Run everything, if it's a 0 code, everything's good

help: ## Displays this information.
@printf '%s\n' "Usage: make <command>"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-30s\033[0m %s\n", $$1, $$2}'
@printf '\n'

0 comments on commit c12a16c

Please sign in to comment.