[misc] update build scripts (#23316)

* [misc] update build scripts

* [misc] make shellcheck happy

GitOrigin-RevId: 343655fda54aa7e835dd666dcd4218d61c58fd09
This commit is contained in:
Jakob Ackermann
2025-02-03 09:49:04 +00:00
committed by Copybot
parent 70a17768a3
commit 5404dcb93d
13 changed files with 195 additions and 15 deletions

View File

@@ -39,6 +39,23 @@ RUN_LINTING_CI = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.e
# Same but from the top of the monorepo # Same but from the top of the monorepo
RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:20.18.2 npm run --silent RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:20.18.2 npm run --silent
SHELLCHECK_OPTS = \
--shell=bash \
--external-sources
SHELLCHECK_COLOR := $(if $(CI),--color=never,--color)
shellcheck:
find . -type f -name "*.sh" -print0 | xargs -0 -r docker run --rm -v $(HERE):/mnt -w /mnt \
koalaman/shellcheck:stable $(SHELLCHECK_OPTS) $(SHELLCHECK_COLOR)
shellcheck_fix:
@for file in $$(find . -type f -name "*.sh"); do \
diff=$$(docker run --rm -v $(HERE):/mnt -w /mnt koalaman/shellcheck:stable $(SHELLCHECK_OPTS) --format=diff "$$file" 2>/dev/null); \
if [ -n "$$diff" ] && ! echo "$$diff" | patch -p1 >/dev/null 2>&1; then echo "\033[31m$$file\033[0m"; \
elif [ -n "$$diff" ]; then echo "$$file"; \
else echo "\033[2m$$file\033[0m"; fi \
done
format: format:
$(RUN_LINTING) format $(RUN_LINTING) format
@@ -63,7 +80,7 @@ typecheck:
typecheck_ci: typecheck_ci:
$(RUN_LINTING_CI) types:check $(RUN_LINTING_CI) types:check
test: format lint typecheck test_unit test_acceptance test: format lint typecheck shellcheck test_unit test_acceptance
test_unit: test_unit:
ifneq (,$(wildcard test/unit)) ifneq (,$(wildcard test/unit))
@@ -137,6 +154,7 @@ publish:
lint lint_fix \ lint lint_fix \
build_types typecheck \ build_types typecheck \
lint_ci format_ci typecheck_ci \ lint_ci format_ci typecheck_ci \
shellcheck shellcheck_fix \
test test_clean test_unit test_unit_clean \ test test_clean test_unit test_unit_clean \
test_acceptance test_acceptance_debug test_acceptance_pre_run \ test_acceptance test_acceptance_debug test_acceptance_pre_run \
test_acceptance_run test_acceptance_run_debug test_acceptance_clean \ test_acceptance_run test_acceptance_run_debug test_acceptance_clean \

View File

@@ -40,6 +40,23 @@ RUN_LINTING_CI = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.e
# Same but from the top of the monorepo # Same but from the top of the monorepo
RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:20.18.2 npm run --silent RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:20.18.2 npm run --silent
SHELLCHECK_OPTS = \
--shell=bash \
--external-sources
SHELLCHECK_COLOR := $(if $(CI),--color=never,--color)
shellcheck:
find . -type f -name "*.sh" -print0 | xargs -0 -r docker run --rm -v $(HERE):/mnt -w /mnt \
koalaman/shellcheck:stable $(SHELLCHECK_OPTS) $(SHELLCHECK_COLOR)
shellcheck_fix:
@for file in $$(find . -type f -name "*.sh"); do \
diff=$$(docker run --rm -v $(HERE):/mnt -w /mnt koalaman/shellcheck:stable $(SHELLCHECK_OPTS) --format=diff "$$file" 2>/dev/null); \
if [ -n "$$diff" ] && ! echo "$$diff" | patch -p1 >/dev/null 2>&1; then echo "\033[31m$$file\033[0m"; \
elif [ -n "$$diff" ]; then echo "$$file"; \
else echo "\033[2m$$file\033[0m"; fi \
done
format: format:
$(RUN_LINTING) format $(RUN_LINTING) format
@@ -64,7 +81,7 @@ typecheck:
typecheck_ci: typecheck_ci:
$(RUN_LINTING_CI) types:check $(RUN_LINTING_CI) types:check
test: format lint typecheck test_unit test_acceptance test: format lint typecheck shellcheck test_unit test_acceptance
test_unit: test_unit:
ifneq (,$(wildcard test/unit)) ifneq (,$(wildcard test/unit))
@@ -132,6 +149,7 @@ publish:
lint lint_fix \ lint lint_fix \
build_types typecheck \ build_types typecheck \
lint_ci format_ci typecheck_ci \ lint_ci format_ci typecheck_ci \
shellcheck shellcheck_fix \
test test_clean test_unit test_unit_clean \ test test_clean test_unit test_unit_clean \
test_acceptance test_acceptance_debug test_acceptance_pre_run \ test_acceptance test_acceptance_debug test_acceptance_pre_run \
test_acceptance_run test_acceptance_run_debug test_acceptance_clean \ test_acceptance_run test_acceptance_run_debug test_acceptance_clean \

View File

@@ -2,7 +2,7 @@
# add the node user to the docker group on the host # add the node user to the docker group on the host
DOCKER_GROUP=$(stat -c '%g' /var/run/docker.sock) DOCKER_GROUP=$(stat -c '%g' /var/run/docker.sock)
groupadd --non-unique --gid ${DOCKER_GROUP} dockeronhost groupadd --non-unique --gid "${DOCKER_GROUP}" dockeronhost
usermod -aG dockeronhost node usermod -aG dockeronhost node
# compatibility: initial volume setup # compatibility: initial volume setup

View File

@@ -39,6 +39,23 @@ RUN_LINTING_CI = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.e
# Same but from the top of the monorepo # Same but from the top of the monorepo
RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:20.18.2 npm run --silent RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:20.18.2 npm run --silent
SHELLCHECK_OPTS = \
--shell=bash \
--external-sources
SHELLCHECK_COLOR := $(if $(CI),--color=never,--color)
shellcheck:
find . -type f -name "*.sh" -print0 | xargs -0 -r docker run --rm -v $(HERE):/mnt -w /mnt \
koalaman/shellcheck:stable $(SHELLCHECK_OPTS) $(SHELLCHECK_COLOR)
shellcheck_fix:
@for file in $$(find . -type f -name "*.sh"); do \
diff=$$(docker run --rm -v $(HERE):/mnt -w /mnt koalaman/shellcheck:stable $(SHELLCHECK_OPTS) --format=diff "$$file" 2>/dev/null); \
if [ -n "$$diff" ] && ! echo "$$diff" | patch -p1 >/dev/null 2>&1; then echo "\033[31m$$file\033[0m"; \
elif [ -n "$$diff" ]; then echo "$$file"; \
else echo "\033[2m$$file\033[0m"; fi \
done
format: format:
$(RUN_LINTING) format $(RUN_LINTING) format
@@ -63,7 +80,7 @@ typecheck:
typecheck_ci: typecheck_ci:
$(RUN_LINTING_CI) types:check $(RUN_LINTING_CI) types:check
test: format lint typecheck test_unit test_acceptance test: format lint typecheck shellcheck test_unit test_acceptance
test_unit: test_unit:
ifneq (,$(wildcard test/unit)) ifneq (,$(wildcard test/unit))
@@ -137,6 +154,7 @@ publish:
lint lint_fix \ lint lint_fix \
build_types typecheck \ build_types typecheck \
lint_ci format_ci typecheck_ci \ lint_ci format_ci typecheck_ci \
shellcheck shellcheck_fix \
test test_clean test_unit test_unit_clean \ test test_clean test_unit test_unit_clean \
test_acceptance test_acceptance_debug test_acceptance_pre_run \ test_acceptance test_acceptance_debug test_acceptance_pre_run \
test_acceptance_run test_acceptance_run_debug test_acceptance_clean \ test_acceptance_run test_acceptance_run_debug test_acceptance_clean \

View File

@@ -39,6 +39,23 @@ RUN_LINTING_CI = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.e
# Same but from the top of the monorepo # Same but from the top of the monorepo
RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:20.18.2 npm run --silent RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:20.18.2 npm run --silent
SHELLCHECK_OPTS = \
--shell=bash \
--external-sources
SHELLCHECK_COLOR := $(if $(CI),--color=never,--color)
shellcheck:
find . -type f -name "*.sh" -print0 | xargs -0 -r docker run --rm -v $(HERE):/mnt -w /mnt \
koalaman/shellcheck:stable $(SHELLCHECK_OPTS) $(SHELLCHECK_COLOR)
shellcheck_fix:
@for file in $$(find . -type f -name "*.sh"); do \
diff=$$(docker run --rm -v $(HERE):/mnt -w /mnt koalaman/shellcheck:stable $(SHELLCHECK_OPTS) --format=diff "$$file" 2>/dev/null); \
if [ -n "$$diff" ] && ! echo "$$diff" | patch -p1 >/dev/null 2>&1; then echo "\033[31m$$file\033[0m"; \
elif [ -n "$$diff" ]; then echo "$$file"; \
else echo "\033[2m$$file\033[0m"; fi \
done
format: format:
$(RUN_LINTING) format $(RUN_LINTING) format
@@ -63,7 +80,7 @@ typecheck:
typecheck_ci: typecheck_ci:
$(RUN_LINTING_CI) types:check $(RUN_LINTING_CI) types:check
test: format lint typecheck test_unit test_acceptance test: format lint typecheck shellcheck test_unit test_acceptance
test_unit: test_unit:
ifneq (,$(wildcard test/unit)) ifneq (,$(wildcard test/unit))
@@ -137,6 +154,7 @@ publish:
lint lint_fix \ lint lint_fix \
build_types typecheck \ build_types typecheck \
lint_ci format_ci typecheck_ci \ lint_ci format_ci typecheck_ci \
shellcheck shellcheck_fix \
test test_clean test_unit test_unit_clean \ test test_clean test_unit test_unit_clean \
test_acceptance test_acceptance_debug test_acceptance_pre_run \ test_acceptance test_acceptance_debug test_acceptance_pre_run \
test_acceptance_run test_acceptance_run_debug test_acceptance_clean \ test_acceptance_run test_acceptance_run_debug test_acceptance_clean \

View File

@@ -1,9 +1,9 @@
#!/bin/sh #!/bin/sh
# health check to allow 404 status code as valid # health check to allow 404 status code as valid
STATUSCODE=$(curl --silent --output /dev/null --write-out "%{http_code}" $1) STATUSCODE=$(curl --silent --output /dev/null --write-out "%{http_code}" "$1")
# will be 000 on non-http error (e.g. connection failure) # will be 000 on non-http error (e.g. connection failure)
if test $STATUSCODE -ge 500 || test $STATUSCODE -lt 200; then if test "$STATUSCODE" -ge 500 || test "$STATUSCODE" -lt 200; then
exit 1 exit 1
fi fi
exit 0 exit 0

View File

@@ -39,6 +39,23 @@ RUN_LINTING_CI = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.e
# Same but from the top of the monorepo # Same but from the top of the monorepo
RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:20.18.2 npm run --silent RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:20.18.2 npm run --silent
SHELLCHECK_OPTS = \
--shell=bash \
--external-sources
SHELLCHECK_COLOR := $(if $(CI),--color=never,--color)
shellcheck:
find . -type f -name "*.sh" -print0 | xargs -0 -r docker run --rm -v $(HERE):/mnt -w /mnt \
koalaman/shellcheck:stable $(SHELLCHECK_OPTS) $(SHELLCHECK_COLOR)
shellcheck_fix:
@for file in $$(find . -type f -name "*.sh"); do \
diff=$$(docker run --rm -v $(HERE):/mnt -w /mnt koalaman/shellcheck:stable $(SHELLCHECK_OPTS) --format=diff "$$file" 2>/dev/null); \
if [ -n "$$diff" ] && ! echo "$$diff" | patch -p1 >/dev/null 2>&1; then echo "\033[31m$$file\033[0m"; \
elif [ -n "$$diff" ]; then echo "$$file"; \
else echo "\033[2m$$file\033[0m"; fi \
done
format: format:
$(RUN_LINTING) format $(RUN_LINTING) format
@@ -63,7 +80,7 @@ typecheck:
typecheck_ci: typecheck_ci:
$(RUN_LINTING_CI) types:check $(RUN_LINTING_CI) types:check
test: format lint typecheck test_unit test_acceptance test: format lint typecheck shellcheck test_unit test_acceptance
test_unit: test_unit:
ifneq (,$(wildcard test/unit)) ifneq (,$(wildcard test/unit))
@@ -137,6 +154,7 @@ publish:
lint lint_fix \ lint lint_fix \
build_types typecheck \ build_types typecheck \
lint_ci format_ci typecheck_ci \ lint_ci format_ci typecheck_ci \
shellcheck shellcheck_fix \
test test_clean test_unit test_unit_clean \ test test_clean test_unit test_unit_clean \
test_acceptance test_acceptance_debug test_acceptance_pre_run \ test_acceptance test_acceptance_debug test_acceptance_pre_run \
test_acceptance_run test_acceptance_run_debug test_acceptance_clean \ test_acceptance_run test_acceptance_run_debug test_acceptance_clean \

View File

@@ -39,6 +39,23 @@ RUN_LINTING_CI = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.e
# Same but from the top of the monorepo # Same but from the top of the monorepo
RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:20.18.2 npm run --silent RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:20.18.2 npm run --silent
SHELLCHECK_OPTS = \
--shell=bash \
--external-sources
SHELLCHECK_COLOR := $(if $(CI),--color=never,--color)
shellcheck:
find . -type f -name "*.sh" -print0 | xargs -0 -r docker run --rm -v $(HERE):/mnt -w /mnt \
koalaman/shellcheck:stable $(SHELLCHECK_OPTS) $(SHELLCHECK_COLOR)
shellcheck_fix:
@for file in $$(find . -type f -name "*.sh"); do \
diff=$$(docker run --rm -v $(HERE):/mnt -w /mnt koalaman/shellcheck:stable $(SHELLCHECK_OPTS) --format=diff "$$file" 2>/dev/null); \
if [ -n "$$diff" ] && ! echo "$$diff" | patch -p1 >/dev/null 2>&1; then echo "\033[31m$$file\033[0m"; \
elif [ -n "$$diff" ]; then echo "$$file"; \
else echo "\033[2m$$file\033[0m"; fi \
done
format: format:
$(RUN_LINTING) format $(RUN_LINTING) format
@@ -63,7 +80,7 @@ typecheck:
typecheck_ci: typecheck_ci:
$(RUN_LINTING_CI) types:check $(RUN_LINTING_CI) types:check
test: format lint typecheck test_unit test_acceptance test: format lint typecheck shellcheck test_unit test_acceptance
test_unit: test_unit:
ifneq (,$(wildcard test/unit)) ifneq (,$(wildcard test/unit))
@@ -130,6 +147,7 @@ publish:
lint lint_fix \ lint lint_fix \
build_types typecheck \ build_types typecheck \
lint_ci format_ci typecheck_ci \ lint_ci format_ci typecheck_ci \
shellcheck shellcheck_fix \
test test_clean test_unit test_unit_clean \ test test_clean test_unit test_unit_clean \
test_acceptance test_acceptance_debug test_acceptance_pre_run \ test_acceptance test_acceptance_debug test_acceptance_pre_run \
test_acceptance_run test_acceptance_run_debug test_acceptance_clean \ test_acceptance_run test_acceptance_run_debug test_acceptance_clean \

View File

@@ -1,9 +1,9 @@
#!/bin/sh #!/bin/sh
# health check to allow 404 status code as valid # health check to allow 404 status code as valid
STATUSCODE=$(curl --silent --output /dev/null --write-out "%{http_code}" $1) STATUSCODE=$(curl --silent --output /dev/null --write-out "%{http_code}" "$1")
# will be 000 on non-http error (e.g. connection failure) # will be 000 on non-http error (e.g. connection failure)
if test $STATUSCODE -ge 500 || test $STATUSCODE -lt 200; then if test "$STATUSCODE" -ge 500 || test "$STATUSCODE" -lt 200; then
exit 1 exit 1
fi fi
exit 0 exit 0

View File

@@ -39,6 +39,23 @@ RUN_LINTING_CI = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.e
# Same but from the top of the monorepo # Same but from the top of the monorepo
RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:20.18.2 npm run --silent RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:20.18.2 npm run --silent
SHELLCHECK_OPTS = \
--shell=bash \
--external-sources
SHELLCHECK_COLOR := $(if $(CI),--color=never,--color)
shellcheck:
find . -type f -name "*.sh" -print0 | xargs -0 -r docker run --rm -v $(HERE):/mnt -w /mnt \
koalaman/shellcheck:stable $(SHELLCHECK_OPTS) $(SHELLCHECK_COLOR)
shellcheck_fix:
@for file in $$(find . -type f -name "*.sh"); do \
diff=$$(docker run --rm -v $(HERE):/mnt -w /mnt koalaman/shellcheck:stable $(SHELLCHECK_OPTS) --format=diff "$$file" 2>/dev/null); \
if [ -n "$$diff" ] && ! echo "$$diff" | patch -p1 >/dev/null 2>&1; then echo "\033[31m$$file\033[0m"; \
elif [ -n "$$diff" ]; then echo "$$file"; \
else echo "\033[2m$$file\033[0m"; fi \
done
format: format:
$(RUN_LINTING) format $(RUN_LINTING) format
@@ -63,7 +80,7 @@ typecheck:
typecheck_ci: typecheck_ci:
$(RUN_LINTING_CI) types:check $(RUN_LINTING_CI) types:check
test: format lint typecheck test_unit test_acceptance test: format lint typecheck shellcheck test_unit test_acceptance
test_unit: test_unit:
ifneq (,$(wildcard test/unit)) ifneq (,$(wildcard test/unit))
@@ -137,6 +154,7 @@ publish:
lint lint_fix \ lint lint_fix \
build_types typecheck \ build_types typecheck \
lint_ci format_ci typecheck_ci \ lint_ci format_ci typecheck_ci \
shellcheck shellcheck_fix \
test test_clean test_unit test_unit_clean \ test test_clean test_unit test_unit_clean \
test_acceptance test_acceptance_debug test_acceptance_pre_run \ test_acceptance test_acceptance_debug test_acceptance_pre_run \
test_acceptance_run test_acceptance_run_debug test_acceptance_clean \ test_acceptance_run test_acceptance_run_debug test_acceptance_clean \

View File

@@ -39,6 +39,23 @@ RUN_LINTING_CI = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.e
# Same but from the top of the monorepo # Same but from the top of the monorepo
RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:20.18.2 npm run --silent RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:20.18.2 npm run --silent
SHELLCHECK_OPTS = \
--shell=bash \
--external-sources
SHELLCHECK_COLOR := $(if $(CI),--color=never,--color)
shellcheck:
find . -type f -name "*.sh" -print0 | xargs -0 -r docker run --rm -v $(HERE):/mnt -w /mnt \
koalaman/shellcheck:stable $(SHELLCHECK_OPTS) $(SHELLCHECK_COLOR)
shellcheck_fix:
@for file in $$(find . -type f -name "*.sh"); do \
diff=$$(docker run --rm -v $(HERE):/mnt -w /mnt koalaman/shellcheck:stable $(SHELLCHECK_OPTS) --format=diff "$$file" 2>/dev/null); \
if [ -n "$$diff" ] && ! echo "$$diff" | patch -p1 >/dev/null 2>&1; then echo "\033[31m$$file\033[0m"; \
elif [ -n "$$diff" ]; then echo "$$file"; \
else echo "\033[2m$$file\033[0m"; fi \
done
format: format:
$(RUN_LINTING) format $(RUN_LINTING) format
@@ -63,7 +80,7 @@ typecheck:
typecheck_ci: typecheck_ci:
$(RUN_LINTING_CI) types:check $(RUN_LINTING_CI) types:check
test: format lint typecheck test_unit test_acceptance test: format lint typecheck shellcheck test_unit test_acceptance
test_unit: test_unit:
ifneq (,$(wildcard test/unit)) ifneq (,$(wildcard test/unit))
@@ -137,6 +154,7 @@ publish:
lint lint_fix \ lint lint_fix \
build_types typecheck \ build_types typecheck \
lint_ci format_ci typecheck_ci \ lint_ci format_ci typecheck_ci \
shellcheck shellcheck_fix \
test test_clean test_unit test_unit_clean \ test test_clean test_unit test_unit_clean \
test_acceptance test_acceptance_debug test_acceptance_pre_run \ test_acceptance test_acceptance_debug test_acceptance_pre_run \
test_acceptance_run test_acceptance_run_debug test_acceptance_clean \ test_acceptance_run test_acceptance_run_debug test_acceptance_clean \

View File

@@ -39,6 +39,23 @@ RUN_LINTING_CI = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.e
# Same but from the top of the monorepo # Same but from the top of the monorepo
RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:20.18.2 npm run --silent RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:20.18.2 npm run --silent
SHELLCHECK_OPTS = \
--shell=bash \
--external-sources
SHELLCHECK_COLOR := $(if $(CI),--color=never,--color)
shellcheck:
find . -type f -name "*.sh" -print0 | xargs -0 -r docker run --rm -v $(HERE):/mnt -w /mnt \
koalaman/shellcheck:stable $(SHELLCHECK_OPTS) $(SHELLCHECK_COLOR)
shellcheck_fix:
@for file in $$(find . -type f -name "*.sh"); do \
diff=$$(docker run --rm -v $(HERE):/mnt -w /mnt koalaman/shellcheck:stable $(SHELLCHECK_OPTS) --format=diff "$$file" 2>/dev/null); \
if [ -n "$$diff" ] && ! echo "$$diff" | patch -p1 >/dev/null 2>&1; then echo "\033[31m$$file\033[0m"; \
elif [ -n "$$diff" ]; then echo "$$file"; \
else echo "\033[2m$$file\033[0m"; fi \
done
format: format:
$(RUN_LINTING) format $(RUN_LINTING) format
@@ -63,7 +80,7 @@ typecheck:
typecheck_ci: typecheck_ci:
$(RUN_LINTING_CI) types:check $(RUN_LINTING_CI) types:check
test: format lint typecheck test_unit test_acceptance test: format lint typecheck shellcheck test_unit test_acceptance
test_unit: test_unit:
ifneq (,$(wildcard test/unit)) ifneq (,$(wildcard test/unit))
@@ -137,6 +154,7 @@ publish:
lint lint_fix \ lint lint_fix \
build_types typecheck \ build_types typecheck \
lint_ci format_ci typecheck_ci \ lint_ci format_ci typecheck_ci \
shellcheck shellcheck_fix \
test test_clean test_unit test_unit_clean \ test test_clean test_unit test_unit_clean \
test_acceptance test_acceptance_debug test_acceptance_pre_run \ test_acceptance test_acceptance_debug test_acceptance_pre_run \
test_acceptance_run test_acceptance_run_debug test_acceptance_clean \ test_acceptance_run test_acceptance_run_debug test_acceptance_clean \

View File

@@ -39,6 +39,23 @@ RUN_LINTING_CI = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.e
# Same but from the top of the monorepo # Same but from the top of the monorepo
RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:20.18.2 npm run --silent RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:20.18.2 npm run --silent
SHELLCHECK_OPTS = \
--shell=bash \
--external-sources
SHELLCHECK_COLOR := $(if $(CI),--color=never,--color)
shellcheck:
find . -type f -name "*.sh" -print0 | xargs -0 -r docker run --rm -v $(HERE):/mnt -w /mnt \
koalaman/shellcheck:stable $(SHELLCHECK_OPTS) $(SHELLCHECK_COLOR)
shellcheck_fix:
@for file in $$(find . -type f -name "*.sh"); do \
diff=$$(docker run --rm -v $(HERE):/mnt -w /mnt koalaman/shellcheck:stable $(SHELLCHECK_OPTS) --format=diff "$$file" 2>/dev/null); \
if [ -n "$$diff" ] && ! echo "$$diff" | patch -p1 >/dev/null 2>&1; then echo "\033[31m$$file\033[0m"; \
elif [ -n "$$diff" ]; then echo "$$file"; \
else echo "\033[2m$$file\033[0m"; fi \
done
format: format:
$(RUN_LINTING) format $(RUN_LINTING) format
@@ -63,7 +80,7 @@ typecheck:
typecheck_ci: typecheck_ci:
$(RUN_LINTING_CI) types:check $(RUN_LINTING_CI) types:check
test: format lint typecheck test_unit test_acceptance test: format lint typecheck shellcheck test_unit test_acceptance
test_unit: test_unit:
ifneq (,$(wildcard test/unit)) ifneq (,$(wildcard test/unit))
@@ -130,6 +147,7 @@ publish:
lint lint_fix \ lint lint_fix \
build_types typecheck \ build_types typecheck \
lint_ci format_ci typecheck_ci \ lint_ci format_ci typecheck_ci \
shellcheck shellcheck_fix \
test test_clean test_unit test_unit_clean \ test test_clean test_unit test_unit_clean \
test_acceptance test_acceptance_debug test_acceptance_pre_run \ test_acceptance test_acceptance_debug test_acceptance_pre_run \
test_acceptance_run test_acceptance_run_debug test_acceptance_clean \ test_acceptance_run test_acceptance_run_debug test_acceptance_clean \