-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(mssql): add odbc 18 support in mssql tests * feat(test): add documentation to run tests locally + Apple Silicon support
- Loading branch information
Showing
6 changed files
with
121 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
.PHONY: $(filter-out help, $(MAKECMDGOALS)) | ||
.DEFAULT_GOAL := help | ||
|
||
DOCKER_COMPOSE := $(if $(shell command -v docker-compose 2> /dev/null),docker-compose,docker compose) -f docker-compose.yml | ||
ARCH := $(shell uname -m) | ||
CURRENT_USER := $(shell id -u):$(shell id -g) | ||
|
||
# Check if docker-compose.override.yml exists and if so, add it to DOCKER_COMPOSE | ||
ifneq (,$(wildcard ./docker-compose.override.yml)) | ||
DOCKER_COMPOSE += -f docker-compose.override.yml | ||
endif | ||
|
||
# Support Apple Silicon | ||
ifeq ($(ARCH),arm64) | ||
DOCKER_COMPOSE += -f docker-compose.amd64.yml | ||
endif | ||
|
||
DOCKER_EXEC_PHP_WITH_USER = $(DOCKER_COMPOSE) exec -u $(CURRENT_USER) php bash -c | ||
|
||
help: ## Show this help message | ||
@echo "\033[33mUsage:\033[0m\n make [target] [arg=\"val\"...]\n\n\033[33mTargets:\033[0m" | ||
@grep -hE '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[32m%-25s\033[0m %s\n", $$1, $$2}' | ||
|
||
start: ## Start the containers for testing | ||
$(MAKE) -i stop | ||
CURRENT_USER=$(CURRENT_USER) $(DOCKER_COMPOSE) up -d --build --force-recreate --remove-orphans | ||
$(DOCKER_COMPOSE) run --rm wait -c mysql:3306,postgres:5432,mssql:1433 -t 60 | ||
$(MAKE) vendor | ||
|
||
stop: ## Stop and remove containers | ||
$(DOCKER_COMPOSE) down --remove-orphans --volumes | ||
|
||
php-cli: ## Open bash in PHP container | ||
$(DOCKER_COMPOSE) exec -u $(CURRENT_USER) php bash | ||
|
||
vendor: ## Install dependencies | ||
$(DOCKER_EXEC_PHP_WITH_USER) "composer install --no-interaction --prefer-dist" | ||
|
||
test: ## Run the tests | ||
$(DOCKER_EXEC_PHP_WITH_USER) "php vendor/bin/codecept run" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
version: '3.9' | ||
|
||
services: | ||
php: | ||
platform: linux/amd64 | ||
|
||
mysql: | ||
platform: linux/amd64 | ||
|
||
postgres: | ||
platform: linux/amd64 | ||
|
||
mssql: | ||
platform: linux/amd64 | ||
|
||
wait: | ||
platform: linux/amd64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Local Test Environment | ||
|
||
## Prerequisites | ||
|
||
- Docker | ||
- Docker Compose | ||
- Make | ||
|
||
## Setup | ||
|
||
1. Clone the repository to your local machine. | ||
2. Navigate to the project directory. | ||
|
||
## Running the Docker Environment | ||
|
||
To start the Docker environment, use the following command: | ||
|
||
```bash | ||
make start | ||
``` | ||
|
||
This command will start all the necessary containers for the application. It will also build the Docker images if they are not already built. | ||
|
||
## Running Tests | ||
|
||
To run the tests, use the following command: | ||
|
||
```bash | ||
make test | ||
``` | ||
|
||
This command will execute the tests inside the PHP container. | ||
|
||
## Other Commands | ||
|
||
- To stop and remove the Docker containers, use the following command: | ||
|
||
```bash | ||
make stop | ||
``` | ||
|
||
- To open a bash shell inside the PHP container, use the following command: | ||
|
||
```bash | ||
make php-cli | ||
``` | ||
|
||
- To install the dependencies, use the following command: | ||
|
||
```bash | ||
make vendor | ||
``` | ||
|
||
Please note that all these commands should be run from the root directory of the project where the `Makefile` is located. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters