diff --git a/.travis.yml b/.travis.yml index c992d953..6c787a01 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,110 +32,110 @@ jobs: - composer test . - name: docker install: - - git clone https://github.com/femiwiki/database.git ~/swarm --depth=1 + - git clone https://github.com/femiwiki/database.git ~/swarm --depth=1 before_script: - - cp configs/env.example configs/env - - cp configs/secret.example.php configs/secret.php - - echo -en "\n\nwfRunDebugMode( 'localhost' );\n" >> configs/LocalSettings.php - - echo -en '\n\nrequire_once "$IP/includes/DevelopmentSettings.php";\n' >> configs/LocalSettings.php - - docker swarm init - # Setup database - - sudo mkdir -p /srv/mysql/ - - docker stack deploy -c ~/swarm/database.yml database - - | - printf 'Waiting for database_mysql service...'; - while [ -z $(docker service logs database_mysql 2>&1 | grep -oP 'GENERATED ROOT PASSWORD: \K.+') ]; do - sleep 1; - printf '.'; - done; printf '\n' - - HOST_IP=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+') - - MYSQL_USER=root - - "MYSQL_PW=$(docker service logs database_mysql 2>&1 | grep -Po 'GENERATED ROOT PASSWORD: \\K.+')" - - sed -ri "s/mysqlhostname/${HOST_IP}/" configs/env - - sed -ri "s/mysqlusername/${MYSQL_USER}/" configs/env - - sed -ri "s/mysqlpassword/${MYSQL_PW}/" configs/env - - sed -ri "s/DB_HOSTNAME/${HOST_IP}/" configs/secret.php - - sed -ri "s/DB_USERNAME/${MYSQL_USER}/" configs/secret.php - - sed -ri "s/DB_PASSWORD/${MYSQL_PW}/" configs/secret.php - # Setup memcached - - docker stack deploy -c ~/swarm/memcached.yml memcached - - sed -ri "s/MEMCACHED_HOSTNAME/${HOST_IP}/" configs/secret.php + - cp configs/env.example configs/env + - cp configs/secret.example.php configs/secret.php + - echo -en "\n\nwfRunDebugMode( 'localhost' );\n" >> configs/LocalSettings.php + - echo -en '\n\nrequire_once "$IP/includes/DevelopmentSettings.php";\n' >> configs/LocalSettings.php + - docker swarm init + # Setup database + - sudo mkdir -p /srv/mysql/ + - docker stack deploy -c ~/swarm/database.yml database + - | + printf 'Waiting for database_mysql service...'; + while [ -z $(docker service logs database_mysql 2>&1 | grep -oP 'GENERATED ROOT PASSWORD: \K.+') ]; do + sleep 1; + printf '.'; + done; printf '\n' + - HOST_IP=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+') + - MYSQL_USER=root + - "MYSQL_PW=$(docker service logs database_mysql 2>&1 | grep -Po 'GENERATED ROOT PASSWORD: \\K.+')" + - sed -ri "s/mysqlhostname/${HOST_IP}/" configs/env + - sed -ri "s/mysqlusername/${MYSQL_USER}/" configs/env + - sed -ri "s/mysqlpassword/${MYSQL_PW}/" configs/env + - sed -ri "s/DB_HOSTNAME/${HOST_IP}/" configs/secret.php + - sed -ri "s/DB_USERNAME/${MYSQL_USER}/" configs/secret.php + - sed -ri "s/DB_PASSWORD/${MYSQL_PW}/" configs/secret.php + # Setup memcached + - docker stack deploy -c ~/swarm/memcached.yml memcached + - sed -ri "s/MEMCACHED_HOSTNAME/${HOST_IP}/" configs/secret.php script: - - docker build --tag femiwiki/mediawiki . - - docker stack deploy -c docker-compose.yml mediawiki - - | - printf 'Waiting for mediawiki_parsoid container...'; - while [ -z $(docker container ls -qf 'name=mediawiki_parsoid') ]; do - sleep 1; - printf '.'; - done; printf '\n' - - docker service logs mediawiki_parsoid - - | - printf 'Waiting for mediawiki_fastcgi container...'; - while [ -z $(docker container ls -qf 'name=mediawiki_fastcgi') ]; do - sleep 1; - printf '.'; - done; printf '\n' - - sleep 10 - - docker service logs mediawiki_fastcgi - - test -z "$(docker service ps -qf "desired-state=Shutdown" mediawiki_fastcgi)" - - | - printf 'Waiting for http...' - until [ "$(curl -Lfs localhost)" ]; do - sleep 1; - printf '.'; - done; printf '\n' - - curl -Lf localhost | head - - docker exec $(docker container ls -qf name=mediawiki_fastcgi) - apt-get install -y git unzip - - docker exec $(docker container ls -qf name=mediawiki_fastcgi) - php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" - - docker exec $(docker container ls -qf name=mediawiki_fastcgi) - php composer-setup.php --install-dir=/usr/local/bin --filename=composer --quiet - - docker exec $(docker container ls -qf name=mediawiki_fastcgi) - composer install --prefer-source --quiet --no-interaction - - "docker exec $(docker container ls -qf name=mediawiki_fastcgi) - php tests/phpunit/phpunit.php --group '\ - Abusefilter,\ - AuthManager,\ - BetaFeatures,\ - Blocking,\ - CSSMin,\ - Cache,\ - CheckUser,\ - ComposerHooks,\ - DataBase,\ - Diff,\ - Gadgets,\ - GlobalFunctions,\ - HKDF,\ - Hash,\ - HashRing,\ - Http,\ - IP,\ - Installer,\ - Interwiki,\ - JobQueue,\ - Language,\ - Media,\ - MediaWikiTestCaseTest,\ - Output,\ - PageImages,\ - Pager,\ - RequestContext,\ - ResourceLoader,\ - Sanitizer,\ - Shell,\ - Site,\ - SpecialPage,\ - SpecialPageAliases,\ - SystemTest,\ - Templates,\ - Test,\ - TestsWithNoNeedForAwsCredentials,\ - Thanks,\ - Upload,\ - WebRequest,\ - db,\ - large,\ - '" + - docker build --tag femiwiki/mediawiki . + - docker stack deploy -c docker-compose.yml mediawiki + - | + printf 'Waiting for mediawiki_parsoid container...'; + while [ -z $(docker container ls -qf 'name=mediawiki_parsoid') ]; do + sleep 1; + printf '.'; + done; printf '\n' + - docker service logs mediawiki_parsoid + - | + printf 'Waiting for mediawiki_fastcgi container...'; + while [ -z $(docker container ls -qf 'name=mediawiki_fastcgi') ]; do + sleep 1; + printf '.'; + done; printf '\n' + - sleep 10 + - docker service logs mediawiki_fastcgi + - test -z "$(docker service ps -qf "desired-state=Shutdown" mediawiki_fastcgi)" + - | + printf 'Waiting for http...' + until [ "$(curl -Lfs localhost)" ]; do + sleep 1; + printf '.'; + done; printf '\n' + - curl -Lf localhost | head + - docker exec $(docker container ls -qf name=mediawiki_fastcgi) + apt-get install -y git unzip + - docker exec $(docker container ls -qf name=mediawiki_fastcgi) + php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" + - docker exec $(docker container ls -qf name=mediawiki_fastcgi) + php composer-setup.php --install-dir=/usr/local/bin --filename=composer --quiet + - docker exec $(docker container ls -qf name=mediawiki_fastcgi) + composer install --prefer-source --quiet --no-interaction + - "docker exec $(docker container ls -qf name=mediawiki_fastcgi) + php tests/phpunit/phpunit.php --group '\ + Abusefilter,\ + AuthManager,\ + BetaFeatures,\ + Blocking,\ + CSSMin,\ + Cache,\ + CheckUser,\ + ComposerHooks,\ + DataBase,\ + Diff,\ + Gadgets,\ + GlobalFunctions,\ + HKDF,\ + Hash,\ + HashRing,\ + Http,\ + IP,\ + Installer,\ + Interwiki,\ + JobQueue,\ + Language,\ + Media,\ + MediaWikiTestCaseTest,\ + Output,\ + PageImages,\ + Pager,\ + RequestContext,\ + ResourceLoader,\ + Sanitizer,\ + Shell,\ + Site,\ + SpecialPage,\ + SpecialPageAliases,\ + SystemTest,\ + Templates,\ + Test,\ + TestsWithNoNeedForAwsCredentials,\ + Thanks,\ + Upload,\ + WebRequest,\ + db,\ + large,\ + '"