2021-04-22 14:56:18 -04:00
# Inspired by https://github.com/jessfraz/dotfiles
.PHONY : all
2023-10-19 17:03:14 -04:00
all : info docker test ## Run all targets.
2021-04-22 14:56:18 -04:00
.PHONY : test
2024-11-20 03:37:24 -05:00
test : info validate -container -image -labels docker -build -check docker -dev -container -build -check npm -audit test -lib inspec lint -codebase fix -codebase test -default -config -files test -actions -runner -debug test -actions -steps -debug test -runner -debug test -find lint -subset -files test -custom -ssl -cert test -non -default -workdir test -git -flags test -non -default -home -directory test -git -initial -commit test -git -merge -commit -push test -log -level test -use -find -and -ignore -gitignored -files test -linters -expect -failure -log -level -notice test -bash -exec -library -expect -success test -bash -exec -library -expect -failure test -save -super -linter -output test -save -super -linter -output -custom -path test -save -super -linter -custom -summary test -custom -gitleaks -log -level test -dont -save -super -linter -log -file test -dont -save -super -linter -output test -linter -command -options test -linters test -linters -fix -mode ## Run the test suite
2021-04-22 14:56:18 -04:00
# 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)
i f e q ( $( INTERACTIVE ) , 1 )
DOCKER_FLAGS += -t
e n d i f
.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}'
2021-04-30 12:29:15 -04:00
.PHONY : inspec -check
inspec-check : ## Validate inspec profiles
docker run $( DOCKER_FLAGS) \
--rm \
-v " $( CURDIR) " :/workspace \
-w= "/workspace" \
chef/inspec check \
--chef-license= accept \
test/inspec/super-linter
SUPER_LINTER_TEST_CONTAINER_NAME := "super-linter-test"
2023-10-19 17:03:14 -04:00
SUPER_LINTER_TEST_CONTAINER_URL := $( CONTAINER_IMAGE_ID)
2021-05-25 11:14:43 -04:00
DOCKERFILE := ''
2023-10-19 17:03:14 -04:00
IMAGE := $( CONTAINER_IMAGE_TARGET)
# Default to stadard
i f e q ( $( IMAGE ) , )
IMAGE := "standard"
e n d i f
# Default to latest
i f e q ( $( SUPER_LINTER_TEST_CONTAINER_URL ) , )
SUPER_LINTER_TEST_CONTAINER_URL := "ghcr.io/super-linter/super-linter:latest"
2021-05-25 11:14:43 -04:00
e n d i f
2021-04-30 12:29:15 -04:00
2023-12-07 09:18:47 -05:00
i f e q ( $( BUILD_DATE ) , )
BUILD_DATE := $( shell date -u +'%Y-%m-%dT%H:%M:%SZ' )
e n d i f
i f e q ( $( BUILD_REVISION ) , )
BUILD_REVISION := $( shell git rev-parse HEAD)
e n d i f
i f e q ( $( BUILD_VERSION ) , )
BUILD_VERSION := $( shell git rev-parse HEAD)
e n d i f
2023-12-19 13:37:16 -05:00
i f e q ( $( FROM_INTERVAL_COMMITLINT ) , )
FROM_INTERVAL_COMMITLINT := "HEAD~1"
e n d i f
i f e q ( $( TO_INTERVAL_COMMITLINT ) , )
TO_INTERVAL_COMMITLINT := "HEAD"
e n d i f
2023-12-12 13:53:48 -05:00
GITHUB_TOKEN_PATH := " $( CURDIR) /.github-personal-access-token "
2024-02-09 13:45:44 -05:00
i f e q ( $( GITHUB_TOKEN ) , )
GITHUB_TOKEN = " $( shell cat " ${ GITHUB_TOKEN_PATH } " ) "
e n d i f
2023-12-21 09:03:14 -05:00
DEV_CONTAINER_URL := "super-linter/dev-container:latest"
2023-12-19 13:37:16 -05:00
2023-12-21 09:03:14 -05:00
i f e q ( $( GITHUB_HEAD_REF ) , )
RELEASE_PLEASE_TARGET_BRANCH := " $( shell git branch --show-current) "
e l s e
RELEASE_PLEASE_TARGET_BRANCH := " ${ GITHUB_HEAD_REF } "
e n d i f
2024-07-10 08:45:32 -04:00
.PHONY : info
info : ## Gather information about the runtime environment
echo " whoami: $$ (whoami) " ; \
echo " pwd: $$ (pwd) " ; \
2024-07-31 06:32:56 -04:00
echo "IMAGE:" $( IMAGE) ; \
2024-08-13 06:10:31 -04:00
echo " Build date: ${ BUILD_DATE } " ; \
echo " Build revision: ${ BUILD_REVISION } " ; \
echo " Build version: ${ BUILD_VERSION } " ; \
2024-07-31 06:32:56 -04:00
echo "SUPER_LINTER_TEST_CONTAINER_URL:" $( SUPER_LINTER_TEST_CONTAINER_URL) ; \
2024-07-10 08:45:32 -04:00
echo " ls -ahl: $$ (ls -ahl) " ; \
docker images; \
docker ps; \
echo "Container image layers size:" ; \
docker history \
--human \
--no-trunc \
--format "{{.Size}} {{.CreatedSince}} {{.CreatedBy}}" \
$( SUPER_LINTER_TEST_CONTAINER_URL) \
| sort --human
2024-02-27 13:17:22 -05:00
.PHONY : check -github -token
2023-12-21 09:03:14 -05:00
check-github-token :
@if [ ! -f " ${ GITHUB_TOKEN_PATH } " ] ; then echo " Cannot find the file to load the GitHub access token: $( GITHUB_TOKEN_PATH) . Create a readable file there, and populate it with a GitHub personal access token. " ; exit 1; fi
2024-02-27 13:17:22 -05:00
.PHONY : inspec
2021-04-30 12:29:15 -04:00
inspec : inspec -check ## Run InSpec tests
2023-10-19 17:03:14 -04:00
DOCKER_CONTAINER_STATE = " $$ (docker inspect --format " { { .State.Running} } " $( SUPER_LINTER_TEST_CONTAINER_NAME) 2>/dev/null || echo " ")" ; \
if [ " $$ DOCKER_CONTAINER_STATE " = "true" ] ; then docker kill $( SUPER_LINTER_TEST_CONTAINER_NAME) ; fi && \
docker tag $( SUPER_LINTER_TEST_CONTAINER_URL) $( SUPER_LINTER_TEST_CONTAINER_NAME) && \
SUPER_LINTER_TEST_CONTAINER_ID = " $$ (docker run -d --name $( SUPER_LINTER_TEST_CONTAINER_NAME) --rm -it --entrypoint /bin/ash $( SUPER_LINTER_TEST_CONTAINER_NAME) -c " while true; do sleep 1; done ")" \
2021-04-30 12:29:15 -04:00
&& docker run $( DOCKER_FLAGS) \
--rm \
-v " $( CURDIR) " :/workspace \
-v /var/run/docker.sock:/var/run/docker.sock \
2021-05-25 11:14:43 -04:00
-e IMAGE = $( IMAGE) \
2021-04-30 12:29:15 -04:00
-w= "/workspace" \
2023-12-15 05:59:36 -05:00
chef/inspec exec test/inspec/super-linter \
2021-04-30 12:29:15 -04:00
--chef-license= accept \
--diagnose \
--log-level= debug \
-t " docker:// $$ {SUPER_LINTER_TEST_CONTAINER_ID} " \
&& docker ps \
2023-10-19 17:03:14 -04:00
&& docker kill $( SUPER_LINTER_TEST_CONTAINER_NAME)
2022-12-29 12:56:54 -05:00
2024-02-27 13:17:22 -05:00
.PHONY : docker
2024-07-11 02:08:23 -04:00
docker : docker -build -check check -github -token ## Build the container image
2023-01-04 01:00:02 -05:00
DOCKER_BUILDKIT = 1 docker buildx build --load \
2023-12-07 09:18:47 -05:00
--build-arg BUILD_DATE = $( BUILD_DATE) \
--build-arg BUILD_REVISION = $( BUILD_REVISION) \
--build-arg BUILD_VERSION = $( BUILD_VERSION) \
2023-12-12 13:53:48 -05:00
--secret id = GITHUB_TOKEN,src= $( GITHUB_TOKEN_PATH) \
2024-01-10 05:09:53 -05:00
--target $( IMAGE) \
2023-10-19 17:03:14 -04:00
-t $( SUPER_LINTER_TEST_CONTAINER_URL) .
2024-07-11 02:08:23 -04:00
.PHONY : docker -build -check ## Run Docker build checks against the Super-linter image
2024-07-09 05:22:29 -04:00
docker-build-check :
DOCKER_BUILDKIT = 1 docker buildx build --check \
.
2024-02-27 13:17:22 -05:00
.PHONY : docker -pull
2023-10-19 17:03:14 -04:00
docker-pull : ## Pull the container image from registry
docker pull $( SUPER_LINTER_TEST_CONTAINER_URL)
2023-12-07 09:18:47 -05:00
2024-06-19 12:58:11 -04:00
.PHONY : open -shell -super -linter -container
open-shell-super-linter-container : ## Open a shell in the Super-linter container
docker run $( DOCKER_FLAGS) \
--interactive \
--entrypoint /bin/bash \
2024-08-25 13:43:33 -04:00
--rm \
2024-06-19 12:58:11 -04:00
-v " $( CURDIR) " :/tmp/lint \
2024-08-30 06:03:08 -04:00
-v " $( CURDIR) /dependencies/Gemfile.lock " :/Gemfile.lock \
-v " $( CURDIR) /dependencies/Gemfile " :/Gemfile \
-v " $( CURDIR) /dependencies/package-lock.json " :/package-lock.json \
-v " $( CURDIR) /dependencies/package.json " :/package.json \
2024-09-13 02:08:39 -04:00
-v " $( CURDIR) /dependencies/composer/composer.json " :/php-composer/composer.json \
-v " $( CURDIR) /dependencies/composer/composer.lock " :/php-composer/composer.lock \
2024-09-05 02:02:36 -04:00
-v " $( CURDIR) /scripts/bash-exec.sh " :/usr/bin/bash-exec \
-v " $( CURDIR) /scripts/git-merge-conflict-markers.sh " :/usr/bin/git-merge-conflict-markers \
2024-06-19 12:58:11 -04:00
$( SUPER_LINTER_TEST_CONTAINER_URL)
2024-02-27 13:17:22 -05:00
.PHONY : validate -container -image -labels
2023-12-07 09:18:47 -05:00
validate-container-image-labels : ## Validate container image labels
$( CURDIR) /test/validate-docker-labels.sh \
$( SUPER_LINTER_TEST_CONTAINER_URL) \
$( BUILD_DATE) \
$( BUILD_REVISION) \
$( BUILD_VERSION)
2023-12-07 14:07:22 -05:00
2024-11-20 04:02:09 -05:00
.PHONY : npm -audit
npm-audit : ## Run npm audit to check for known vulnerable dependencies
docker run $( DOCKER_FLAGS) \
--entrypoint /bin/bash \
--rm \
-v " $( CURDIR) /dependencies/package-lock.json " :/package-lock.json \
-v " $( CURDIR) /dependencies/package.json " :/package.json \
--workdir / \
$( SUPER_LINTER_TEST_CONTAINER_URL) \
-c "npm audit"
2024-01-16 04:23:17 -05:00
# For some cases, mount a directory that doesn't have too many files to keep tests short
2024-02-20 12:27:06 -05:00
.PHONY : test -actions -runner -debug
test-actions-runner-debug : ## Run super-linter with ACTIONS_RUNNER_DEBUG=true
docker run \
-e ACTIONS_RUNNER_DEBUG = true \
-e RUN_LOCAL = true \
-e ENABLE_GITHUB_ACTIONS_GROUP_TITLE = true \
-e DEFAULT_BRANCH = main \
-e USE_FIND_ALGORITHM = true \
2024-09-19 04:53:13 -04:00
-e VALIDATE_GIT_COMMITLINT = false \
2024-02-20 12:27:06 -05:00
-v " $( CURDIR) /.github " :/tmp/lint/.github \
2024-08-25 13:43:33 -04:00
--rm \
2024-02-20 12:27:06 -05:00
$( SUPER_LINTER_TEST_CONTAINER_URL)
.PHONY : test -actions -steps -debug
test-actions-steps-debug : ## Run super-linter with ACTIONS_STEPS_DEBUG=true
docker run \
-e ACTIONS_STEPS_DEBUG = true \
-e RUN_LOCAL = true \
-e ENABLE_GITHUB_ACTIONS_GROUP_TITLE = true \
-e DEFAULT_BRANCH = main \
-e USE_FIND_ALGORITHM = true \
2024-09-19 04:53:13 -04:00
-e VALIDATE_GIT_COMMITLINT = false \
2024-02-20 12:27:06 -05:00
-v " $( CURDIR) /.github " :/tmp/lint/.github \
2024-08-25 13:43:33 -04:00
--rm \
2024-02-20 12:27:06 -05:00
$( SUPER_LINTER_TEST_CONTAINER_URL)
.PHONY : test -runner -debug
test-runner-debug : ## Run super-linter with RUNNER_DEBUG=1
docker run \
-e RUNNER_DEBUG = 1 \
-e RUN_LOCAL = true \
-e ENABLE_GITHUB_ACTIONS_GROUP_TITLE = true \
-e DEFAULT_BRANCH = main \
-e USE_FIND_ALGORITHM = true \
2024-09-19 04:53:13 -04:00
-e VALIDATE_GIT_COMMITLINT = false \
2024-02-20 12:27:06 -05:00
-v " $( CURDIR) /.github " :/tmp/lint/.github \
2024-08-25 13:43:33 -04:00
--rm \
2024-02-20 12:27:06 -05:00
$( SUPER_LINTER_TEST_CONTAINER_URL)
2024-02-27 13:17:22 -05:00
.PHONY : test -find
2023-12-07 14:07:22 -05:00
test-find : ## Run super-linter on a subdirectory with USE_FIND_ALGORITHM=true
docker run \
-e RUN_LOCAL = true \
2024-02-20 12:27:06 -05:00
-e LOG_LEVEL = DEBUG \
2023-12-12 14:57:15 -05:00
-e ENABLE_GITHUB_ACTIONS_GROUP_TITLE = true \
-e DEFAULT_BRANCH = main \
2023-12-07 14:07:22 -05:00
-e USE_FIND_ALGORITHM = true \
2024-09-19 04:53:13 -04:00
-e VALIDATE_GIT_COMMITLINT = false \
2023-12-20 08:58:25 -05:00
-v " $( CURDIR) /.github " :/tmp/lint/.github \
2024-08-25 13:43:33 -04:00
--rm \
2023-12-07 14:07:22 -05:00
$( SUPER_LINTER_TEST_CONTAINER_URL)
2023-12-12 13:53:48 -05:00
2024-01-16 04:23:17 -05:00
# We need to set USE_FIND_ALGORITHM=true because the DEFALUT_WORKSPACE is not
# a Git directory in this test case
2024-02-27 13:17:22 -05:00
.PHONY : test -non -default -workdir
2024-01-16 04:23:17 -05:00
test-non-default-workdir : ## Run super-linter with DEFAULT_WORKSPACE set
docker run \
-e RUN_LOCAL = true \
2024-02-20 12:27:06 -05:00
-e LOG_LEVEL = DEBUG \
2024-01-16 04:23:17 -05:00
-e ENABLE_GITHUB_ACTIONS_GROUP_TITLE = true \
-e DEFAULT_BRANCH = main \
-e DEFAULT_WORKSPACE = /tmp/not-default-workspace \
-e USE_FIND_ALGORITHM = true \
-e VALIDATE_ALL_CODEBASE = true \
2024-09-19 04:53:13 -04:00
-e VALIDATE_GIT_COMMITLINT = false \
2024-01-16 04:23:17 -05:00
-v $( CURDIR) /.github:/tmp/not-default-workspace/.github \
2024-08-25 13:43:33 -04:00
--rm \
2024-01-16 04:23:17 -05:00
$( SUPER_LINTER_TEST_CONTAINER_URL)
2024-02-27 13:17:22 -05:00
.PHONY : test -git -flags
2024-01-16 04:23:17 -05:00
test-git-flags : ## Run super-linter with different git-related flags
docker run \
-e RUN_LOCAL = true \
2024-02-20 12:27:06 -05:00
-e LOG_LEVEL = DEBUG \
2024-01-16 04:23:17 -05:00
-e ENABLE_GITHUB_ACTIONS_GROUP_TITLE = true \
2024-01-31 04:31:06 -05:00
-e FILTER_REGEX_EXCLUDE = ".*(/test/linters/|CHANGELOG.md).*" \
2024-01-16 04:23:17 -05:00
-e DEFAULT_BRANCH = main \
-e IGNORE_GENERATED_FILES = true \
-e IGNORE_GITIGNORED_FILES = true \
-e VALIDATE_ALL_CODEBASE = true \
2024-09-13 08:37:48 -04:00
-e VALIDATE_JAVASCRIPT_STANDARD = false \
2024-01-16 04:23:17 -05:00
-v " $( CURDIR) " :/tmp/lint \
2024-08-25 13:43:33 -04:00
--rm \
2024-01-16 04:23:17 -05:00
$( SUPER_LINTER_TEST_CONTAINER_URL)
2024-02-27 13:17:22 -05:00
.PHONY : lint -codebase
2023-12-12 13:53:48 -05:00
lint-codebase : ## Lint the entire codebase
2024-08-31 08:51:28 -04:00
docker run $( DOCKER_FLAGS) \
2024-08-07 09:36:16 -04:00
-e CREATE_LOG_FILE = true \
2023-12-12 13:53:48 -05:00
-e RUN_LOCAL = true \
2024-02-20 12:27:06 -05:00
-e LOG_LEVEL = DEBUG \
2023-12-12 13:53:48 -05:00
-e DEFAULT_BRANCH = main \
2023-12-12 14:57:15 -05:00
-e ENABLE_GITHUB_ACTIONS_GROUP_TITLE = true \
2024-01-31 04:31:06 -05:00
-e FILTER_REGEX_EXCLUDE = ".*(/test/linters/|CHANGELOG.md).*" \
2024-01-30 14:24:55 -05:00
-e GITLEAKS_CONFIG_FILE = ".gitleaks-ignore-tests.toml" \
2023-12-12 13:53:48 -05:00
-e RENOVATE_SHAREABLE_CONFIG_PRESET_FILE_NAMES = "default.json,hoge.json" \
2024-08-07 09:36:16 -04:00
-e SAVE_SUPER_LINTER_OUTPUT = true \
2024-07-30 02:35:14 -04:00
-e SAVE_SUPER_LINTER_SUMMARY = true \
2023-12-24 11:56:15 -05:00
-e VALIDATE_ALL_CODEBASE = true \
2024-09-13 08:37:48 -04:00
-e VALIDATE_JAVASCRIPT_STANDARD = false \
2023-12-12 13:53:48 -05:00
-v " $( CURDIR) :/tmp/lint " \
2024-08-25 13:43:33 -04:00
--rm \
2023-12-12 13:53:48 -05:00
$( SUPER_LINTER_TEST_CONTAINER_URL)
2024-08-07 09:36:16 -04:00
# Return an error if there are changes to commit
.PHONY : fix -codebase
fix-codebase : ## Fix and format the entire codebase
2024-08-31 08:51:28 -04:00
docker run $( DOCKER_FLAGS) \
2024-08-07 09:36:16 -04:00
-e CREATE_LOG_FILE = true \
-e DEFAULT_BRANCH = main \
-e ENABLE_GITHUB_ACTIONS_GROUP_TITLE = true \
-e FILTER_REGEX_EXCLUDE = ".*(/test/linters/|CHANGELOG.md).*" \
-e FIX_ENV = true \
-e FIX_JAVASCRIPT_ES = true \
-e FIX_JAVASCRIPT_PRETTIER = true \
-e FIX_JSON = true \
2024-08-15 05:46:02 -04:00
-e FIX_JSON_PRETTIER = true \
2024-08-07 09:36:16 -04:00
-e FIX_MARKDOWN = true \
2024-08-15 05:46:02 -04:00
-e FIX_MARKDOWN_PRETTIER = true \
-e FIX_NATURAL_LANGUAGE = true \
2024-08-07 09:36:16 -04:00
-e FIX_SHELL_SHFMT = true \
2024-08-15 05:46:02 -04:00
-e FIX_YAML_PRETTIER = true \
2024-08-07 09:36:16 -04:00
-e GITLEAKS_CONFIG_FILE = ".gitleaks-ignore-tests.toml" \
-e LOG_LEVEL = DEBUG \
-e RUN_LOCAL = true \
-e SAVE_SUPER_LINTER_OUTPUT = true \
-e SAVE_SUPER_LINTER_SUMMARY = true \
-e VALIDATE_ALL_CODEBASE = true \
2024-09-13 08:37:48 -04:00
-e VALIDATE_JAVASCRIPT_STANDARD = false \
2024-08-07 09:36:16 -04:00
-v " $( CURDIR) :/tmp/lint " \
2024-08-25 13:43:33 -04:00
--rm \
2024-08-07 09:36:16 -04:00
$( SUPER_LINTER_TEST_CONTAINER_URL) \
&& /bin/bash -c " source test/testUtils.sh; if ! CheckUnexpectedGitChanges ${ CURDIR } ; then exit 1; fi "
2024-01-06 12:39:39 -05:00
# This is a smoke test to check how much time it takes to lint only a small
# subset of files, compared to linting the whole codebase.
2024-02-27 13:17:22 -05:00
.PHONY : lint -subset -files
2024-01-06 12:39:39 -05:00
lint-subset-files : lint -subset -files -enable -only -one -type lint -subset -files -enable -expensive -io -checks
2024-02-27 13:17:22 -05:00
.PHONY : lint -subset -files -enable -only -one -type
2024-01-06 12:39:39 -05:00
lint-subset-files-enable-only-one-type : ## Lint a small subset of files in the codebase by enabling only one linter
time docker run \
-e RUN_LOCAL = true \
2024-02-20 12:27:06 -05:00
-e LOG_LEVEL = DEBUG \
2024-01-06 12:39:39 -05:00
-e DEFAULT_BRANCH = main \
-e ENABLE_GITHUB_ACTIONS_GROUP_TITLE = true \
2024-01-31 04:31:06 -05:00
-e FILTER_REGEX_EXCLUDE = ".*(/test/linters/|CHANGELOG.md).*" \
2024-01-06 12:39:39 -05:00
-e VALIDATE_ALL_CODEBASE = true \
-e VALIDATE_MARKDOWN = true \
-v " $( CURDIR) :/tmp/lint " \
2024-08-25 13:43:33 -04:00
--rm \
2024-01-06 12:39:39 -05:00
$( SUPER_LINTER_TEST_CONTAINER_URL)
2024-02-27 13:17:22 -05:00
.PHONY : lint -subset -files -enable -expensive -io -checks
2024-01-06 12:39:39 -05:00
lint-subset-files-enable-expensive-io-checks : ## Lint a small subset of files in the codebase and keep expensive I/O operations to check file types enabled
time docker run \
-e RUN_LOCAL = true \
2024-02-20 12:27:06 -05:00
-e LOG_LEVEL = DEBUG \
2024-01-06 12:39:39 -05:00
-e DEFAULT_BRANCH = main \
-e ENABLE_GITHUB_ACTIONS_GROUP_TITLE = true \
2024-01-31 04:31:06 -05:00
-e FILTER_REGEX_EXCLUDE = ".*(/test/linters/|CHANGELOG.md).*" \
2024-01-06 12:39:39 -05:00
-e VALIDATE_ALL_CODEBASE = true \
-e VALIDATE_ARM = true \
-e VALIDATE_CLOUDFORMATION = true \
-e VALIDATE_KUBERNETES_KUBECONFORM = true \
-e VALIDATE_MARKDOWN = true \
-e VALIDATE_OPENAPI = true \
-e VALIDATE_STATES = true \
-e VALIDATE_TEKTON = true \
-v " $( CURDIR) :/tmp/lint " \
2024-08-25 13:43:33 -04:00
--rm \
2024-01-06 12:39:39 -05:00
$( SUPER_LINTER_TEST_CONTAINER_URL)
2024-02-27 13:17:22 -05:00
.PHONY : test -lib
2024-10-14 12:43:10 -04:00
test-lib : test -globals -languages test -linter -rules test -build -file -list test -detect -files test -github -event test -setup -ssh test -validation test -output test -linter -commands test -linter -versions ## Test super-linter libs and globals
2024-07-31 11:00:41 -04:00
.PHONY : test -globals -languages
test-globals-languages : ## Test globals/languages.sh
docker run \
-v " $( CURDIR) :/tmp/lint " \
-w /tmp/lint \
--entrypoint /tmp/lint/test/lib/globalsLanguagesTest.sh \
2024-08-25 13:43:33 -04:00
--rm \
2024-07-31 11:00:41 -04:00
$( SUPER_LINTER_TEST_CONTAINER_URL)
2023-12-23 13:33:53 -05:00
2024-08-12 06:31:38 -04:00
.PHONY : test -globals -linter -command -options
test-globals-linter-command-options : ## Test globals/LinterCommandsOptions.sh
docker run \
-v " $( CURDIR) :/tmp/lint " \
-w /tmp/lint \
--entrypoint /tmp/lint/test/lib/globalsLinterCommandsOptionsTest.sh \
2024-08-25 13:43:33 -04:00
--rm \
2024-08-12 06:31:38 -04:00
$( SUPER_LINTER_TEST_CONTAINER_URL)
2024-08-05 02:56:56 -04:00
.PHONY : test -linter -rules
test-linter-rules : ## Test linterRules.sh
docker run \
-v " $( CURDIR) :/tmp/lint " \
-w /tmp/lint \
--entrypoint /tmp/lint/test/lib/linterRulesTest.sh \
2024-08-25 13:43:33 -04:00
--rm \
2024-08-05 02:56:56 -04:00
$( SUPER_LINTER_TEST_CONTAINER_URL)
2024-02-27 13:17:22 -05:00
.PHONY : test -build -file -list
2023-12-23 13:33:53 -05:00
test-build-file-list : ## Test buildFileList
docker run \
-v " $( CURDIR) :/tmp/lint " \
-w /tmp/lint \
--entrypoint /tmp/lint/test/lib/buildFileListTest.sh \
2024-08-25 13:43:33 -04:00
--rm \
2023-12-23 13:33:53 -05:00
$( SUPER_LINTER_TEST_CONTAINER_URL)
2024-02-27 13:17:22 -05:00
.PHONY : test -detect -files
test-detect-files : ## Test detectFiles
docker run \
-v " $( CURDIR) :/tmp/lint " \
-w /tmp/lint \
--entrypoint /tmp/lint/test/lib/detectFilesTest.sh \
2024-08-25 13:43:33 -04:00
--rm \
2024-02-27 13:17:22 -05:00
$( SUPER_LINTER_TEST_CONTAINER_URL)
.PHONY : test -github -event
2024-01-05 17:07:39 -05:00
test-github-event : ## Test githubEvent
docker run \
-v " $( CURDIR) :/tmp/lint " \
-w /tmp/lint \
--entrypoint /tmp/lint/test/lib/githubEventTest.sh \
2024-08-25 13:43:33 -04:00
--rm \
2024-01-05 17:07:39 -05:00
$( SUPER_LINTER_TEST_CONTAINER_URL)
2024-02-27 13:17:22 -05:00
.PHONY : test -setup -ssh
2024-02-09 13:45:44 -05:00
test-setup-ssh : ## Test setupSSH
@docker run \
-e GITHUB_TOKEN = ${ GITHUB_TOKEN } \
-v " $( CURDIR) :/tmp/lint " \
-w /tmp/lint \
--entrypoint /tmp/lint/test/lib/setupSSHTest.sh \
2024-08-25 13:43:33 -04:00
--rm \
2024-02-09 13:45:44 -05:00
$( SUPER_LINTER_TEST_CONTAINER_URL)
2024-02-27 13:17:22 -05:00
.PHONY : test -validation
2024-01-05 17:07:39 -05:00
test-validation : ## Test validation
docker run \
-v " $( CURDIR) :/tmp/lint " \
-w /tmp/lint \
--entrypoint /tmp/lint/test/lib/validationTest.sh \
2024-08-25 13:43:33 -04:00
--rm \
2024-01-05 17:07:39 -05:00
$( SUPER_LINTER_TEST_CONTAINER_URL)
2024-07-30 02:35:14 -04:00
.PHONY : test -output
test-output : ## Test output
docker run \
-v " $( CURDIR) :/tmp/lint " \
-w /tmp/lint \
--entrypoint /tmp/lint/test/lib/outputTest.sh \
2024-08-25 13:43:33 -04:00
--rm \
2024-07-30 02:35:14 -04:00
$( SUPER_LINTER_TEST_CONTAINER_URL)
2024-08-05 03:55:58 -04:00
.PHONY : test -linter -commands
test-linter-commands : ## Test linterCommands
docker run \
-v " $( CURDIR) :/tmp/lint " \
-w /tmp/lint \
--entrypoint /tmp/lint/test/lib/linterCommandsTest.sh \
2024-08-25 13:43:33 -04:00
--rm \
2024-08-05 03:55:58 -04:00
$( SUPER_LINTER_TEST_CONTAINER_URL)
2024-10-14 12:43:10 -04:00
.PHONY : test -linter -versions
test-linter-versions : ## Test linterVersions
docker run \
-v " $( CURDIR) :/tmp/lint " \
-w /tmp/lint \
--entrypoint /tmp/lint/test/lib/linterVersionsTest.sh \
--rm \
$( SUPER_LINTER_TEST_CONTAINER_URL)
2024-01-02 12:03:30 -05:00
# Run this test against a small directory because we're only interested in
# loading default configuration files. The directory that we run super-linter
# against should not be .github because that includes default linter rules.
2024-09-19 04:53:13 -04:00
# Disable commitlint because the workspace is not a Git repository.
2024-02-27 13:17:22 -05:00
.PHONY : test -default -config -files
2024-01-02 12:03:30 -05:00
test-default-config-files : ## Test default configuration files loading
docker run \
-e RUN_LOCAL = true \
2024-02-20 12:27:06 -05:00
-e LOG_LEVEL = DEBUG \
2024-01-02 12:03:30 -05:00
-e ENABLE_GITHUB_ACTIONS_GROUP_TITLE = true \
-e DEFAULT_BRANCH = main \
-e USE_FIND_ALGORITHM = true \
2024-09-19 04:53:13 -04:00
-e VALIDATE_GIT_COMMITLINT = false \
2024-01-02 12:03:30 -05:00
-v " $( CURDIR) /docs " :/tmp/lint \
2024-08-25 13:43:33 -04:00
--rm \
2024-01-02 12:03:30 -05:00
$( SUPER_LINTER_TEST_CONTAINER_URL)
2024-02-27 13:17:22 -05:00
.PHONY : test -custom -ssl -cert
2024-01-30 03:05:47 -05:00
test-custom-ssl-cert : ## Test the configuration of a custom SSL/TLS certificate
docker run \
-e RUN_LOCAL = true \
2024-02-20 12:27:06 -05:00
-e LOG_LEVEL = DEBUG \
2024-01-30 03:05:47 -05:00
-e ENABLE_GITHUB_ACTIONS_GROUP_TITLE = true \
-e DEFAULT_BRANCH = main \
-e USE_FIND_ALGORITHM = true \
-e SSL_CERT_SECRET = " $( shell cat test/data/ssl-certificate/rootCA-test.crt) " \
2024-09-19 04:53:13 -04:00
-e VALIDATE_GIT_COMMITLINT = false \
2024-01-30 03:05:47 -05:00
-v " $( CURDIR) /docs " :/tmp/lint \
2024-08-25 13:43:33 -04:00
--rm \
2024-01-30 03:05:47 -05:00
$( SUPER_LINTER_TEST_CONTAINER_URL)
2024-02-27 13:17:22 -05:00
.PHONY : test -non -default -home -directory
2024-02-09 17:57:01 -05:00
test-non-default-home-directory : ## Test a non-default HOME directory
$( CURDIR) /test/run-super-linter-tests.sh \
$( SUPER_LINTER_TEST_CONTAINER_URL) \
2024-07-11 04:01:11 -04:00
"run_test_cases_non_default_home" \
" $( IMAGE) "
2024-02-09 17:57:01 -05:00
2024-08-12 06:31:38 -04:00
.PHONY : test -linters -fix -mode
test-linters-fix-mode : ## Run the linters test suite (fix mode)
2024-08-07 09:36:16 -04:00
$( CURDIR) /test/run-super-linter-tests.sh \
$( SUPER_LINTER_TEST_CONTAINER_URL) \
"run_test_case_fix_mode" \
" $( IMAGE) "
2024-02-27 13:17:22 -05:00
.PHONY : test -linters
2024-01-30 14:24:55 -05:00
test-linters : test -linters -expect -success test -linters -expect -failure ## Run the linters test suite
2024-02-27 13:17:22 -05:00
.PHONY : test -linters -expect -success
2024-01-30 14:24:55 -05:00
test-linters-expect-success : ## Run the linters test suite expecting successes
$( CURDIR) /test/run-super-linter-tests.sh \
$( SUPER_LINTER_TEST_CONTAINER_URL) \
2024-07-11 04:01:11 -04:00
"run_test_cases_expect_success" \
" $( IMAGE) "
2024-01-30 14:24:55 -05:00
2024-02-27 13:17:22 -05:00
.PHONY : test -linters -expect -failure
2024-01-30 14:24:55 -05:00
test-linters-expect-failure : ## Run the linters test suite expecting failures
$( CURDIR) /test/run-super-linter-tests.sh \
$( SUPER_LINTER_TEST_CONTAINER_URL) \
2024-07-11 04:01:11 -04:00
"run_test_cases_expect_failure" \
" $( IMAGE) "
2023-12-19 13:37:16 -05:00
2024-02-27 13:17:22 -05:00
.PHONY : test -log -level
2024-02-09 13:43:58 -05:00
test-log-level : ## Run a test to check if there are conflicts with the LOG_LEVEL variable
$( CURDIR) /test/run-super-linter-tests.sh \
$( SUPER_LINTER_TEST_CONTAINER_URL) \
2024-07-11 04:01:11 -04:00
"run_test_cases_log_level" \
" $( IMAGE) "
2024-02-09 13:43:58 -05:00
2024-02-27 13:17:22 -05:00
.PHONY : test -linters -expect -failure -log -level -notice
2024-02-10 04:16:31 -05:00
test-linters-expect-failure-log-level-notice : ## Run the linters test suite expecting failures with a LOG_LEVEL set to NOTICE
$( CURDIR) /test/run-super-linter-tests.sh \
$( SUPER_LINTER_TEST_CONTAINER_URL) \
2024-07-11 04:01:11 -04:00
"run_test_cases_expect_failure_notice_log" \
" $( IMAGE) "
2024-02-10 04:16:31 -05:00
2024-02-27 13:17:22 -05:00
.PHONY : test -bash -exec -library -expect -success
test-bash-exec-library-expect-success : ## Run the linters test cases for BASH_EXEC expecting successes with BASH_EXEC_IGNORE_LIBRARIES set to true
$( CURDIR) /test/run-super-linter-tests.sh \
$( SUPER_LINTER_TEST_CONTAINER_URL) \
2024-07-11 04:01:11 -04:00
"run_test_case_bash_exec_library_expect_success" \
" $( IMAGE) "
2024-02-27 13:17:22 -05:00
.PHONY : test -bash -exec -library -expect -failure
test-bash-exec-library-expect-failure : ## Run the linters test cases for BASH_EXEC expecting failures with BASH_EXEC_IGNORE_LIBRARIES set to true
$( CURDIR) /test/run-super-linter-tests.sh \
$( SUPER_LINTER_TEST_CONTAINER_URL) \
2024-07-11 04:01:11 -04:00
"run_test_case_bash_exec_library_expect_failure" \
" $( IMAGE) "
2024-02-27 13:17:22 -05:00
2024-04-18 02:48:55 -04:00
.PHONY : test -git -initial -commit
test-git-initial-commit : ## Run super-linter against a repository that only has one commit
$( CURDIR) /test/run-super-linter-tests.sh \
$( SUPER_LINTER_TEST_CONTAINER_URL) \
2024-07-11 04:01:11 -04:00
"run_test_case_git_initial_commit" \
" $( IMAGE) "
2024-04-18 02:48:55 -04:00
2024-08-02 04:37:27 -04:00
.PHONY : test -git -merge -commit -push
test-git-merge-commit-push : ## Run super-linter against a repository that has merge commits on a push event
$( CURDIR) /test/run-super-linter-tests.sh \
$( SUPER_LINTER_TEST_CONTAINER_URL) \
"run_test_case_merge_commit_push" \
" $( IMAGE) "
2024-04-30 11:58:11 -04:00
.PHONY : test -use -find -and -ignore -gitignored -files
test-use-find-and-ignore-gitignored-files : ## Run super-linter with USE_FIND_ALGORITHM=true and IGNORE_GITIGNORED_FILES=true
$( CURDIR) /test/run-super-linter-tests.sh \
$( SUPER_LINTER_TEST_CONTAINER_URL) \
2024-07-11 04:01:11 -04:00
"run_test_case_use_find_and_ignore_gitignored_files" \
" $( IMAGE) "
2024-04-30 11:58:11 -04:00
2024-07-01 08:50:52 -04:00
.PHONY : test -save -super -linter -output
test-save-super-linter-output : ## Run super-linter with SAVE_SUPER_LINTER_OUTPUT=true
$( CURDIR) /test/run-super-linter-tests.sh \
$( SUPER_LINTER_TEST_CONTAINER_URL) \
2024-07-11 04:01:11 -04:00
"run_test_cases_save_super_linter_output" \
" $( IMAGE) "
2024-07-01 08:50:52 -04:00
.PHONY : test -save -super -linter -output -custom -path
test-save-super-linter-output-custom-path : ## Run super-linter with SAVE_SUPER_LINTER_OUTPUT=true and save output in a custom directory
$( CURDIR) /test/run-super-linter-tests.sh \
$( SUPER_LINTER_TEST_CONTAINER_URL) \
2024-07-11 04:01:11 -04:00
"run_test_cases_save_super_linter_output_custom_path" \
" $( IMAGE) "
2024-07-01 08:50:52 -04:00
2024-07-28 15:34:40 -04:00
.PHONY : test -save -super -linter -custom -summary
test-save-super-linter-custom-summary : ## Run super-linter with a custom SUPER_LINTER_SUMMARY_FILE_NAME
$( CURDIR) /test/run-super-linter-tests.sh \
$( SUPER_LINTER_TEST_CONTAINER_URL) \
"run_test_case_custom_summary" \
" $( IMAGE) "
2024-08-14 08:54:16 -04:00
.PHONY : test -custom -gitleaks -log -level
test-custom-gitleaks-log-level : ## Run super-linter with a custom Gitleaks log level
$( CURDIR) /test/run-super-linter-tests.sh \
$( SUPER_LINTER_TEST_CONTAINER_URL) \
"run_test_case_gitleaks_custom_log_level" \
" $( IMAGE) "
2024-08-16 10:23:52 -04:00
.PHONY : test -dont -save -super -linter -log -file
test-dont-save-super-linter-log-file : ## Run super-linter without saving the Super-linter log file
$( CURDIR) /test/run-super-linter-tests.sh \
$( SUPER_LINTER_TEST_CONTAINER_URL) \
"run_test_case_dont_save_super_linter_log_file" \
" $( IMAGE) "
.PHONY : test -dont -save -super -linter -output
test-dont-save-super-linter-output : ## Run super-linter without saving Super-linter output files
$( CURDIR) /test/run-super-linter-tests.sh \
$( SUPER_LINTER_TEST_CONTAINER_URL) \
"run_test_case_dont_save_super_linter_output" \
" $( IMAGE) "
2024-11-20 03:37:24 -05:00
.PHONY : test -linter -command -options
test-linter-command-options : ## Run super-linter passing options to linters
$( CURDIR) /test/run-super-linter-tests.sh \
$( SUPER_LINTER_TEST_CONTAINER_URL) \
"run_test_case_linter_command_options" \
" $( IMAGE) "
2024-07-11 02:08:23 -04:00
.PHONY : docker -dev -container -build -check ## Run Docker build checks against the dev-container image
docker-dev-container-build-check :
DOCKER_BUILDKIT = 1 docker buildx build --check \
" ${ CURDIR } /dev-dependencies "
2024-02-27 13:17:22 -05:00
.PHONY : build -dev -container -image
2024-07-11 02:08:23 -04:00
build-dev-container-image : docker -dev -container -build -check ## Build commit linter container image
2023-12-19 13:37:16 -05:00
DOCKER_BUILDKIT = 1 docker buildx build --load \
2023-12-22 07:22:15 -05:00
--build-arg GID = $( shell id -g) \
--build-arg UID = $( shell id -u) \
2023-12-21 09:03:14 -05:00
-t ${ DEV_CONTAINER_URL } " ${ CURDIR } /dev-dependencies "
2023-12-19 13:37:16 -05:00
2024-02-27 13:17:22 -05:00
.PHONY : release -please -dry -run
2023-12-21 09:03:14 -05:00
release-please-dry-run : build -dev -container -image check -github -token ## Run release-please in dry-run mode to preview the release pull request
@echo " Running release-please against branch: ${ RELEASE_PLEASE_TARGET_BRANCH } " ; \
docker run \
-v " $( CURDIR) :/source-repository " \
2024-08-25 13:43:33 -04:00
--rm \
2023-12-21 09:03:14 -05:00
${ DEV_CONTAINER_URL } \
release-please \
release-pr \
--config-file .github/release-please/release-please-config.json \
--dry-run \
--manifest-file .github/release-please/.release-please-manifest.json \
--repo-url super-linter/super-linter \
--target-branch ${ RELEASE_PLEASE_TARGET_BRANCH } \
2024-02-09 13:45:44 -05:00
--token " ${ GITHUB_TOKEN } " \
2024-01-05 17:07:39 -05:00
--trace
2024-09-13 08:37:48 -04:00
.PHONY : open -shell -dev -container
open-shell-dev-container : build -dev -container -image ## Open a shell in the dev tools container
docker run $( DOCKER_FLAGS) \
--interactive \
--entrypoint /bin/bash \
--rm \
-v " $( CURDIR) /dev-dependencies/package-lock.json " :/package-lock.json \
-v " $( CURDIR) /dev-dependencies/package.json " :/package.json \
$( DEV_CONTAINER_URL)