@@ -10,4 +10,4 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: test
|
- name: test
|
||||||
run: test.sh
|
run: make test
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
.PHONY: build
|
||||||
|
build: ## Builds all the dockerfiles in the repository.
|
||||||
|
@$(CURDIR)/build-all.sh
|
||||||
|
|
||||||
|
.PHONY: test
|
||||||
|
test: shellcheck ## Runs the tests on the repository.
|
||||||
|
|
||||||
|
.PHONY: shellcheck
|
||||||
|
shellcheck: ## Runs the shellcheck tests on the scripts.
|
||||||
|
docker run --rm -i $(DOCKER_FLAGS) \
|
||||||
|
--name df-shellcheck \
|
||||||
|
-v $(CURDIR):/usr/src:ro \
|
||||||
|
--workdir /usr/src \
|
||||||
|
uleenucks/shellcheck ./shellcheck.sh
|
||||||
|
|
||||||
|
.PHONY: help
|
||||||
|
help:
|
||||||
|
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
||||||
Executable
+24
@@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
ERRORS=()
|
||||||
|
|
||||||
|
# find all executables and run `shellcheck`
|
||||||
|
for f in $(find . -type f -not -iwholename '*.git*' -not -name "Dockerfile" | sort -u); do
|
||||||
|
if file "$f" | grep --quiet shell; then
|
||||||
|
{
|
||||||
|
shellcheck "$f" && echo "[OK]: sucessfully linted $f"
|
||||||
|
} || {
|
||||||
|
# add to errors
|
||||||
|
ERRORS+=("$f")
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ ${#ERRORS[@]} -eq 0 ]; then
|
||||||
|
echo "No errors, hooray"
|
||||||
|
else
|
||||||
|
echo "These files failed shellcheck: ${ERRORS[*]}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user