Skip to content

Commit

Permalink
Backporting from 8.x branch.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexSkrypnyk authored Jan 15, 2018
1 parent 5fd9113 commit 45bea60
Show file tree
Hide file tree
Showing 17 changed files with 10,517 additions and 69 deletions.
39 changes: 28 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ aliases:
- &data_dir data
- &data_root /home/circleci/project/data
- &artifacts_root /tmp/artifacts
- &selenium_bin /home/circleci/project/code/selenium-server.jar
- &server local.mysiteurl
- &web_url http://local.mysiteurl
- &deps_cache_key v1-dependencies-{{ checksum "composer.json" }}-{{ epoch }}
Expand All @@ -30,7 +29,6 @@ aliases:
WEB_URL: *web_url
ARTIFACTS_ROOT: *artifacts_root
DRUSH: vendor/bin/drush
SELENIUM_BIN: *selenium_bin
MYSQL_USER: ubuntu
MYSQL_PASSWORD: ubuntu
MYSQL_DATABASE: circle_test
Expand Down Expand Up @@ -79,7 +77,6 @@ aliases:
run:
name: Install additional debug binaries
command: |
sudo apt-get update
sudo apt-get -y install vim mysql-client libpng-dev
- &step_bootstrap_drupal
Expand Down Expand Up @@ -111,12 +108,15 @@ jobs:
- restore_cache:
keys:
- *deps_cache_key_any
- run:
name: Validate composer configuration
command: composer validate --strict
- run:
name: Install global dependencies
command: composer global require hirak/prestissimo
- run:
name: Install dependencies
command: composer install -n --prefer-dist
- run:
name: Download Selenium
command: curl -s -k -L http://selenium-release.storage.googleapis.com/3.5/selenium-server-standalone-3.5.3.jar -o $SELENIUM_BIN
- save_cache:
paths:
- $HOME/.composer/cache
Expand Down Expand Up @@ -179,6 +179,19 @@ jobs:
paths:
- *data_dir

# Install site from configuration.
# [META] Test that the website can be installed from the configuration.
test_site_install:
<<: *container_config
steps:
- *step_attach_workspace
- *step_common
- *step_system_binaries
- *step_php_extensions
- *step_symlink_data
- run: composer site-install
- *step_bootstrap_drupal

# Run tests in parallel.
test_behat:
<<: *container_config
Expand Down Expand Up @@ -214,21 +227,23 @@ jobs:
</Directory>
</VirtualHost>" > 000-default.conf
sudo mv -f 000-default.conf /etc/apache2/sites-available/000-default.conf
echo "ServerName $SERVER" | sudo tee /etc/apache2/conf-available/servername.conf
sudo a2enconf servername
sudo a2enmod rewrite && sudo a2enmod proxy_http && sudo service apache2 restart
echo "<?php phpinfo();" > $WEB_ROOT/info.php && curl -k -s -o info.html $WEB_URL/info.php && cat info.html | grep -aqoi "Build Date" && cat info.html && rm $WEB_ROOT/info.php && rm info.html;
- run:
name: Start Selenium
command: java -jar $SELENIUM_BIN -log $ARTIFACTS_ROOT/selenium.log
name: Start Chrome in the background
command: google-chrome-stable --disable-gpu --headless --remote-debugging-address=0.0.0.0 --remote-debugging-port=9222
background: true
- run:
name: Run Behat tests
# Runs tests in parallel if there are more than 1 parallel node
# running (set in 'parallelism' property above).
command: |
if [ "$CIRCLE_NODE_TOTAL" -gt "1" ] ; then
composer test -- --tags=p$CIRCLE_NODE_INDEX
composer test -- --tags=p$CIRCLE_NODE_INDEX || composer test -- --tags=p$CIRCLE_NODE_INDEX --rerun
else
composer test
composer test || composer test -- --rerun
fi
- store_artifacts:
path: *artifacts_root
Expand Down Expand Up @@ -281,7 +296,9 @@ workflows:
requires:
- code_dependencies
- download_db
- code_style
- test_site_install:
requires:
- code_dependencies
- test_behat:
requires:
- build
Expand Down
11 changes: 6 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ docroot/sites/all/modules/*
!docroot/sites/all/themes/
docroot/sites/all/themes/*
!docroot/sites/all/themes/custom/
!docroot/profiles/
docroot/profiles/*
!docroot/profiles/mysite_profile/
docroot/sites/default/*
!docroot/sites/default/settings.php
!docroot/sites/default/default.settings.local.php
Expand All @@ -28,8 +31,6 @@ Vagrantfile
vendor
node_modules

# Ignore dependencies locking.
# Remove these lines if exact dependencies are required (usually after setting
# up the baseline of the project).
composer.lock
package-lock.json
# Compiled assets.
docroot/sites/all/themes/**/build
screenshots
2 changes: 2 additions & 0 deletions .gitignore.artefact
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ Vagrantfile
composer.lock
package-lock.json
.circleci/config.yml
.sass-cache
*.css.map
3 changes: 2 additions & 1 deletion .sass-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ files:
- 'docroot/sites/all/themes/custom/**/*.scss'
- 'docroot/sites/all/modules/custom/**/*.scss'
ignore:
- 'docroot/sites/all/themes/custom/**/_overrides.scss'
- 'docroot/sites/all/themes/custom/**/fonts/**/*.scss'
- 'docroot/sites/all/themes/custom/**/build/.*'
# Rule Configuration
rules:
indentation:
Expand Down
73 changes: 64 additions & 9 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,34 @@

