Created
July 7, 2017 21:28
-
-
Save rachellawson/75dcb9d1c6cf706b6d9909740def7668 to your computer and use it in GitHub Desktop.
CircleCI for Drupal 8 and Behat
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
version: 2 | |
jobs: | |
build: | |
docker: | |
- image: circleci/php:7.1-apache-browsers | |
working_directory: ~/working | |
steps: | |
- checkout | |
- run: | |
name: Add PHP module prerequisites | |
command: | | |
sudo apt-get update -y | |
sudo apt-get install -y libpng-dev | |
sudo docker-php-ext-install gd | |
- run: | |
name: Start Xvfb | |
command: | | |
sudo Xvfb :7055 | |
export DISPLAY=:7055 | |
background: true | |
- run: | |
name: Start Selenium | |
command: | | |
sudo apt-get install -y default-jre | |
wget http://selenium-release.storage.googleapis.com/2.53/selenium-server-standalone-2.53.1.jar -O selenium-server.jar | |
java -jar selenium-server.jar | |
background: true | |
- run: | |
name: PhantomJS install | |
command: | | |
sudo curl --output /usr/local/bin/phantomjs https://s3.amazonaws.com/circle-downloads/phantomjs-2.1.1 | |
- run: | |
name: Configure & Start Apache | |
command: | | |
sudo cp ~/working/.circleci/sia.conf /etc/apache2/sites-available/sia.conf | |
sudo a2ensite sia | |
sudo service apache2 start | |
- run: | |
name: Install composer and then project | |
command: | | |
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" | |
php -r "if (hash_file('SHA384', 'composer-setup.php') === trim(file_get_contents('https://composer.github.io/installer.sig'))) { echo 'Installer verified'; } else { echo 'Installer invalid'; unlink('composer-setup.php'); } echo PHP_EOL;" | |
php composer-setup.php | |
php -r "unlink('composer-setup.php');" | |
php composer.phar self-update | |
php composer.phar install -n --prefer-dist | |
- run: | |
name: Site Install | |
command: | | |
cd ~/working/web | |
../vendor/bin/drush site-install config_installer --yes --db-url=sqlite://sites/default/files/.circleci.sqlite config_installer_sync _configure_form.sync_directory=../config/sync | |
sudo chmod go+w ~/working/web/sites/default/files/.circleci.sqlite | |
- run: | |
name: Test | |
command: | | |
cd ~/working/tests | |
mkdir ~/working/test-reports | |
mkdir ~/working/test-reports/cucumber | |
./behat --no-snippets -f pretty -o std -f junit -o ~/working/test-reports/cucumber/junit.xml | |
- store_artifacts: | |
path: web/sites/default/files/screenshots | |
prefix: screenshots | |
- store_test_results: | |
path: test-reports |
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
<VirtualHost *:80> | |
DocumentRoot "/home/circleci/working/web" | |
ServerName sia.dev | |
<Directory /home/circleci/working/web > | |
Options FollowSymLinks | |
AllowOverride All | |
Require all granted | |
</Directory> | |
</VirtualHost> |
Since around beginning of Feb 2018 you have to update /etc/hosts
manually to have Behat resolve the URL:
- run:
name: Update host file
command: |
echo 127.0.0.1 example.localhost | sudo tee -a /etc/hosts
cat /etc/hosts
Otherwise you'll get cURL error 6: Could not resolve host: example.localhost
.
Source: https://discuss.circleci.com/t/apache-conf-could-not-resolve-host/19994
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Rachel - thanks for this! Saved me a lot of time tonight. :)
A couple of notes:
apt install -y sqlite3
anywhere before that step.And save it right after composer install, with:
You could probably even get clever and cache an sqlite database of a fresh "minimal" install, and use drush cim instead of si.
Anyway thank you!