From f0a877df64ac282cd6ff8a1aaac2e2ef48865fbe Mon Sep 17 00:00:00 2001 From: Janette Day Date: Tue, 5 Jun 2018 14:55:44 -0500 Subject: [PATCH 1/3] Pull in missing script changes --- .ahoy/.scripts/dkan-test.rb | 6 +- .ahoy/dkan.ahoy.yml | 2 +- .circleci/config.yml | 279 ++++++++++++++++++++++++++---------- 3 files changed, 210 insertions(+), 77 deletions(-) diff --git a/.ahoy/.scripts/dkan-test.rb b/.ahoy/.scripts/dkan-test.rb index 7d16aaee75..c2e7727472 100644 --- a/.ahoy/.scripts/dkan-test.rb +++ b/.ahoy/.scripts/dkan-test.rb @@ -5,9 +5,9 @@ require "base64" require "./dkan/.ahoy/.scripts/behat-parse-params" -BEHAT_FOLDER = ENV.has_key?("BEHAT_FOLDER") ? ENV["BEHAT_FOLDER"] : "docroot/profiles/dkan/test" -ALT_CONFIG_FILE = ENV.has_key?("ALT_CONFIG_FILE") ? ENV["ALT_CONFIG_FILE"] : "behat.local.yml" -BEHAT_ENV = ENV['HOSTNAME'] +BEHAT_FOLDER = ENV.has_key?("BEHAT_FOLDER") && ENV["BEHAT_FOLDER"] != "" ? ENV["BEHAT_FOLDER"] : "docroot/profiles/dkan/test" +ALT_CONFIG_FILE = ENV.has_key?("ALT_CONFIG_FILE") && ENV["ALT_CONFIG_FILE"] != "" ? ENV["ALT_CONFIG_FILE"] : "behat.local.yml" +BEHAT_ENV = ENV.has_key?("HOSTNAME") && ENV["HOSTNAME"] != "" ? ENV["HOSTNAME"] : "cli" SKIP_COMPOSER_FLAG="--skip-composer" if File.exists? "#{BEHAT_FOLDER}/#{ALT_CONFIG_FILE}" diff --git a/.ahoy/dkan.ahoy.yml b/.ahoy/dkan.ahoy.yml index f491cc8160..c324a2cb7e 100644 --- a/.ahoy/dkan.ahoy.yml +++ b/.ahoy/dkan.ahoy.yml @@ -151,7 +151,7 @@ commands: fi b64=`echo "payload: $input" | base64 $wrap 0` - ahoy cmd-proxy ruby dkan/.ahoy/.scripts/dkan-test.rb "$b64" + ahoy cmd-proxy BEHAT_FOLDER=$BEHAT_FOLDER ALT_CONFIG_FILE="ALT_CONFIG_FILE" ruby dkan/.ahoy/.scripts/dkan-test.rb "$b64" unittests: usage: Run phpunit tests diff --git a/.circleci/config.yml b/.circleci/config.yml index 28dd7c31f5..3daa8d5280 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,122 +1,229 @@ version: 2 +## Customize the test machine + jobs: build: + working_directory: ~/site_build + environment: + TZ: "/usr/share/zoneinfo/America/New_York" parallelism: 5 docker: - - image: ubuntu:16.04 - working_directory: /go/src/github.com/dkan - environment: - TEST_RESULTS: /tmp/test-results - AHOY_CMD_PROXY: DOCKER - MYSQL_ROOT_PASSWORD: "" - MYSQL_USER: drupal - MYSQL_PASSWORD: 123 - MYSQL_DATABASE: drupal - DATABASE_URL: "mysql://drupal:123@127.0.0.1:3306/drupal" + - image: circleci/php:5.6.35-apache-node-browsers + environment: + MYSQL_HOST: "127.0.0.1" + DATABASE_URL: "mysql://drupal:123@127.0.0.1:3306/drupal" + - image: circleci/mysql:5.5.58-ram + command: --secure-file-priv='' --max-allowed-packet=128M --innodb-buffer-pool-size=256M + environment: + - MYSQL_ROOT_PASSWORD= + - MYSQL_USER=drupal + - MYSQL_PASSWORD=123 + - MYSQL_DATABASE=drupal + # Selenium image won't start, running via npm install + #- image: selenium/standalone-chrome-debug:2.53.1 steps: - - checkout - - setup_remote_docker + - restore_cache: + keys: + - v1-dkan-{{ .Branch }} + - v1-dkan-test-vendor - run: - name: Updates etc + name: Install Selenium command: | - apt-get update - apt-get upgrade -y - apt-get install curl wget ruby php php-mbstring php-curl php-dom -y + sudo npm install selenium-standalone@latest -g + #npm install geckodriver + sudo selenium-standalone install - run: - name: Install Docker client + name: Run Selenium command: | - set -x - VER="17.03.0-ce" - curl -L -o /tmp/docker-$VER.tgz https://get.docker.com/builds/Linux/x86_64/docker-$VER.tgz - tar -xz -C /tmp -f /tmp/docker-$VER.tgz - mv /tmp/docker/* /usr/bin + sudo selenium-standalone start + background: true - run: - name: Install Docker Compose - command: | - set -x - curl -L https://github.com/docker/compose/releases/download/1.11.2/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose - chmod +x /usr/local/bin/docker-compose + name: Update Packages + command: sudo apt-get update - run: - name: Install Ahoy + name: Install Packages command: | - wget -q https://github.com/devinci-code/ahoy/releases/download/1.1.0/ahoy-`uname -s`-amd64 -O /usr/local/bin/ahoy && - chmod +x /usr/local/bin/ahoy + sudo apt-get install -y ruby libpng-dev libmcrypt-dev mysql-client x11vnc + sudo gem install git +#Available Extensions: +#bcmath bz2 calendar ctype curl dba dom enchant exif fileinfo filter ftp gd gettext gmp hash iconv imap interbase intl json ldap mbstring mcrypt mssql mysql mysqli oci8 odbc opcache pcntl pdo pdo_dblib pdo_firebird pdo_mysql pdo_oci pdo_odbc pdo_pgsql pdo_sqlite pgsql phar posix pspell readline recode reflection session shmop simplexml snmp soap sockets spl standard sybase_ct sysvmsg sysvsem sysvshm tidy tokenizer wddx xml xmlreader xmlrpc xmlwriter xsl zip - run: - name: Install CircleCI CLI - command: | - curl -o /usr/local/bin/circleci https://circle-downloads.s3.amazonaws.com/releases/build_agent_wrapper/circleci && chmod +x /usr/local/bin/circleci + name: Install PHP Extensions + command: sudo docker-php-ext-install gd json mcrypt mysql mysqli opcache pdo pdo_mysql zip - run: name: Install Composer command: | - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer + curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer composer global require hirak/prestissimo echo 'export PATH=~/.composer/vendor/bin:$PATH' >> $BASH_ENV - run: - name: Install Drush + name: Edit MySQL Configuration command: | - composer global require consolidation/cgr - cgr drush/drush - drush --version + mysql -uroot -e "grant FILE on *.* to 'drupal'@'%'" + sudo chmod 777 /etc/mysql/my.cnf + sudo echo -e "[client]\nloose-local-infile" >> /etc/mysql/my.cnf + sudo chmod 644 /etc/mysql/my.cnf - run: - name: Setup DKAN + name: Adjust PHP Settings command: | - bash dkan-init.sh dkan --deps - - restore_cache: - keys: - - v1-dkan-test-vendor - - run: - name: Start containers - command: | - cp dkan/.ahoy/docker-compose.common.yml docker-compose.yml - cp dkan/.ahoy/mysql.env mysql.env - ahoy docker up - rm -rf dkan/.ahoy/.docker - docker cp .ahoy.yml $(docker-compose ps -q cli):/var/www - mkdir -p dkan/test/assets/junit - docker cp dkan $(docker-compose ps -q cli):/var/www - - run: - name: Install Drupal - command: | - ahoy dkan drupal-rebuild mysql://drupal:123@127.0.0.1:3306/drupal - docker cp $(docker-compose ps -q cli):/var/www/docroot docroot - mkdir backups - docker cp backups $(docker-compose ps -q cli):/var/www/backups + sudo chmod 777 /usr/local/etc/php/conf.d + echo "memory_limit = 512M" > /usr/local/etc/php/conf.d/memory.ini + echo "always_populate_raw_post_data = -1" > /usr/local/etc/php/conf.d/deprecated.ini + - checkout + - run: php -i - run: - name: Make DKAN - command: | - ahoy dkan remake + name: Setup Apache + command : | + sudo cp .circleci/tests/circle/circle.conf /etc/apache2/sites-available + sudo a2dissite 000-default + sudo a2ensite circle.conf + sudo a2enmod rewrite + sudo service apache2 restart + # Ahoy install in dkan-init.sh had problems detecting root user. - run: - name: Install DKAN + name: Install Ahoy command: | - ahoy dkan reinstall + sudo wget -q https://github.com/devinci-code/ahoy/releases/download/1.1.0/ahoy-`uname -s`-amd64 -O /usr/local/bin/ahoy && + sudo chmod +x /usr/local/bin/ahoy + ### Setup DKAN - run: - name: Enable modules + name: DKAN Initialization command: | + bash dkan-init.sh dkan --deps --build=$DATABASE_URL ahoy drush --yes en dkan_harvest dkan_harvest_datajson dkan_harvest_dashboard ahoy drush cc all - run: - name: Install Test Libs + name: Server Router Background Server Task + command: ahoy dkan server + background: true + - run: + name: X11 VNC Background Server Task + command: x11vnc -forever -nopw + background: true + + - run: + name: Enable dkan_harvest_test and reinstall command: | - ahoy cmd-proxy bash dkan/.ahoy/.scripts/composer-install.sh docroot/profiles/dkan/test - docker cp $(docker-compose ps -q cli):/var/www/dkan/test/vendor dkan/test/vendor + ahoy drush en --yes dkan_harvest_test + ahoy dkan reinstall --yes + - save_cache: + key: v1-dkan-{{ .Branch }} + paths: + - ~/.drush + - ~/.composer - save_cache: key: v1-dkan-test-vendor paths: - dkan/test/vendor + # Lint only on 1st parallel instance. Deploy: blocks until parallelism is done, so doing it this way. + - run: + name: Run Lint + command: | + if [ "$CIRCLE_NODE_INDEX" -eq "0" ]; then + ahoy dkan lint + fi - run: name: Run Parallel Behat Tests command: ruby dkan/.ahoy/.scripts/circle-behat.rb docroot/profiles/dkan/test/features + # Unit Tests only on 1st parallel instance. Deploy: blocks until parallelism is done, so doing it this way. + - run: + name: Run PHPUnit Tests + command: | + if [ "$CIRCLE_NODE_INDEX" -eq "0" ]; then + ahoy dkan unittests + fi + - store_artifacts: + path: ~/site_build/dkan/test/assets + build_php71: + working_directory: ~/site_build + environment: + TZ: "/usr/share/zoneinfo/America/New_York" + parallelism: 5 + docker: + - image: pythagory/dkan-web:7-latest + environment: + MYSQL_HOST: "127.0.0.1" + DATABASE_URL: "mysql://drupal:123@127.0.0.1:3306/drupal" + - image: circleci/mysql:5.5.58-ram + command: --secure-file-priv='' --max-allowed-packet=128M --innodb-buffer-pool-size=256M + environment: + - MYSQL_ROOT_PASSWORD= + - MYSQL_USER=drupal + - MYSQL_PASSWORD=123 + - MYSQL_DATABASE=drupal + # Selenium image won't start, running via npm install + #- image: selenium/standalone-chrome-debug:2.53.1 + steps: + - restore_cache: + keys: + - v1-dkan-{{ .Branch }} + - v1-dkan-test-vendor + # Selenium is already installed, run it + - run: + name: Run Selenium + command: | + sudo selenium-standalone start + background: true + - checkout + - run: php -i + - run: + name: Setup Apache + command : | + sudo cp .circleci/tests/circle/circle.conf /etc/apache2/sites-available + sudo a2dissite 000-default + sudo a2ensite circle.conf + sudo a2enmod rewrite + sudo service apache2 restart + # Ahoy install in dkan-init.sh had problems detecting root user. + - run: + name: Install Ahoy + command: | + sudo wget -q https://github.com/devinci-code/ahoy/releases/download/1.1.0/ahoy-`uname -s`-amd64 -O /usr/local/bin/ahoy && + sudo chmod +x /usr/local/bin/ahoy + ### Setup DKAN + - run: + name: DKAN Initialization + command: | + bash dkan-init.sh dkan --deps --build=$DATABASE_URL + ahoy drush --yes en dkan_harvest dkan_harvest_datajson dkan_harvest_dashboard + ahoy drush cc all + - run: + name: Server Router Background Server Task + command: ahoy dkan server + background: true + - run: + name: X11 VNC Background Server Task + command: x11vnc -forever -nopw + background: true + + - run: + name: Enable dkan_harvest_test and reinstall + command: | + ahoy drush en --yes dkan_harvest_test + ahoy dkan reinstall --yes + - save_cache: + key: v1-dkan-{{ .Branch }} + paths: + - ~/.drush + - ~/.composer - run: - name: Copy Assets to Base Image - when: on_fail + name: Edit MySQL Configuration command: | - docker cp $(docker-compose ps -q cli):/var/www/dkan/test/assets assets + mysql -uroot -e "grant FILE on *.* to 'drupal'@'%'" + - save_cache: + key: v1-dkan-test-vendor + paths: + - dkan/test/vendor + # Lint only on 1st parallel instance. Deploy: blocks until parallelism is done, so doing it this way. - run: name: Run Lint command: | if [ "$CIRCLE_NODE_INDEX" -eq "0" ]; then ahoy dkan lint fi + - run: + name: Run Parallel Behat Tests + command: ruby dkan/.ahoy/.scripts/circle-behat.rb docroot/profiles/dkan/test/features # Unit Tests only on 1st parallel instance. Deploy: blocks until parallelism is done, so doing it this way. - run: name: Run PHPUnit Tests @@ -125,5 +232,31 @@ jobs: ahoy dkan unittests fi - store_artifacts: - path: /go/src/github.com/dkan/assets + path: ~/site_build/dkan/test/assets + +#Workflow to only run PHP 7 build if branch name contains php7 +#TODO - filter to run PHP71 on releases +workflows: + version: 2 + build_php5: + jobs: + - build: + filters: + branches: + ignore: /.*php7.*/ + build_php5_php7: + jobs: + - build: + filters: + branches: + only: 7.x-1.x + - build_php71: + requires: + - build + build_php7: + jobs: + - build_php71: + filters: + branches: + only: /.*php7.*/ From 43ea8de6759b9331bb55533dc0181ee0c3af62e3 Mon Sep 17 00:00:00 2001 From: Janette Day Date: Tue, 5 Jun 2018 15:10:57 -0500 Subject: [PATCH 2/3] Update changelog, add circle.conf file --- .circleci/tests/circle/circle.conf | 13 +++++++++++++ CHANGELOG.txt | 16 ++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 .circleci/tests/circle/circle.conf diff --git a/.circleci/tests/circle/circle.conf b/.circleci/tests/circle/circle.conf new file mode 100644 index 0000000000..356c286f44 --- /dev/null +++ b/.circleci/tests/circle/circle.conf @@ -0,0 +1,13 @@ + + + UseCanonicalName Off + ServerName test.dev + DocumentRoot /home/circleci/site_build/docroot + + + Options FollowSymLinks + AllowOverride All + Require all granted + + + diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 2a04a9dd93..86eb711692 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,19 @@ +7.x-1.15.1 +---------- +- #2533 #2546 Updates docker-compose to use updated cli container +- #2542 Add theme setting to adjust hero region height +- #2531 Add table tags to allowed html +- #2527 Stop xdebug in web and cli containers for tests +- #2521 Add custom validation rules to the REST API node creation +- #2498 Fix the link to installation info on README.md +- #2463 Update circle setup to use local DEV containers +- #2485 Check the character length of harvested resource urls +- #2476 Update getExtension() and createResources() functions +- #2452 Fix front page link paths on logo and site name +- #2489 Create variable for map tile url +- #2492 Security update for file_resup module, upgrade to version 1.5 +- #2358 Fix datastore error reporting when UUID is missing + 7.x-1.15 ---------- - #2339 Adds a linkchecker to DKAN. From aa93b57dd247fb668990ba7cca64a528cc79d99d Mon Sep 17 00:00:00 2001 From: Janette Day Date: Tue, 5 Jun 2018 16:04:35 -0500 Subject: [PATCH 3/3] revert circleci/config.yml change --- .circleci/config.yml | 280 +++++++++++-------------------------------- 1 file changed, 73 insertions(+), 207 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3daa8d5280..ce17782fbd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,229 +1,122 @@ version: 2 -## Customize the test machine - jobs: build: - working_directory: ~/site_build - environment: - TZ: "/usr/share/zoneinfo/America/New_York" parallelism: 5 docker: - - image: circleci/php:5.6.35-apache-node-browsers - environment: - MYSQL_HOST: "127.0.0.1" - DATABASE_URL: "mysql://drupal:123@127.0.0.1:3306/drupal" - - image: circleci/mysql:5.5.58-ram - command: --secure-file-priv='' --max-allowed-packet=128M --innodb-buffer-pool-size=256M - environment: - - MYSQL_ROOT_PASSWORD= - - MYSQL_USER=drupal - - MYSQL_PASSWORD=123 - - MYSQL_DATABASE=drupal - # Selenium image won't start, running via npm install - #- image: selenium/standalone-chrome-debug:2.53.1 + - image: ubuntu:16.04 + working_directory: /go/src/github.com/dkan + environment: + TEST_RESULTS: /tmp/test-results + AHOY_CMD_PROXY: DOCKER + MYSQL_ROOT_PASSWORD: "" + MYSQL_USER: drupal + MYSQL_PASSWORD: 123 + MYSQL_DATABASE: drupal + DATABASE_URL: "mysql://drupal:123@127.0.0.1:3306/drupal" steps: - - restore_cache: - keys: - - v1-dkan-{{ .Branch }} - - v1-dkan-test-vendor - - run: - name: Install Selenium - command: | - sudo npm install selenium-standalone@latest -g - #npm install geckodriver - sudo selenium-standalone install - - run: - name: Run Selenium - command: | - sudo selenium-standalone start - background: true - - run: - name: Update Packages - command: sudo apt-get update - - run: - name: Install Packages - command: | - sudo apt-get install -y ruby libpng-dev libmcrypt-dev mysql-client x11vnc - sudo gem install git -#Available Extensions: -#bcmath bz2 calendar ctype curl dba dom enchant exif fileinfo filter ftp gd gettext gmp hash iconv imap interbase intl json ldap mbstring mcrypt mssql mysql mysqli oci8 odbc opcache pcntl pdo pdo_dblib pdo_firebird pdo_mysql pdo_oci pdo_odbc pdo_pgsql pdo_sqlite pgsql phar posix pspell readline recode reflection session shmop simplexml snmp soap sockets spl standard sybase_ct sysvmsg sysvsem sysvshm tidy tokenizer wddx xml xmlreader xmlrpc xmlwriter xsl zip - - run: - name: Install PHP Extensions - command: sudo docker-php-ext-install gd json mcrypt mysql mysqli opcache pdo pdo_mysql zip + - checkout + - setup_remote_docker - run: - name: Install Composer + name: Updates etc command: | - curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer - composer global require hirak/prestissimo - echo 'export PATH=~/.composer/vendor/bin:$PATH' >> $BASH_ENV + apt-get update + apt-get upgrade -y + apt-get install curl wget ruby php php-mbstring php-curl php-dom -y - run: - name: Edit MySQL Configuration + name: Install Docker client command: | - mysql -uroot -e "grant FILE on *.* to 'drupal'@'%'" - sudo chmod 777 /etc/mysql/my.cnf - sudo echo -e "[client]\nloose-local-infile" >> /etc/mysql/my.cnf - sudo chmod 644 /etc/mysql/my.cnf + set -x + VER="17.03.0-ce" + curl -L -o /tmp/docker-$VER.tgz https://get.docker.com/builds/Linux/x86_64/docker-$VER.tgz + tar -xz -C /tmp -f /tmp/docker-$VER.tgz + mv /tmp/docker/* /usr/bin - run: - name: Adjust PHP Settings + name: Install Docker Compose command: | - sudo chmod 777 /usr/local/etc/php/conf.d - echo "memory_limit = 512M" > /usr/local/etc/php/conf.d/memory.ini - echo "always_populate_raw_post_data = -1" > /usr/local/etc/php/conf.d/deprecated.ini - - checkout - - run: php -i - - run: - name: Setup Apache - command : | - sudo cp .circleci/tests/circle/circle.conf /etc/apache2/sites-available - sudo a2dissite 000-default - sudo a2ensite circle.conf - sudo a2enmod rewrite - sudo service apache2 restart - # Ahoy install in dkan-init.sh had problems detecting root user. + set -x + curl -L https://github.com/docker/compose/releases/download/1.11.2/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose + chmod +x /usr/local/bin/docker-compose - run: name: Install Ahoy command: | - sudo wget -q https://github.com/devinci-code/ahoy/releases/download/1.1.0/ahoy-`uname -s`-amd64 -O /usr/local/bin/ahoy && - sudo chmod +x /usr/local/bin/ahoy - ### Setup DKAN + wget -q https://github.com/devinci-code/ahoy/releases/download/1.1.0/ahoy-`uname -s`-amd64 -O /usr/local/bin/ahoy && + chmod +x /usr/local/bin/ahoy - run: - name: DKAN Initialization + name: Install CircleCI CLI command: | - bash dkan-init.sh dkan --deps --build=$DATABASE_URL - ahoy drush --yes en dkan_harvest dkan_harvest_datajson dkan_harvest_dashboard - ahoy drush cc all - - run: - name: Server Router Background Server Task - command: ahoy dkan server - background: true + curl -o /usr/local/bin/circleci https://circle-downloads.s3.amazonaws.com/releases/build_agent_wrapper/circleci && chmod +x /usr/local/bin/circleci - run: - name: X11 VNC Background Server Task - command: x11vnc -forever -nopw - background: true - - - run: - name: Enable dkan_harvest_test and reinstall + name: Install Composer command: | - ahoy drush en --yes dkan_harvest_test - ahoy dkan reinstall --yes - - save_cache: - key: v1-dkan-{{ .Branch }} - paths: - - ~/.drush - - ~/.composer - - save_cache: - key: v1-dkan-test-vendor - paths: - - dkan/test/vendor - # Lint only on 1st parallel instance. Deploy: blocks until parallelism is done, so doing it this way. + curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer + composer global require hirak/prestissimo + echo 'export PATH=~/.composer/vendor/bin:$PATH' >> $BASH_ENV - run: - name: Run Lint + name: Install Drush command: | - if [ "$CIRCLE_NODE_INDEX" -eq "0" ]; then - ahoy dkan lint - fi + composer global require consolidation/cgr + cgr drush/drush + drush --version - run: - name: Run Parallel Behat Tests - command: ruby dkan/.ahoy/.scripts/circle-behat.rb docroot/profiles/dkan/test/features - # Unit Tests only on 1st parallel instance. Deploy: blocks until parallelism is done, so doing it this way. - - run: - name: Run PHPUnit Tests + name: Setup DKAN command: | - if [ "$CIRCLE_NODE_INDEX" -eq "0" ]; then - ahoy dkan unittests - fi - - store_artifacts: - path: ~/site_build/dkan/test/assets - build_php71: - working_directory: ~/site_build - environment: - TZ: "/usr/share/zoneinfo/America/New_York" - parallelism: 5 - docker: - - image: pythagory/dkan-web:7-latest - environment: - MYSQL_HOST: "127.0.0.1" - DATABASE_URL: "mysql://drupal:123@127.0.0.1:3306/drupal" - - image: circleci/mysql:5.5.58-ram - command: --secure-file-priv='' --max-allowed-packet=128M --innodb-buffer-pool-size=256M - environment: - - MYSQL_ROOT_PASSWORD= - - MYSQL_USER=drupal - - MYSQL_PASSWORD=123 - - MYSQL_DATABASE=drupal - # Selenium image won't start, running via npm install - #- image: selenium/standalone-chrome-debug:2.53.1 - steps: + bash dkan-init.sh dkan --deps - restore_cache: keys: - - v1-dkan-{{ .Branch }} - v1-dkan-test-vendor - # Selenium is already installed, run it - run: - name: Run Selenium + name: Start containers command: | - sudo selenium-standalone start - background: true - - checkout - - run: php -i - - run: - name: Setup Apache - command : | - sudo cp .circleci/tests/circle/circle.conf /etc/apache2/sites-available - sudo a2dissite 000-default - sudo a2ensite circle.conf - sudo a2enmod rewrite - sudo service apache2 restart - # Ahoy install in dkan-init.sh had problems detecting root user. + cp dkan/.ahoy/docker-compose.common.yml docker-compose.yml + cp dkan/.ahoy/mysql.env mysql.env + ahoy docker up + rm -rf dkan/.ahoy/.docker + docker cp .ahoy.yml $(docker-compose ps -q cli):/var/www + mkdir -p dkan/test/assets/junit + docker cp dkan $(docker-compose ps -q cli):/var/www - run: - name: Install Ahoy + name: Install Drupal command: | - sudo wget -q https://github.com/devinci-code/ahoy/releases/download/1.1.0/ahoy-`uname -s`-amd64 -O /usr/local/bin/ahoy && - sudo chmod +x /usr/local/bin/ahoy - ### Setup DKAN + ahoy dkan drupal-rebuild mysql://drupal:123@127.0.0.1:3306/drupal + docker cp $(docker-compose ps -q cli):/var/www/docroot docroot + mkdir backups + docker cp backups $(docker-compose ps -q cli):/var/www/backups - run: - name: DKAN Initialization + name: Make DKAN command: | - bash dkan-init.sh dkan --deps --build=$DATABASE_URL - ahoy drush --yes en dkan_harvest dkan_harvest_datajson dkan_harvest_dashboard - ahoy drush cc all + ahoy dkan remake - run: - name: Server Router Background Server Task - command: ahoy dkan server - background: true - - run: - name: X11 VNC Background Server Task - command: x11vnc -forever -nopw - background: true - + name: Install DKAN + command: | + ahoy dkan reinstall - run: - name: Enable dkan_harvest_test and reinstall + name: Enable modules command: | - ahoy drush en --yes dkan_harvest_test - ahoy dkan reinstall --yes - - save_cache: - key: v1-dkan-{{ .Branch }} - paths: - - ~/.drush - - ~/.composer + ahoy drush --yes en dkan_harvest dkan_harvest_datajson dkan_harvest_dashboard + ahoy drush cc all - run: - name: Edit MySQL Configuration + name: Install Test Libs command: | - mysql -uroot -e "grant FILE on *.* to 'drupal'@'%'" + ahoy cmd-proxy bash dkan/.ahoy/.scripts/composer-install.sh docroot/profiles/dkan/test + docker cp $(docker-compose ps -q cli):/var/www/dkan/test/vendor dkan/test/vendor - save_cache: key: v1-dkan-test-vendor paths: - dkan/test/vendor - # Lint only on 1st parallel instance. Deploy: blocks until parallelism is done, so doing it this way. + - run: + name: Run Parallel Behat Tests + command: ruby dkan/.ahoy/.scripts/circle-behat.rb docroot/profiles/dkan/test/features + - run: + name: Copy Assets to Base Image + when: on_fail + command: | + docker cp $(docker-compose ps -q cli):/var/www/dkan/test/assets assets - run: name: Run Lint command: | if [ "$CIRCLE_NODE_INDEX" -eq "0" ]; then ahoy dkan lint fi - - run: - name: Run Parallel Behat Tests - command: ruby dkan/.ahoy/.scripts/circle-behat.rb docroot/profiles/dkan/test/features # Unit Tests only on 1st parallel instance. Deploy: blocks until parallelism is done, so doing it this way. - run: name: Run PHPUnit Tests @@ -232,31 +125,4 @@ jobs: ahoy dkan unittests fi - store_artifacts: - path: ~/site_build/dkan/test/assets - - -#Workflow to only run PHP 7 build if branch name contains php7 -#TODO - filter to run PHP71 on releases -workflows: - version: 2 - build_php5: - jobs: - - build: - filters: - branches: - ignore: /.*php7.*/ - build_php5_php7: - jobs: - - build: - filters: - branches: - only: 7.x-1.x - - build_php71: - requires: - - build - build_php7: - jobs: - - build_php71: - filters: - branches: - only: /.*php7.*/ + path: /go/src/github.com/dkan/assets