Skip to content

Commit

Permalink
updated debug settings (+56 squashed commits)
Browse files Browse the repository at this point in the history
Squashed commits:
[c42f30c] updated base image, added docs & local test script
[88f0c40] debug
[6220c94] fixed network isolation
[c63c7c3] test mssql only on test/mssql branch
[74efc78] fixed isolation in after_script
[02b895b] updated test setup
[3335f39] updated retry
[bd123b2] updated service checks
[45e4c90] updated build
[d54da7a] updated after_script
[5a4c726] 🏭 wait for mysql
[08db878] fixed typo
[ea53c1e] updated build stages
[9807ce3] fixed typos
[cf9f64e] fixed mssql testing
[08001d6] added db create for mssql
[62f6b65] run travis (gitlab simulation) only in travis branch
[cf63da4] streamlined build
[76808ac] updated test jobs
[18d79b5] fixed test error
[7b2bce6] updated build & composer.lock
[244623a] updated build
[86bd71b] fixed cleanup
[86ab2e8] fixed cleanup
[091d4b8] fixed tests
[2d315b5] fixed build config
[2913644] fixed project names
[f53b823] refactored build config
[5a791fb] refactored docker db-tests
[b4479b0] revert
[a975fa5] updated gitlab build
[4e4e5e4] updated mssql setup
[d6ff03b] added sleep workaround
[578b102] removed host volumes in test
[928f50b] fixed path
[967ab10] updated tests
[520f317] bootstrap cubrid
[5f245e1] 🏭 fixed cubrid tests
[940dbbc] 🏭 pinned cubrid version 9.3.6.0002
[8d5ea69] 📝 dockerized test commands
[9954b54] updated cubrid
[fb3afac] updated docs
[3f63ced] updated isolation
[bdc3c83] 🏭 build cubrid
[b777911] 🏭 disabled mssql, updated cubrid
[36534e7] added travis-a-like stage
[6546f02] updated GitLab build
[c046096] updated test setup
- added mssql and cubrid stack
[5a0e635] disabled host-volume
[75cf342] fixed test
[8de0794] fixed testing
[465d27a] added stages
[63aa950] added script
[68eecef] fixed typo
[00e4b88] updated Docker build
[f9072cc] added dockerized test setup
  • Loading branch information
schmunk42 committed Jan 19, 2017
1 parent 6d277dd commit f5ab85c
Show file tree
Hide file tree
Showing 14 changed files with 563 additions and 69 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
vendor
docs
128 changes: 128 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
before_script:
# run docker-compose commands from tests environment
- cd tests
# set stack isolation
- export ISOLATION=buildpipeline${CI_PIPELINE_ID}
- export COMPOSE_PROJECT_NAME=${ISOLATION}
- export TUPLE_C=$(expr ${CI_BUILD_ID} % 255)
- echo ${TUPLE_C}

after_script:
- export ISOLATION=buildpipeline${CI_PIPELINE_ID}
- docker ps -f name=${ISOLATION}

stages:
- build
- test
- cleanup

build:
stage: build
script:
- docker-compose build

test:
stage: test
script:
- docker-compose up -d
- docker-compose run --rm php vendor/bin/phpunit -v --exclude caching,db
- docker-compose down -v

test:caching:
stage: test
script:
- export COMPOSE_PROJECT_NAME=${ISOLATION}caching
- docker-compose up -d
# wait for mysql (retry 30 times)
- docker-compose run --rm php bash -c "while ! curl mysql:3306; do ((c++)) && ((c==30)) && break; sleep 2; done"
- docker-compose run --rm php vendor/bin/phpunit -v --group caching
- docker-compose down -v

test:db:
stage: test
script:
- export COMPOSE_PROJECT_NAME=${ISOLATION}db
- docker-compose up -d
- docker-compose run --rm php vendor/bin/phpunit -v --group db --exclude caching,mysql,pgsql,mssql,cubrid
- docker-compose down -v

test:db:mysql:
stage: test
script:
- export COMPOSE_PROJECT_NAME=${ISOLATION}mysql
- docker-compose up -d
# wait for db (retry X times)
- docker-compose run --rm php bash -c "while ! curl mysql:3306; do ((c++)) && ((c==30)) && break; sleep 2; done"
- docker-compose run --rm php vendor/bin/phpunit -v --group mysql
- docker-compose down -v

test:db:pgsql:
stage: test
script:
- export COMPOSE_PROJECT_NAME=${ISOLATION}pgsql
- docker-compose up -d
# wait for db (retry X times)
- docker-compose run --rm php bash -c 'while [ true ]; do curl postgres:5432; if [ $? == 52 ]; then break; fi; ((c++)) && ((c==25)) && break; sleep 2; done'
- docker-compose run --rm php vendor/bin/phpunit -v --group pgsql
- docker-compose down -v

test:db:mssql:
stage: test
only:
- test/mssql
script:
- cd mssql
- export COMPOSE_PROJECT_NAME=${ISOLATION}mssql
# TODO: retry/wait for db
- docker-compose up --build -d
# wait for db (retry X times)
- docker-compose run --rm php bash -c 'while [ true ]; do curl mssql:1433; if [ $? == 52 ]; then break; fi; ((c++)) && ((c==15)) && break; sleep 5; done'
- sleep 10
# Note: Password has to be the last parameter
- docker-compose run --rm sqlcmd sqlcmd -S mssql -U sa -Q "CREATE DATABASE yii2test" -P Mircosoft-12345
- docker-compose run --rm php vendor/bin/phpunit -v --group mssql
- docker-compose down -v

