Skip to content

Commit

Permalink
Fix master build (#2574)
Browse files Browse the repository at this point in the history
* Fix master build

* Update travis.yml

* Fix coverage report
  • Loading branch information
Sebastian Florek committed Nov 14, 2017
1 parent c5d7d50 commit 8c0e5cc
Show file tree
Hide file tree
Showing 11 changed files with 690 additions and 93 deletions.
11 changes: 10 additions & 1 deletion .babelrc
Expand Up @@ -17,7 +17,16 @@
},
"development": {
"presets": [["env", {"targets": {"node": 8}, "useBuiltIns": true}]],
"plugins": ["istanbul"]
},
"test": {
"presets": ["env"],
"plugins": [
["istanbul", {
"exclude": [
"**/*_test.js"
]
}]
]
}
}
}
11 changes: 4 additions & 7 deletions .travis.yml
Expand Up @@ -28,10 +28,6 @@ cache:
- node_modules
- .tools

# Remove dependencies that are downloaded by postinstall.sh script.
before_cache:
- rm -rf node_modules/easyfont-roboto-mono node_modules/cljsjs-packages-externs

addons:
# Run tests that require a browser on SauceLabs CI provider. Learn more at: https://saucelabs.com
sauce_connect: true
Expand Down Expand Up @@ -60,11 +56,12 @@ script:
./build/minikube.sh;
./node_modules/.bin/gulp check:ci --heapsterServerHost "http://localhost:8082";
else
NODE_ENV=production ./node_modules/.bin/gulp check:code-quality;
NODE_ENV=test ./node_modules/.bin/gulp check:code-quality;
fi'

after_success:
- './node_modules/.bin/gulp coverage-upload:ci;
if [ ${BUILD_SUITE} = "integration-test" ]; then
- 'if [ ${BUILD_SUITE} = "integration-test" ]; then
./node_modules/.bin/gulp push-to-docker:ci;
else
./node_modules/.bin/gulp coverage-upload:ci;
fi'
2 changes: 1 addition & 1 deletion build/conf.js
Expand Up @@ -88,7 +88,7 @@ export default {
* Variables used to differentiate between production and development build.
*/
production: 'production',
development: 'development',
test: 'test',
},

