-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
65 lines (51 loc) · 2.16 KB
/
Makefile
File metadata and controls
65 lines (51 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
export PATH := $(PATH):$(shell go env GOPATH)/bin
# Default - run help
.DEFAULT_GOAL := help
# Defaults for test
SHORT ?= true
SNAPS ?= false
ACC ?= false
VCR ?= ReplayWithNewEpisodes
help: ## Show this help message
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} \
/^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-20s\033[0m %s\n", $$1, $$2 } \
/^## / { printf " %-20s %s\n", "", substr($$0, 4) }' $(MAKEFILE_LIST)
## Prevents make from trying to interpret the targets as files
.PHONY: build scanner lint lint-fix format clean local-docs test update-snapshots refresh-all help
build: ## Build scanner
scripts/build.sh
scanner: ## Run scanner (Usage: make scanner ARGS="<args>")
go run ./cmd/osv-scanner $(ARGS)
lint: ## Run lints
scripts/run_lints.sh
lint-fix: ## Run lints and fix
scripts/run_lints.sh --fix
format: ## Run formatters
scripts/run_formatters.sh
clean: ## Clean build artifacts
rm -f osv-scanner
rm -f cmd/osv-scanner/scan/image/testdata/test-*.tar
local-docs: ## Run local docs
scripts/run_local_docs.sh
test: ## Run tests
## Options:
## SNAPS=true Update snapshots (Default: false)
## ACC=true Run acceptance tests (Default: false)
## SHORT=false Run full tests (Default: true)
## VCR=mode VCR mode (Default: ReplayWithNewEpisodes):
## - 0|RecordOnly: Record new cassettes
## - 1|ReplayOnly: Replay cassettes, error if missing
## - 2|ReplayWithNewEpisodes: Replay, record if missing
## - 3|RecordOnce: Record if missing
## - 4|Passthrough: Disable VCR
@export TEST_VCR_MODE=$(VCR); \
if [ "$(SNAPS)" = "true" ]; then export UPDATE_SNAPS=true; fi; \
if [ "$(ACC)" = "true" ]; then export TEST_ACCEPTANCE=true; fi; \
ARGS=""; \
if [ "$(SHORT)" = "true" ]; then ARGS="$$ARGS -short"; fi; \
scripts/run_tests.sh $$ARGS
update-snapshots: ## Update snapshots (Equivalent to make test SNAPS=true)
$(MAKE) test SNAPS=true
refresh-all: ## Refresh all snaps, matching CI test (Usage: make refresh-all REBUILD_IMAGES=true)
@if [ "$(REBUILD_IMAGES)" = "true" ]; then $(MAKE) clean; fi
$(MAKE) test ACC=true SHORT=false VCR=RecordOnly SNAPS=true