test:db:cubrid:
stage: test
script:
- cd cubrid
- export COMPOSE_PROJECT_NAME=${ISOLATION}cubrid
- docker-compose up --build -d
# wait for db (retry X times)
- docker-compose run --rm php bash -c 'while [ true ]; do curl cubrid:1523; if [ $? == 56 ]; then break; fi; ((c++)) && ((c==20)) && break; sleep 3; done'
- sleep 5
- docker-compose run --rm php /project/vendor/bin/phpunit -v --group cubrid
- docker-compose down -v

test:travis:
stage: test
only:
- travis
script:
- export COMPOSE_PROJECT_NAME=${ISOLATION}travis
- docker-compose up -d
# TODO: retry/wait for db
- sleep 10
- docker-compose run --rm php vendor/bin/phpunit -v --exclude mssql,cubrid,oci,wincache,xcache,zenddata,cubrid
- docker-compose down -v

cleanup:
stage: cleanup
when: always
script:
- docker-compose down -v
- export COMPOSE_PROJECT_NAME=${ISOLATION}caching
- docker-compose down -v
- export COMPOSE_PROJECT_NAME=${ISOLATION}db
- docker-compose down -v
- export COMPOSE_PROJECT_NAME=${ISOLATION}mysql
- docker-compose down -v
- export COMPOSE_PROJECT_NAME=${ISOLATION}pgsql
- docker-compose down -v
- export COMPOSE_PROJECT_NAME=${ISOLATION}mssql
- docker-compose down -v
- export COMPOSE_PROJECT_NAME=${ISOLATION}cubrid
- docker-compose down -v
- export COMPOSE_PROJECT_NAME=${ISOLATION}travis
- docker-compose down -v
45 changes: 45 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
FROM codemix/yii2-base:2.0-apache

# Install system packages for PHP extensions recommended for Yii 2.0 Framework
RUN apt-key update && \
apt-get update && \
apt-get -y install \
g++ \
git \
libicu-dev \
libmcrypt-dev \
libfreetype6-dev \
libjpeg-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng12-dev \
libpq5 \
libpq-dev \
zlib1g-dev \
mysql-client \
openssh-client \
libxml2-dev \
--no-install-recommends && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Install PHP extensions required for Yii 2.0 Framework
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include/ && \
docker-php-ext-configure bcmath && \
docker-php-ext-install \
gd \
intl \
pdo_mysql \
pdo_pgsql \
mbstring \
mcrypt \
zip \
bcmath \
soap


# Project source-code
WORKDIR /project
ADD composer.* /project/
RUN /usr/local/bin/composer install --prefer-dist
ADD ./ /project
32 changes: 32 additions & 0 deletions Dockerfile-cubrid
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM php:5-fpm

# /usr/local/lib/php/extensions/no-debug-non-zts-20131226/cubrid.so
RUN pecl install pdo_cubrid-9.3.0.0001
RUN echo "extension=pdo_cubrid.so" > /usr/local/etc/php/conf.d/cubrid.ini


# TODO: temporary section --->
# Install system packages for composer (git)
RUN apt-get update && \
apt-get -y install \
git \
--no-install-recommends && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Register the COMPOSER_HOME environment variable
ENV COMPOSER_HOME /composer
# Add global binary directory to PATH and make sure to re-export it
ENV PATH /usr/local/bin:$PATH
# Allow Composer to be run as root
ENV COMPOSER_ALLOW_SUPERUSER 1
# Install composer
RUN curl -sS https://getcomposer.org/installer | php -- \
--filename=composer.phar \
--install-dir=/usr/local/bin
# TODO: <--- end

# Project source-code
WORKDIR /project
ADD composer.* /project/
RUN /usr/local/bin/composer.phar install --prefer-dist
ADD ./ /project
52 changes: 52 additions & 0 deletions Dockerfile-mssql
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
FROM bylexus/apache-php7

# https://www.microsoft.com/en-us/sql-server/developer-get-started/php-ubuntu
RUN apt-get update
RUN apt-get install -y curl apt-transport-https

RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list

RUN apt-get update
RUN ACCEPT_EULA=Y apt-get install -y msodbcsql
RUN apt-get install -y unixodbc-dev-utf16

RUN apt-get install -y php-dev
RUN pecl install sqlsrv pdo_sqlsrv

RUN echo "extension=/usr/lib/php/20151012/sqlsrv.so" >> /etc/php/7.0/apache2/php.ini
RUN echo "extension=/usr/lib/php/20151012/pdo_sqlsrv.so" >> /etc/php/7.0/apache2/php.ini
RUN echo "extension=/usr/lib/php/20151012/sqlsrv.so" >> /etc/php/7.0/cli/php.ini
RUN echo "extension=/usr/lib/php/20151012/pdo_sqlsrv.so" >> /etc/php/7.0/cli/php.ini

# TODO: temporary section --->
# Install system packages for composer (git)
RUN apt-get update && \
apt-get -y install \
git \
--no-install-recommends && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Register the COMPOSER_HOME environment variable
ENV COMPOSER_HOME /composer
# Add global binary directory to PATH and make sure to re-export it
ENV PATH /usr/local/bin:$PATH
# Allow Composer to be run as root
ENV COMPOSER_ALLOW_SUPERUSER 1
# Install composer
RUN curl -sS https://getcomposer.org/installer | php -- \
--filename=composer.phar \
--install-dir=/usr/local/bin
# TODO: <--- end


# Project source-code
WORKDIR /project
ADD composer.* /project/
RUN /usr/local/bin/composer.phar install --prefer-dist
ADD ./ /project

# https://github.com/Microsoft/msphpsql/issues/161
RUN apt-get install -y locales \
&& echo "en_US.UTF-8 UTF-8" > /etc/locale.gen \
&& locale-gen
Loading

0 comments on commit f5ab85c

Please sign in to comment.