-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
39 lines (28 loc) · 1.7 KB
/
Makefile
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
.PHONY: help build build-tested test cs static-analysis test-output production validate-multiarch
CLEAR_CONFIG_CACHE=rm -f storage/app/vars/*
OPTS=
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
build: ## Builds the development image needed to run tests etc.
docker buildx build --load --target=development --tag=ghcr.io/roave/docbooktool:test-image .
build-tested: ## Builds the image and runs the tests but does not tag it
docker buildx build --target=tested --progress=plain .
test: build ## Run the unit and integration tests
docker run --rm --entrypoint=php ghcr.io/roave/docbooktool:test-image vendor/bin/phpunit $(OPTS)
cs: build ## Run coding standards checks
docker run --rm --entrypoint=php ghcr.io/roave/docbooktool:test-image vendor/bin/phpcs $(OPTS)
static-analysis: build ## Run the static analysis checks
docker run --rm --entrypoint=php ghcr.io/roave/docbooktool:test-image vendor/bin/psalm $(OPTS)
test-output: ## Write the test fixture outputs to build/ directory - useful for manual visual inspection
rm -Rf build
mkdir -p build
docker buildx build --output=build --target=test-output --tag=ghcr.io/roave/docbooktool:test-image .
production: ## Build and tag a production image
docker buildx build --load --target=production --tag=ghcr.io/roave/docbooktool:latest .
.builder-name:
docker buildx create --use > .builder-name
validate-multiarch: .builder-name ## Validate the production build, multi-arch
docker buildx ls
docker buildx build --platform linux/amd64,linux/arm64 --target production --tag ghcr.io/roave/docbooktool:test-image .
docker buildx rm `cat < .builder-name`
rm .builder-name