mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-09 18:43:34 -05:00
527c5a3986
* Generate a code coverage report * make linters happy * adding action and badge * no report for me * Upload the test report * adding folders * spaces not tabs * makefiles love tabs * spacing is important * rawr * Fix makefile * Add diagnostic info * Set UID and GID * Make info * Add docker images in diagnostic info * Move info before testing the local action * Add missing -C to git diff-tree * Reset ownership * Add missing quotes * Sudo * Attempt to fix ARM test * Attempt to fix go test Co-authored-by: Admiral Awkbar <admiralawkbar@github.com>
60 lines
2.1 KiB
Makefile
60 lines
2.1 KiB
Makefile
# Inspired by https://github.com/jessfraz/dotfiles
|
|
|
|
.PHONY: all
|
|
all: info test ## Run all targets.
|
|
|
|
.PHONY: test
|
|
test: info clean kcov prepare-test-reports ## Run tests
|
|
|
|
# if this session isn't interactive, then we don't want to allocate a
|
|
# TTY, which would fail, but if it is interactive, we do want to attach
|
|
# so that the user can send e.g. ^C through.
|
|
INTERACTIVE := $(shell [ -t 0 ] && echo 1 || echo 0)
|
|
ifeq ($(INTERACTIVE), 1)
|
|
DOCKER_FLAGS += -t
|
|
endif
|
|
|
|
.PHONY: info
|
|
info: ## Gather information about the runtime environment
|
|
echo "whoami: $$(whoami)"; \
|
|
echo "pwd: $$(pwd)"; \
|
|
echo "ls -ahl: $$(ls -ahl)"; \
|
|
docker images
|
|
|
|
.PHONY: kcov
|
|
kcov: ## Run kcov
|
|
docker run --rm $(DOCKER_FLAGS) \
|
|
--user "$$(id -u)":"$$(id -g)" \
|
|
-v "$(CURDIR)":/workspace \
|
|
-w="/workspace" \
|
|
kcov/kcov \
|
|
kcov \
|
|
--bash-parse-files-in-dir=/workspace \
|
|
--clean \
|
|
--exclude-pattern=.coverage,.git \
|
|
--include-pattern=.sh \
|
|
/workspace/test/.coverage \
|
|
/workspace/test/runTests.sh
|
|
|
|
COBERTURA_REPORTS_DESTINATION_DIRECTORY := "$(CURDIR)/test/reports/cobertura"
|
|
|
|
.PHONY: prepare-test-reports
|
|
prepare-test-reports: ## Prepare the test reports for consumption
|
|
mkdir -p $(COBERTURA_REPORTS_DESTINATION_DIRECTORY); \
|
|
COBERTURA_REPORTS="$$(find "$$(pwd)" -name 'cobertura.xml')"; \
|
|
for COBERTURA_REPORT_FILE_PATH in $$COBERTURA_REPORTS ; do \
|
|
COBERTURA_REPORT_DIRECTORY_PATH="$$(dirname "$$COBERTURA_REPORT_FILE_PATH")"; \
|
|
COBERTURA_REPORT_DIRECTORY_NAME="$$(basename "$$COBERTURA_REPORT_DIRECTORY_PATH")"; \
|
|
COBERTURA_REPORT_DIRECTORY_NAME_NO_SUFFIX="$${COBERTURA_REPORT_DIRECTORY_NAME%.*}"; \
|
|
mkdir -p "$(COBERTURA_REPORTS_DESTINATION_DIRECTORY)"/"$$COBERTURA_REPORT_DIRECTORY_NAME_NO_SUFFIX"; \
|
|
cp "$$COBERTURA_REPORT_FILE_PATH" "$(COBERTURA_REPORTS_DESTINATION_DIRECTORY)"/"$$COBERTURA_REPORT_DIRECTORY_NAME_NO_SUFFIX"/cobertura.xml; \
|
|
done
|
|
|
|
.PHONY: clean
|
|
clean: ## Clean the workspace
|
|
rm -rf $(CURDIR)/test/.coverage; \
|
|
rm -rf $(CURDIR)/test/reports
|
|
|
|
.PHONY: help
|
|
help: ## Show help
|
|
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|