Fix flakiness with Gulp + Travis

Gulp was failing silently on Travis. I tracked this down to the task that
builds a custom, slimmed-down version of jQuery from source.

To fix this I’ve removed the task and replaced it with just `src`ing the
minified version of jQuery from `node_modules`.

Cons:
- A few more kb of JS

Pros:
- Less random, afternoon-chewing complexity
This commit is contained in:
Chris Hill-Scott
2016-01-12 13:37:50 +00:00
parent 84b885f9eb
commit 1b7658e09a
4 changed files with 17 additions and 27 deletions

View File

@@ -10,12 +10,14 @@ before_install:
- nvm install 5.0.0 - nvm install 5.0.0
install: install:
- npm install - npm install
- npm rebuild node-sass
- pip install -r requirements_for_test.txt - pip install -r requirements_for_test.txt
before_script: before_script:
- psql -c 'create database test_notifications_admin;' -U postgres - psql -c 'create database test_notifications_admin;' -U postgres
after_success: after_success:
- ./scripts/trigger-dependent-build.sh - ./scripts/trigger-dependent-build.sh
script: script:
- npm run build
- ./scripts/run_tests.sh - ./scripts/run_tests.sh
notifications: notifications:
slack: slack:

View File

@@ -33,13 +33,14 @@ n is a tool for managing different versions of node. The following installs n an
npm install -g n npm install -g n
n latest n latest
npm rebuild node-sass npm rebuild node-sass
Most of the frontend dependencies are managed using Git Submodules. Some are Most of the frontend dependencies are managed using Git Submodules. Some are
managed with NPM and Bower. To install or update *all the things*, run managed with NPM and Bower. To install or update *all the things*, run
```shell ```shell
git submodule init git submodule init
git submodule update git submodule update
npm install npm install
npm run build
``` ```
If you want the front end assets to re-compile on changes, leave this running If you want the front end assets to re-compile on changes, leave this running

View File

@@ -29,23 +29,8 @@ gulp.task('copy:govuk_template:assets', () => gulp.src('bower_components/govuk_t
.pipe(gulp.dest(paths.dist)) .pipe(gulp.dest(paths.dist))
); );
gulp.task('javascripts', () => gulp
// Concatenate and minify .src([
gulp.task('jquery', () => plugins.jquery.src({
release: 1,
flags: [
'-ajax', '-ajax/jsonp', '-ajax/load', '-ajax/parseJSON',
'-ajax/parseXML', '-ajax/script', '-ajax/var/nonce',
'-ajax/var/rquery', '-ajax/xhr', '-manipulation/_evalUrl',
'-deprecated', '-effects', '-effects/Tween',
'-effects/animatedSelector', '-effects/support', '-event-alias'
]
})
.pipe(gulp.dest(paths.dist + 'javascripts/'))
);
gulp.task('javascripts', ['jquery'], () => gulp.src([
paths.src + 'govuk_frontend_toolkit/javascripts/govuk/modules.js', paths.src + 'govuk_frontend_toolkit/javascripts/govuk/modules.js',
paths.src + 'javascripts/highlightTags.js', paths.src + 'javascripts/highlightTags.js',
paths.src + 'javascripts/dropdown.js', paths.src + 'javascripts/dropdown.js',
@@ -54,15 +39,16 @@ gulp.task('javascripts', ['jquery'], () => gulp.src([
.pipe(plugins.babel({ .pipe(plugins.babel({
presets: ['es2015'] presets: ['es2015']
})) }))
.pipe(plugins.addSrc.prepend(
paths.dist + 'javascripts/jquery.custom.js'
))
.pipe(plugins.uglify()) .pipe(plugins.uglify())
.pipe(plugins.addSrc.prepend(
'./node_modules/jquery/dist/jquery.min.js'
))
.pipe(plugins.concat('all.js')) .pipe(plugins.concat('all.js'))
.pipe(gulp.dest(paths.dist + 'javascripts/')) .pipe(gulp.dest(paths.dist + 'javascripts/'))
); );
gulp.task('sass', () => gulp.src(paths.src + '/stylesheets/main*.scss') gulp.task('sass', () => gulp
.src(paths.src + '/stylesheets/main*.scss')
.pipe(plugins.sass({outputStyle: 'compressed'})) .pipe(plugins.sass({outputStyle: 'compressed'}))
.pipe(gulp.dest(paths.dist + '/stylesheets')) .pipe(gulp.dest(paths.dist + '/stylesheets'))
); );
@@ -70,7 +56,8 @@ gulp.task('sass', () => gulp.src(paths.src + '/stylesheets/main*.scss')
// Copy images // Copy images
gulp.task('images', () => gulp.src(paths.src + 'images/**/*') gulp.task('images', () => gulp
.src(paths.src + 'images/**/*')
.pipe(gulp.dest(paths.dist + '/images')) .pipe(gulp.dest(paths.dist + '/images'))
); );

View File

@@ -7,9 +7,9 @@
}, },
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"postinstall": "./node_modules/bower/bin/bower install && npm run build", "postinstall": "./node_modules/bower/bin/bower install",
"build": "./node_modules/gulp/bin/gulp.js", "build": "gulp",
"watch": "./node_modules/gulp/bin/gulp.js watch" "watch": "gulp watch"
}, },
"repository": { "repository": {
"type": "git", "type": "git",