Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
85 lines (60 loc) · 2.28 KB
/
Copy pathMakefile
File metadata and controls
85 lines (60 loc) · 2.28 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
.PHONY: composer-install composer-update composer-lock composer-audit composer-outdated php-lint phpcs phpcs-fix phpstan php-test php-verify php-coverage go-check go-test go-vulncheck go-verify go-coverage go-build docker-lint compose-validate security-trivy secrets-scan verify clean coverage
composer-install:
composer install --no-interaction --prefer-dist
composer-update:
composer update --no-interaction --prefer-dist
composer-lock:
composer update --no-install --no-interaction
composer-audit:
composer audit
composer-outdated:
composer outdated -D
php-lint:
find . -path ./vendor -prune -o -type f \( -name "*.php" -o -name "*.php.example" \) -print0 | xargs -0 -n1 php -l
phpcs:
phpcs
phpcs-fix:
phpcbf
phpstan:
phpstan analyse --memory-limit=256M --debug --no-progress
php-test:
./vendor/bin/phpunit --no-coverage
php-verify: php-lint phpcs phpstan php-test
php-coverage:
./vendor/bin/phpunit --coverage-text
go-check:
@test -z "$$(gofmt -s -l .)" || (echo "Unformatted files found. Run 'gofmt -s -w .' to fix them." && false)
golangci-lint run ./...
go build ./...
go-test:
go test -v -race ./...
go-coverage:
go test -v -race -coverprofile=coverage.out ./...
go tool cover -func=coverage.out
go-vulncheck:
govulncheck ./...
go-verify: go-check go-test go-vulncheck
go-build:
CGO_ENABLED=0 go build -ldflags="-s -w" -trimpath -o bin/wp-guard ./cmd/wp-guard
docker-lint:
hadolint Dockerfile
compose-validate:
@trap 'rm -f .env; rm -rf secrets' EXIT; \
cp examples/.env.example .env; \
mkdir -p secrets; \
for s in db_name db_user db_password db_root_password table_prefix \
auth_key secure_auth_key logged_in_key nonce_key \
auth_salt secure_auth_salt logged_in_salt nonce_salt \
smtp_host smtp_port smtp_mail smtp_password; do \
touch "secrets/$${s}.txt"; \
done; \
docker compose -f docker-compose.yaml config --quiet; \
docker compose -f docker-compose.dev.yaml config --quiet
security-trivy:
trivy fs --severity CRITICAL,HIGH .
secrets-scan:
gitleaks detect --source . --no-git --no-color -v --redact
verify: docker-lint php-verify go-verify security-trivy secrets-scan
coverage: php-coverage go-coverage
clean:
rm -rf .phpunit.cache .phpcs-cache coverage coverage-html coverage.xml clover.xml coverage.html *.out .gocache bin/