Execute test with docker compose #101
24
Makefile
24
Makefile
@ -28,14 +28,6 @@ static_code_analysis: check_format credo dialyzer ## run static code analysis
|
|||||||
test: ## run tests
|
test: ## run tests
|
||||||
@mix test --cover --trace --slowest 10
|
@mix test --cover --trace --slowest 10
|
||||||
|
|
||||||
.PHONY: compose_up
|
|
||||||
compose_up: ## start containers for this service
|
|
||||||
@$(COMPOSE) up -d
|
|
||||||
|
|
||||||
.PHONY: compose_watch
|
|
||||||
compose_watch: ## start containers for this service watching for updates in filesystem
|
|
||||||
@$(COMPOSE) up -w
|
|
||||||
|
|
||||||
.PHONY: compose_database_create
|
.PHONY: compose_database_create
|
||||||
compose_database_create:
|
compose_database_create:
|
||||||
@$(COMPOSE) run --rm --entrypoint mix app ecto.create
|
@$(COMPOSE) run --rm --entrypoint mix app ecto.create
|
||||||
@ -55,6 +47,22 @@ compose_ps: ## status of containers
|
|||||||
compose_remote: ## connect to remote node
|
compose_remote: ## connect to remote node
|
||||||
@$(COMPOSE) exec app ./priv/docker/service/docker-remote.sh
|
@$(COMPOSE) exec app ./priv/docker/service/docker-remote.sh
|
||||||
|
|
||||||
|
.PHONY: compose_test
|
||||||
|
compose_test: ## execute test on docker environment
|
||||||
|
@$(COMPOSE) --profile test run --rm test
|
||||||
|
|
||||||
|
.PHONY: compose_test_shell
|
||||||
|
compose_test_shell: ## enter test environment shell
|
||||||
|
@$(COMPOSE) --profile test run --rm --entrypoint bash test -c bash
|
||||||
|
|
||||||
|
.PHONY: compose_up
|
||||||
|
compose_up: ## start containers for this service
|
||||||
|
@$(COMPOSE) up -d
|
||||||
|
|
||||||
|
.PHONY: compose_watch
|
||||||
|
compose_watch: ## start containers for this service watching for updates in filesystem
|
||||||
|
@$(COMPOSE) up -w
|
||||||
|
|
||||||
.PHONY: help
|
.PHONY: help
|
||||||
help:
|
help:
|
||||||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
||||||
|
@ -19,6 +19,7 @@ services:
|
|||||||
context: .
|
context: .
|
||||||
args:
|
args:
|
||||||
BUILD_MIX_ENV: dev
|
BUILD_MIX_ENV: dev
|
||||||
|
pull_policy: never
|
||||||
hostname: &app_host ex_trainer
|
hostname: &app_host ex_trainer
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
@ -53,6 +54,39 @@ services:
|
|||||||
scale: 3
|
scale: 3
|
||||||
entrypoint: ./priv/docker/service/docker-entrypoint.sh
|
entrypoint: ./priv/docker/service/docker-entrypoint.sh
|
||||||
command: local-cookie
|
command: local-cookie
|
||||||
|
test:
|
||||||
|
image: 'joaodubas/ex_trainer:test'
|
||||||
|
build:
|
||||||
|
target: builder
|
||||||
|
context: .
|
||||||
|
args:
|
||||||
|
BUILD_MIX_ENV: test
|
||||||
|
pull_policy: never
|
||||||
|
profiles:
|
||||||
|
- test
|
||||||
|
hostname: ex_trainer_test
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
init: true
|
||||||
|
volumes:
|
||||||
|
- './mix.exs:/opt/app/mix.exs:ro'
|
||||||
|
- './mix.lock:/opt/app/mix.lock:ro'
|
||||||
|
- './students.csv:/opt/app/students.csv:ro'
|
||||||
|
- './config:/opt/app/config'
|
||||||
|
- './cover:/opt/app/cover'
|
||||||
|
- './lib:/opt/app/lib'
|
||||||
|
- './priv:/opt/app/priv'
|
||||||
|
- './report:/opt/app/report'
|
||||||
|
- './test:/opt/app/test'
|
||||||
|
environment:
|
||||||
|
POSTGRES_HOST: *db_host
|
||||||
|
POSTGRES_USER: *db_user
|
||||||
|
POSTGRES_PASS: *db_pass
|
||||||
|
POSTGRES_NAME: wabanex_test
|
||||||
|
working_dir: /opt/app
|
||||||
|
restart: never
|
||||||
|
entrypoint: mix test
|
||||||
|
command: --trace --cover --slowest 10
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
db_data: {}
|
db_data: {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user