/**
Expand Down
1 change: 1 addition & 0 deletions build/i18n.js
Expand Up @@ -64,6 +64,7 @@ gulp.task('generate-xtbs', [
'remove-unused-translations',
'remove-duplicated-translations',
'sort-translations',
'set-prod-node-env',
]);

let prevMsgs = {};
Expand Down
17 changes: 1 addition & 16 deletions build/karma.conf.js
Expand Up @@ -44,7 +44,6 @@ function getFileList() {
return wiredep(wiredepOptions).js.concat([
path.join(conf.paths.frontendTest, '**/*.json'),
path.join(conf.paths.frontendTest, '**/*.js'),
{pattern: path.join(conf.paths.frontendSrc, '**/*.js'), included: false},
path.join(conf.paths.frontendSrc, '**/*.html'),
]);
}
Expand All @@ -60,7 +59,7 @@ module.exports = function(config) {

files: getFileList(),

logLevel: 'WARN',
logLevel: 'INFO',

browserConsoleLogOptions: {terminal: true, level: ''},

Expand All @@ -84,18 +83,6 @@ module.exports = function(config) {

preprocessors: {}, // This field is filled with values later.

plugins: [
'karma-chrome-launcher',
'karma-closure',
'karma-jasmine',
'karma-jasmine-jquery',
'karma-coverage',
'karma-ng-html2js-preprocessor',
'karma-sourcemap-loader',
'karma-browserify',
'karma-sauce-launcher',
],

// karma-browserify plugin config.
browserify: {
// Add source maps to output bundles.
Expand Down Expand Up @@ -157,8 +144,6 @@ module.exports = function(config) {
// Convert all JS code written ES2017 with modules to ES5 bundles that browsers can digest.
configuration.preprocessors[path.join(conf.paths.frontendTest, '**/*.js')] =
['browserify', 'closure', 'closure-iit'];
configuration.preprocessors[path.join(conf.paths.frontendSrc, '**/*.js')] =
['browserify', 'closure'];
configuration.preprocessors[path.join(
conf.paths.nodeModules, 'google-closure-library/closure/goog/deps.js')] = ['closure-deps'];

Expand Down
18 changes: 1 addition & 17 deletions build/postinstall.sh
Expand Up @@ -14,25 +14,9 @@
# limitations under the License.

DIR=$(pwd)
cd ./node_modules

# Download old bower dependencies
if [ ! -d "easyfont-roboto-mono" ]; then
git clone https://github.com/easyfont/roboto-mono easyfont-roboto-mono
cd easyfont-roboto-mono
git checkout fa7971ea56f68bfdb2771f9cb560c99aca0164c1
cd ..
fi

if [ ! -d "cljsjs-packages-externs" ]; then
git clone https://github.com/cljsjs/packages cljsjs-packages-externs
cd cljsjs-packages-externs
git checkout 0c44b38658ad789a45d342bff4f13706276f293a
cd ..
fi

# Patch wiredep so we can use it to manage NPM dependencies instead of bower
cd wiredep
cd ./node_modules/wiredep
patch -N < ../../build/patch/wiredep/wiredep.patch
cd lib
patch -N < ../../../build/patch/wiredep/detect-dependencies.patch
Expand Down
45 changes: 22 additions & 23 deletions build/script.js
Expand Up @@ -34,14 +34,14 @@ const gulpClosureCompiler = closureCompiler.gulp();
* Tasks used to set node process env variables. They are used by our compile tasks. Based on them
* different preset configs defined in '.babelrc' are used.
*/
gulp.task('set-dev-node-env', () => {
return process.env.NODE_ENV = conf.build.development;
});

gulp.task('set-prod-node-env', () => {
return process.env.NODE_ENV = conf.build.production;
});

gulp.task('set-test-node-env', () => {
return process.env.NODE_ENV = conf.build.test;
});

/**
* Returns function creating a stream that compiles frontend JavaScript files into development
* bundle located in {conf.paths.serve} directory. This has to be done because currently browsers do
Expand Down Expand Up @@ -96,7 +96,7 @@ function createScriptsStream(throwError) {
*
* Throws an error in case of JS syntax errors.
*/
gulp.task('scripts', ['set-dev-node-env'], createScriptsStream(true));
gulp.task('scripts', createScriptsStream(true));

/**
* Compiles frontend JavaScript files into development bundle located in
Expand Down Expand Up @@ -250,27 +250,26 @@ function patchBuildInformation() {
* Compiles frontend JavaScript files into production bundle located in {conf.paths.prodTmp}
* directory. A separated bundle is created for each i18n locale.
*/
gulp.task(
'scripts:prod', ['angular-templates', 'generate-xtbs', 'set-prod-node-env'], function(doneFn) {
// add a compilation step to stream for each translation file
let streams = conf.translations.map((translation) => {
return createCompileTask(translation);
});
gulp.task('scripts:prod', ['angular-templates', 'generate-xtbs'], function(doneFn) {
// add a compilation step to stream for each translation file
let streams = conf.translations.map((translation) => {
return createCompileTask(translation);
});

// add a default compilation task (no localization)
streams = streams.concat(createCompileTask());
// add a default compilation task (no localization)
streams = streams.concat(createCompileTask());

// Handle unhandled rejections and fail immediately if any error occurs.
process.on('unhandledRejection', (reason) => {
if (reason.message.toLowerCase().includes('error')) {
doneFn(reason);
}
});
// Handle unhandled rejections and fail immediately if any error occurs.
process.on('unhandledRejection', (reason) => {
if (reason.message.toLowerCase().includes('error')) {
doneFn(reason);
}
});

// TODO (taimir) : do not run the tasks sequentially once
// gulp-closure-compiler can be run in parallel
async.series(streams, doneFn);
});
// TODO (taimir) : do not run the tasks sequentially once
// gulp-closure-compiler can be run in parallel
async.series(streams, doneFn);
});

/**
* Compiles each Angular HTML template file (path/foo.html) into three processed forms:
Expand Down
4 changes: 2 additions & 2 deletions build/test.js
Expand Up @@ -75,7 +75,7 @@ gulp.task('test', ['frontend-test', 'backend-test-with-coverage']);
/**
* Runs once all unit tests of the frontend application.
*/
gulp.task('frontend-test', function(doneFn) {
gulp.task('frontend-test', ['set-test-node-env'], function(doneFn) {
runFrontendUnitTests(true, doneFn);
});

Expand Down Expand Up @@ -115,7 +115,7 @@ gulp.task('test:watch', ['frontend-test:watch', 'backend-test:watch']);
* Runs frontend backend application tests. Watches for changes in the source files to rerun
* the tests.
*/
gulp.task('frontend-test:watch', function(doneFn) {
gulp.task('frontend-test:watch', ['set-test-node-env'], function(doneFn) {
runFrontendUnitTests(false, doneFn);
});

Expand Down

0 comments on commit 8c0e5cc

Please sign in to comment.