-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13360 from schmunk42/feature/docker-testing
added dockerized test setup
- Loading branch information
Showing
28 changed files
with
643 additions
and
62 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,3 @@ | ||
.git | ||
vendor | ||
docs |
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 |
---|---|---|
|
@@ -41,3 +41,4 @@ phpunit.phar | |
|
||
# NPM packages | ||
/node_modules | ||
.env |
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,118 @@ | ||
before_script: | ||
# set stack isolation | ||
- export ISOLATION=buildpipeline${CI_PIPELINE_ID}${CI_BUILD_NAME} | ||
- export COMPOSE_PROJECT_NAME=${ISOLATION} | ||
- export TUPLE_C=$(expr ${CI_BUILD_ID} % 99) | ||
- echo ${TUPLE_C} | ||
# run docker-compose commands from tests environment | ||
- cd tests | ||
- cp .env-dist .env | ||
- docker-compose config | ||
|
||
after_script: | ||
- export ISOLATION=buildpipeline${CI_PIPELINE_ID}${CI_BUILD_NAME} | ||
- export COMPOSE_PROJECT_NAME=${ISOLATION} | ||
# run docker-compose commands from tests environment | ||
- cd tests | ||
- cp .env-dist .env | ||
- docker-compose down -v --remove-orphans | ||
- docker ps -f name=${ISOLATION} | ||
|
||
stages: | ||
- travis | ||
- test | ||
- cleanup | ||
|
||
test: | ||
stage: test | ||
script: | ||
- docker-compose up --build -d | ||
- docker-compose run --rm php vendor/bin/phpunit -v --exclude caching,db,data --log-junit tests/_junit/test.xml | ||
|
||
caching: | ||
stage: test | ||
only: | ||
- tests/caching | ||
- tests/full | ||
script: | ||
- export COMPOSE_FILE=docker-compose.yml:docker-compose.${CI_BUILD_NAME}.yml | ||
- docker-compose up --build -d | ||
- docker-compose run --rm php vendor/bin/phpunit -v --group caching --exclude db | ||
|
||
db: | ||
stage: test | ||
only: | ||
- tests/mysql | ||
- tests/full | ||
script: | ||
- docker-compose up --build -d | ||
- docker-compose run --rm php vendor/bin/phpunit -v --group db --exclude caching,mysql,pgsql,mssql,cubrid,oci | ||
|
||
|
||
mysql: | ||
stage: test | ||
only: | ||
- tests/mysql | ||
- tests/full | ||
script: | ||
- export COMPOSE_FILE=docker-compose.yml:docker-compose.${CI_BUILD_NAME}.yml | ||
- docker-compose up --build -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 | ||
|
||
|
||
pgsql: | ||
stage: test | ||
only: | ||
- tests/pgsql | ||
- tests/full | ||
script: | ||
- export COMPOSE_FILE=docker-compose.yml:docker-compose.${CI_BUILD_NAME}.yml | ||
- docker-compose up --build -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 | ||
|
||
|
||
cubrid: | ||
stage: test | ||
only: | ||
- tests/cubrid | ||
- tests/extra | ||
script: | ||
- cd 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 | ||
|
||
|
||
mssql: | ||
stage: test | ||
only: | ||
- tests/mssql | ||
- tests/extra | ||
script: | ||
- cd mssql | ||
- 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 3 | ||
# Note: Password has to be the last parameter | ||
- docker-compose run --rm sqlcmd sh -c 'sqlcmd -S mssql -U sa -Q "CREATE DATABASE yii2test" -P Microsoft-12345' | ||
- docker-compose run --rm php vendor/bin/phpunit -v --group mssql | ||
|
||
|
||
travis: | ||
stage: travis | ||
only: | ||
- travis | ||
script: | ||
- export COMPOSE_FILE=docker-compose.yml:docker-compose.mysql.yml:docker-compose.pgsql.yml | ||
- docker-compose up --build -d | ||
# wait for dbs ... | ||
- sleep 10 | ||
- docker-compose run --rm php vendor/bin/phpunit -v --exclude mssql,cubrid,oci,wincache,xcache,zenddata,cubrid | ||
|
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,8 @@ | ||
FROM dmstr/php-yii2:7.0-fpm-1.9-beta2-alpine-nginx | ||
|
||
# Project source-code | ||
WORKDIR /project | ||
ADD composer.* /project/ | ||
RUN /usr/local/bin/composer install --prefer-dist | ||
ADD ./ /project | ||
ENV PATH /project/vendor/bin:${PATH} |
Oops, something went wrong.