diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d5aa9ca..f70e788 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,21 +4,39 @@ stages: - release variables: - CONTAINER_IMAGE: registry.ely.by/elyby/accounts + CONTAINER_IMAGE: "registry.ely.by/elyby/accounts" test:backend: - image: jonaskello/docker-and-compose:1.12.1-1.8.0 + image: docker:latest services: - - docker:1.12.1-dind + - mariadb:10.0 + - redis:3.0-alpine + variables: + # mariadb config + MYSQL_RANDOM_ROOT_PASSWORD: "true" + MYSQL_DATABASE: "ely_accounts_test" + MYSQL_USER: "ely_accounts_tester" + MYSQL_PASSWORD: "ely_accounts_tester_password" stage: test before_script: - docker login -u gitlab-ci -p $CI_BUILD_TOKEN registry.ely.by - echo "$SSH_PRIVATE_KEY" > id_rsa - - docker-compose -f tests/docker-compose.yml build --pull testphp - after_script: - - docker-compose -f tests/docker-compose.yml down -v script: - - docker-compose -f tests/docker-compose.yml run --rm testphp ./vendor/bin/codecept run -c tests + - export TEMP_DEV_IMAGE="${CONTAINER_IMAGE}:ci-${CI_BUILD_ID}" + - docker build --pull -f Dockerfile-dev -t $TEMP_DEV_IMAGE . + - > + docker run --rm + --add-host=mariadb:`getent hosts mariadb | awk '{ print $1 ; exit }'` + --add-host=redis:`getent hosts redis | awk '{ print $1 ; exit }'` + -e YII_DEBUG="true" + -e YII_ENV="test" + -e DB_HOST="mariadb" + -e DB_DATABASE="ely_accounts_test" + -e DB_USER="ely_accounts_tester" + -e DB_PASSWORD="ely_accounts_tester_password" + -e REDIS_HOST="redis" + $TEMP_DEV_IMAGE + php vendor/bin/codecept run -c tests test:frontend: image: node:5.12 diff --git a/Dockerfile-dev b/Dockerfile-dev index 133d64d..9d3ad4a 100644 --- a/Dockerfile-dev +++ b/Dockerfile-dev @@ -1,4 +1,4 @@ -FROM registry.ely.by/elyby/accounts-php:1.1.2-dev +FROM registry.ely.by/elyby/accounts-php:latest-dev # Вносим конфигурации для крона и воркеров COPY docker/cron/* /etc/cron.d/