mirror of
https://github.com/slsa-framework/slsa-verifier.git
synced 2026-05-07 09:06:35 +00:00
* Add Makefile and yamllint config Signed-off-by: Ian Lewis <ianmlewis@gmail.com> * Add golangci-lint config Signed-off-by: Ian Lewis <ianmlewis@gmail.com> * Add golangci-lint config Signed-off-by: Ian Lewis <ianmlewis@gmail.com> * add linters to pre-submit Signed-off-by: Ian Lewis <ianmlewis@gmail.com> * add issue link to todos Signed-off-by: Ian Lewis <ianmlewis@gmail.com> * Fix whitespace issue Signed-off-by: Ian Lewis <ianmlewis@gmail.com> Signed-off-by: Ian Lewis <ianmlewis@gmail.com>
58 lines
1.5 KiB
Makefile
58 lines
1.5 KiB
Makefile
SHELL := /bin/bash
|
|
OUTPUT_FORMAT = $(shell if [ "${GITHUB_ACTIONS}" == "true" ]; then echo "github"; else echo ""; fi)
|
|
|
|
.PHONY: help
|
|
help: ## Shows all targets and help from the Makefile (this message).
|
|
@echo "slsa-github-generator Makefile"
|
|
@echo "Usage: make [COMMAND]"
|
|
@echo ""
|
|
@grep --no-filename -E '^([/a-z.A-Z0-9_%-]+:.*?|)##' $(MAKEFILE_LIST) | \
|
|
awk 'BEGIN {FS = "(:.*?|)## ?"}; { \
|
|
if (length($$1) > 0) { \
|
|
printf " \033[36m%-20s\033[0m %s\n", $$1, $$2; \
|
|
} else { \
|
|
if (length($$2) > 0) { \
|
|
printf "%s\n", $$2; \
|
|
} \
|
|
} \
|
|
}'
|
|
|
|
## Testing
|
|
#####################################################################
|
|
|
|
.PHONY: unit-test
|
|
unit-test: ## Runs all unit tests.
|
|
# Run unit tests for the detect-workflow action.
|
|
make -C .github/actions/detect-workflow/ unit-test
|
|
go mod vendor
|
|
go test -mod=vendor -v ./...
|
|
|
|
|
|
## Linters
|
|
#####################################################################
|
|
|
|
.PHONY: lint
|
|
lint: golangci-lint eslint yamllint ## Run all linters.
|
|
|
|
.PHONY: golangci-lint
|
|
golangci-lint: ## Runs the golangci-lint linter.
|
|
@set -e;\
|
|
extraargs=""; \
|
|
if [ "$(OUTPUT_FORMAT)" == "github" ]; then \
|
|
extraargs="--out-format github-actions"; \
|
|
fi; \
|
|
golangci-lint run -c .golangci.yml ./... $$extraargs
|
|
|
|
.PHONY: eslint
|
|
eslint: ## Runs the eslint linter.
|
|
make -C actions/installer lint
|
|
|
|
.PHONY: yamllint
|
|
yamllint: ## Runs the yamllint linter.
|
|
@set -e;\
|
|
extraargs=""; \
|
|
if [ "$(OUTPUT_FORMAT)" == "github" ]; then \
|
|
extraargs="-f github"; \
|
|
fi; \
|
|
yamllint -c .yamllint.yaml . $$extraargs
|