/* global module */
var themePath = 'docroot/sites/all/themes/custom/mysitetheme/';
var libraryPath = 'docroot/sites/all/libraries/';
module.exports = function (grunt) {
'use strict';
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
eslint: {
src: [
'docroot/profiles/mysite_profile/**/*.js',
'!docroot/profiles/mysite_profile/**/*.min.js',
'docroot/sites/all/modules/custom/**/*.js',
'!docroot/sites/all/modules/custom/**/*.min.js',
'docroot/sites/all/themes/custom/**/*.js',
'!docroot/sites/all/themes/custom/**/*.min.js'
],
options: {
config: '.eslintrc.json',
format: 'codeframe'
}
},
sasslint: {
options: {
configFile: '.sass-lint.yml',
formatter: 'codeframe'
},
target: [
'docroot/themes/custom/**/*.scss',
'docroot/modules/custom/**/*.scss'
]
},
sass_globbing: {
dev: {
files: {
Expand All @@ -31,12 +54,10 @@ module.exports = function (grunt) {
},
dist: {
src: [
// Uncomment below to include libraries.
// libraryPath + 'bootstrap/assets/javascripts/bootstrap.js',
themePath + 'js/**/*.js',
'!' + themePath + 'js/mysitetheme.min.js'
],
dest: themePath + 'js/mysitetheme.min.js'
dest: themePath + 'build/js/mysitetheme.min.js'
}
},
uglify: {
Expand All @@ -50,14 +71,14 @@ module.exports = function (grunt) {
}
},
files: {
[themePath + 'js/mysitetheme.min.js']: [themePath + 'js/mysitetheme.min.js']
[themePath + 'build/js/mysitetheme.min.js']: [themePath + 'js/mysitetheme.min.js']
}
}
},
sass: {
dev: {
files: {
[themePath + 'css/mysitetheme.min.css']: themePath + 'scss/style.scss'
[themePath + 'build/css/mysitetheme.min.css']: themePath + 'scss/style.scss'
},
options: {
sourceMap: true,
Expand All @@ -74,6 +95,35 @@ module.exports = function (grunt) {
}
}
},
postcss: {
options: {
processors: [
require('autoprefixer')({browsers: ['last 2 versions', 'not ie <= 8', 'iOS >= 7']})
]
},
dev: {
map: true,
src: themePath + 'build/css/mysitetheme.min.css'
},
prod: {
map: false,
src: themePath + 'build/css/mysitetheme.min.css'
}
},
copy: {
images: {
expand: true,
cwd: themePath + 'images/',
src: '**',
dest: themePath + 'build/images'
},
fonts: {
expand: true,
cwd: themePath + 'fonts/',
src: '**',
dest: themePath + 'build/fonts'
}
},
watch: {
scripts: {
files: [themePath + 'js/**/*.js'],
Expand All @@ -84,7 +134,7 @@ module.exports = function (grunt) {
},
styles: {
files: [themePath + 'scss/**/*.scss'],
tasks: ['sass_globbing', 'sass:dev'],
tasks: ['sass_globbing', 'sass:dev', 'postcss:dev'],
options: {
livereload: true,
spawn: false
Expand All @@ -93,14 +143,19 @@ module.exports = function (grunt) {
}
});

grunt.loadNpmTasks('grunt-postcss');
grunt.loadNpmTasks('grunt-sass-globbing');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('gruntify-eslint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-sass-lint');
grunt.loadNpmTasks('grunt-exec');

grunt.registerTask('prod', ['sass_globbing', 'concat', 'uglify:prod', 'sass:prod']);
grunt.registerTask('lint', ['eslint', 'sasslint']);
grunt.registerTask('prod', ['lint', 'sass_globbing', 'concat', 'uglify:prod', 'sass:prod', 'postcss:prod', 'copy']);
// By default, run grunt with dev settings.
grunt.registerTask('default', ['sass_globbing', 'concat', 'sass:dev']);
grunt.registerTask('default', ['lint', 'sass_globbing', 'concat', 'sass:dev', 'postcss:dev', 'copy']);
};
10 changes: 6 additions & 4 deletions behat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@ default:
- IntegratedExperts\BehatScreenshotExtension\Context\ScreenshotContext

extensions:
DMore\ChromeExtension\Behat\ServiceContainer\ChromeExtension: ~
Behat\MinkExtension:
goutte: ~
base_url: http://local.mysiteurl
browser_name: chrome
selenium2:
wd_host: "http://localhost:4444/wd/hub"
capabilities: { "browser": "chrome", "version": "*" }
javascript_session: selenium2
sessions:
default:
chrome:
api_url: "http://local.mysiteurl:9222"
javascript_session: default
# Provides integration with Drupal APIs.
Drupal\DrupalExtension:
blackbox: ~
Expand Down
Loading

0 comments on commit 45bea60

Please sign in to comment.