| 1 |
# Developer workflow: run locally the same commands the CI will run. |
| 2 |
# See the .github/workflows/check.yml file for the list of commands. |
| 3 |
# |
| 4 |
# By default, the linting and testing targets are run inside the |
| 5 |
# clitest-dev Docker container. To run them directly on the host, |
| 6 |
# avoiding the container, unset the `docker_run` variable. Examples: |
| 7 |
# |
| 8 |
# make test-bash # test using container's bash |
| 9 |
# make test-bash docker_run= # test using host's bash |
| 10 |
|
| 11 |
docker_image = clitest-dev |
| 12 |
docker_run = docker run --rm -t -v $$PWD:/mnt $(docker_image) |
| 13 |
test_cmd = ./clitest --first --progress none test.md |
| 14 |
|
| 15 |
default: |
| 16 |
@echo "Read the comments in the Makefile for help" |
| 17 |
|
| 18 |
fmt: |
| 19 |
$(docker_run) shfmt -w -i 4 -ci -kp -sr clitest |
| 20 |
|
| 21 |
lint: |
| 22 |
$(docker_run) shfmt -d -i 4 -ci -kp -sr clitest |
| 23 |
$(docker_run) checkbashisms --posix clitest |
| 24 |
$(docker_run) shellcheck clitest |
| 25 |
|
| 26 |
test: test-bash test-dash test-mksh test-sh test-zsh |
| 27 |
test-%: |
| 28 |
$(docker_run) $* $(test_cmd) |
| 29 |
|
| 30 |
versions: |
| 31 |
@$(docker_run) sh -c 'apk list 2>/dev/null | cut -d " " -f 1 | sort' |
| 32 |
|
| 33 |
docker-build: |
| 34 |
docker build -t $(docker_image) -f Dockerfile.dev . |
| 35 |
|
| 36 |
docker-run: |
| 37 |
$(docker_run) $(cmd) |