-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: Updates PHP version, refactor models, add event emission, and other adjustments. * feat: Adds integration test execution to the pipeline.
- Loading branch information
1 parent
81d3a60
commit 77aea7e
Showing
224 changed files
with
4,707 additions
and
2,065 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
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
.idea | ||
|
||
/vendor/ | ||
/report | ||
composer.lock | ||
.phpunit.result.cache | ||
*.lock | ||
.phpunit.* |
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 |
---|---|---|
@@ -1,7 +1,25 @@ | ||
FROM gustavofreze/php:8.2-fpm | ||
|
||
RUN apk update \ | ||
&& apk add libressl-dev \ | ||
&& pecl install mongodb \ | ||
&& docker-php-ext-enable mongodb \ | ||
&& rm -rf /var/cache/apk/* | ||
LABEL author="Gustavo Freze" \ | ||
maintainer="Gustavo Freze" \ | ||
org.label-schema.name="gustavofreze/cheap-delivery" \ | ||
org.label-schema.vcs-url="https://github.com/gustavofreze/cheap-delivery/blob/main/Dockerfile" \ | ||
org.label-schema.schema-version="1.0" | ||
|
||
ARG FLYWAY_VERSION=10.10.0 | ||
|
||
RUN apk --no-cache add tar curl mysql-client openjdk21-jre \ | ||
&& mkdir -p /opt/flyway \ | ||
&& curl -L "https://repo1.maven.org/maven2/org/flywaydb/flyway-commandline/${FLYWAY_VERSION}/flyway-commandline-${FLYWAY_VERSION}-linux-x64.tar.gz" | tar -xz --strip-components=1 -C /opt/flyway \ | ||
&& rm -f /opt/flyway/jre/bin/java \ | ||
&& ln -s /usr/lib/jvm/java-11-openjdk/jre/bin/java /opt/flyway/jre/bin/java \ | ||
&& ln -s /opt/flyway/flyway /usr/local/bin/flyway \ | ||
&& apk del curl tar | ||
|
||
WORKDIR /var/www/html | ||
|
||
COPY ./db /db | ||
|
||
RUN chmod +x /db/entrypoint.sh | ||
|
||
ENTRYPOINT ["bash", "/db/entrypoint.sh"] |
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 |
---|---|---|
@@ -1,27 +1,60 @@ | ||
DOCKER_RUN = docker run --rm -it --net=host -v ${PWD}:/app -w /app gustavofreze/cheap-delivery | ||
DOCKER_EXEC = docker exec -it cheap-delivery | ||
PWD := $(shell pwd -L) | ||
PHP_IMAGE := gustavofreze/php:8.2 | ||
APP_RUN := docker run -u root --rm -it --network=host -v ${PWD}:/app -w /app ${PHP_IMAGE} | ||
APP_TEST_RUN := docker run -u root --rm -it --name cheap-delivery-integration-test --link cheap-delivery-adm --network=cheap-delivery_default -v ${PWD}:/app -w /app ${PHP_IMAGE} | ||
|
||
.PHONY: configure run test test-no-coverage review show-reports clean | ||
FLYWAY_IMAGE := flyway/flyway:10.10.0 | ||
FLYWAY_RUN := docker run --rm -v ${PWD}/db/mysql/migrations:/flyway/sql --env-file=config/local.env --link cheap-delivery-adm --network=cheap-delivery_default ${FLYWAY_IMAGE} | ||
MIGRATE_DB := ${FLYWAY_RUN} -locations=filesystem:/flyway/sql -schemas=cheap_delivery_adm | ||
MIGRATE_TEST_DB := ${FLYWAY_RUN} -locations=filesystem:/flyway/sql -schemas=cheap_delivery_adm_test | ||
|
||
configure: | ||
.DEFAULT_GOAL := help | ||
|
||
.PHONY: start configure test unit-test integration-test review fix-style show-coverage clean migrate-database clean-database migrate-test-database help | ||
|
||
start: ## Start Docker compose services | ||
@docker-compose up -d --build | ||
@${DOCKER_EXEC} composer update --optimize-autoloader | ||
|
||
run: | ||
@${DOCKER_RUN} composer update --optimize-autoloader | ||
configure: ## Configure development environment | ||
@${APP_RUN} composer update --optimize-autoloader | ||
|
||
test: migrate-test-database ## Run all tests | ||
@${APP_TEST_RUN} composer run tests | ||
|
||
unit-test: ## Run unit tests | ||
@${APP_RUN} composer run unit-test | ||
|
||
integration-test: migrate-test-database ## Run integration tests | ||
@${APP_TEST_RUN} composer run integration-test | ||
|
||
review: ## Run code review | ||
@${APP_RUN} composer review | ||
|
||
fix-style: ## Fix code style | ||
@${APP_RUN} composer fix-style | ||
|
||
test: run review | ||
@${DOCKER_RUN} composer tests | ||
show-coverage: ## Open code coverage reports in browser | ||
@sensible-browser report/coverage/coverage-html/index.html report/coverage/mutation-report.html | ||
|
||
test-no-coverage: run review | ||
@${DOCKER_RUN} composer tests-no-coverage | ||
migrate-database: ## Run database migrations | ||
@${MIGRATE_DB} migrate | ||
|
||
review: | ||
@${DOCKER_RUN} composer review | ||
clean-database: ## Clean database | ||
@${MIGRATE_DB} clean | ||
|
||
show-reports: | ||
@sensible-browser report/coverage/coverage-html/index.html | ||
migrate-test-database: ## Run test database migrations | ||
@${MIGRATE_TEST_DB} clean | ||
@${MIGRATE_TEST_DB} migrate | ||
|
||
clean: | ||
@sudo chown -R ${USER}:${USER} ${PWD} | ||
@rm -rf report vendor | ||
help: ## Display this help message | ||
@echo "Usage: make [target]" | ||
@echo "" | ||
@echo "Setup and run" | ||
@grep -E '^(configure|start|migrate-database|clean-database):.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | ||
@echo "" | ||
@echo "Testing" | ||
@grep -E '^(test|unit-test|integration-test|show-coverage|migrate-test-database):.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | ||
@echo "" | ||
@echo "Code review " | ||
@grep -E '^(review|fix-style):.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | ||
@echo "" |
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
Oops, something went wrong.