You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
129 lines
4.0 KiB
129 lines
4.0 KiB
8 years ago
|
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
|