diff --git a/.gitattributes b/.gitattributes index 23b22c3c..3015580b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -13,5 +13,6 @@ phpstan.neon export-ignore CHANGELOG.md export-ignore CONTRIBUTING.md export-ignore docker-compose.yml export-ignore +Makefile export-ignore README.md export-ignore diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ea3fc05f..4f24ec41 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -61,15 +61,15 @@ If you have Docker installed, you can quickly get all dependencies for Pest in p our Docker files. Assuming you have the repository cloned, you may run the following commands: -1. `docker compose build` to build the Docker image -2. `docker compose run --rm composer install` to install Composer dependencies -3. `docker compose run --rm composer test` to run the project tests and analysis tools +1. `make build` to build the Docker image +2. `make install` to install Composer dependencies +3. `make test` to run the project tests and analysis tools If you want to check things work against a specific version of PHP, you may include the `PHP` build argument when building the image: ```bash -docker compose build --build-arg PHP=8.2 +make build ARGS="--build-arg PHP=8.2" ``` The default PHP version will always be the lowest version of PHP supported by Pest. diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..ec4faa84 --- /dev/null +++ b/Makefile @@ -0,0 +1,14 @@ +# Well documented Makefiles +DEFAULT_GOAL := help +help: + @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-40s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) + +build: ## Build all docker images. Specify the command e.g. via make build ARGS="--build-arg PHP=8.2" + docker compose build $(ARGS) + +##@ [Application] +install: ## Install the composer dependencies + docker compose run --rm composer install + +test: ## Run the tests + docker compose run --rm composer test