Merge branch '28450-test-compiling-frontend-assets-for-production-in-ci' into 'master'
Resolve "Test compiling frontend assets for production in CI" Closes #28450 See merge request !9396
This commit is contained in:
commit
62829b6bd8
7 changed files with 94 additions and 6 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -51,3 +51,4 @@ eslint-report.html
|
|||
/builds/*
|
||||
/shared/*
|
||||
/.gitlab_workhorse_secret
|
||||
/webpack-report/
|
||||
|
|
|
@ -240,6 +240,25 @@ rake db:seed_fu:
|
|||
paths:
|
||||
- log/development.log
|
||||
|
||||
rake gitlab:assets:compile:
|
||||
stage: test
|
||||
<<: *dedicated-runner
|
||||
dependencies: []
|
||||
variables:
|
||||
NODE_ENV: "production"
|
||||
RAILS_ENV: "production"
|
||||
SETUP_DB: "false"
|
||||
USE_DB: "false"
|
||||
SKIP_STORAGE_VALIDATION: "true"
|
||||
WEBPACK_REPORT: "true"
|
||||
script:
|
||||
- bundle exec rake yarn:install gitlab:assets:compile
|
||||
artifacts:
|
||||
name: webpack-report
|
||||
expire_in: 31d
|
||||
paths:
|
||||
- webpack-report/
|
||||
|
||||
rake karma:
|
||||
cache:
|
||||
paths:
|
||||
|
@ -388,6 +407,7 @@ pages:
|
|||
dependencies:
|
||||
- coverage
|
||||
- rake karma
|
||||
- rake gitlab:assets:compile
|
||||
- lint:javascript:report
|
||||
script:
|
||||
- mv public/ .public/
|
||||
|
@ -395,6 +415,7 @@ pages:
|
|||
- mv coverage/ public/coverage-ruby/ || true
|
||||
- mv coverage-javascript/ public/coverage-javascript/ || true
|
||||
- mv eslint-report.html public/ || true
|
||||
- mv webpack-report/ public/webpack-report/ || true
|
||||
artifacts:
|
||||
paths:
|
||||
- public
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
title: test compiling production assets and generate webpack bundle report in CI
|
||||
merge_request: 9396
|
||||
author:
|
|
@ -320,3 +320,9 @@
|
|||
:why: https://github.com/shinnn/spdx-license-ids/blob/v1.2.2/LICENSE
|
||||
:versions: []
|
||||
:when: 2017-02-08 22:35:00.225232000 Z
|
||||
- - :approve
|
||||
- opener
|
||||
- :who: Mike Greiling
|
||||
:why: https://github.com/domenic/opener/blob/1.4.3/LICENSE.txt
|
||||
:versions: []
|
||||
:when: 2017-02-21 22:33:41.729629000 Z
|
||||
|
|
|
@ -5,12 +5,14 @@ var path = require('path');
|
|||
var webpack = require('webpack');
|
||||
var StatsPlugin = require('stats-webpack-plugin');
|
||||
var CompressionPlugin = require('compression-webpack-plugin');
|
||||
var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
||||
|
||||
var ROOT_PATH = path.resolve(__dirname, '..');
|
||||
var IS_PRODUCTION = process.env.NODE_ENV === 'production';
|
||||
var IS_DEV_SERVER = process.argv[1].indexOf('webpack-dev-server') !== -1;
|
||||
var DEV_SERVER_PORT = parseInt(process.env.DEV_SERVER_PORT, 10) || 3808;
|
||||
var DEV_SERVER_LIVERELOAD = process.env.DEV_SERVER_LIVERELOAD !== 'false';
|
||||
var WEBPACK_REPORT = process.env.WEBPACK_REPORT;
|
||||
|
||||
var config = {
|
||||
context: path.join(ROOT_PATH, 'app/assets/javascripts'),
|
||||
|
@ -120,4 +122,16 @@ if (IS_DEV_SERVER) {
|
|||
config.output.publicPath = '//localhost:' + DEV_SERVER_PORT + config.output.publicPath;
|
||||
}
|
||||
|
||||
if (WEBPACK_REPORT) {
|
||||
config.plugins.push(
|
||||
new BundleAnalyzerPlugin({
|
||||
analyzerMode: 'static',
|
||||
generateStatsFile: true,
|
||||
openAnalyzer: false,
|
||||
reportFilename: path.join(ROOT_PATH, 'webpack-report/index.html'),
|
||||
statsFilename: path.join(ROOT_PATH, 'webpack-report/stats.json'),
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = config;
|
||||
|
|
|
@ -32,7 +32,8 @@
|
|||
"underscore": "^1.8.3",
|
||||
"vue": "^2.0.3",
|
||||
"vue-resource": "^0.9.3",
|
||||
"webpack": "^2.2.1"
|
||||
"webpack": "^2.2.1",
|
||||
"webpack-bundle-analyzer": "^2.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-plugin-istanbul": "^4.0.0",
|
||||
|
|
51
yarn.lock
51
yarn.lock
|
@ -33,6 +33,10 @@ acorn@^3.0.4:
|
|||
version "3.3.0"
|
||||
resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a"
|
||||
|
||||
acorn@^4.0.11:
|
||||
version "4.0.11"
|
||||
resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.11.tgz#edcda3bd937e7556410d42ed5860f67399c794c0"
|
||||
|
||||
after@0.8.2:
|
||||
version "0.8.2"
|
||||
resolved "https://registry.yarnpkg.com/after/-/after-0.8.2.tgz#fedb394f9f0e02aa9768e702bda23b505fae7e1f"
|
||||
|
@ -1408,6 +1412,10 @@ dropzone@^4.2.0:
|
|||
version "4.2.0"
|
||||
resolved "https://registry.yarnpkg.com/dropzone/-/dropzone-4.2.0.tgz#fbe7acbb9918e0706489072ef663effeef8a79f3"
|
||||
|
||||
duplexer@^0.1.1:
|
||||
version "0.1.1"
|
||||
resolved "https://registry.yarnpkg.com/duplexer/-/duplexer-0.1.1.tgz#ace6ff808c1ce66b57d1ebf97977acb02334cfc1"
|
||||
|
||||
ecc-jsbn@~0.1.1:
|
||||
version "0.1.1"
|
||||
resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz#0fc73a9ed5f0d53c38193398523ef7e543777505"
|
||||
|
@ -1418,6 +1426,10 @@ ee-first@1.1.1:
|
|||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d"
|
||||
|
||||
ejs@^2.5.5:
|
||||
version "2.5.6"
|
||||
resolved "https://registry.yarnpkg.com/ejs/-/ejs-2.5.6.tgz#479636bfa3fe3b1debd52087f0acb204b4f19c88"
|
||||
|
||||
elliptic@^6.0.0:
|
||||
version "6.3.3"
|
||||
resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.3.3.tgz#5482d9646d54bcb89fd7d994fc9e2e9568876e3f"
|
||||
|
@ -1792,7 +1804,7 @@ expand-range@^1.8.1:
|
|||
dependencies:
|
||||
fill-range "^2.1.0"
|
||||
|
||||
express@^4.13.3:
|
||||
express@^4.13.3, express@^4.14.1:
|
||||
version "4.14.1"
|
||||
resolved "https://registry.yarnpkg.com/express/-/express-4.14.1.tgz#646c237f766f148c2120aff073817b9e4d7e0d33"
|
||||
dependencies:
|
||||
|
@ -1893,6 +1905,10 @@ fileset@^2.0.2:
|
|||
glob "^7.0.3"
|
||||
minimatch "^3.0.3"
|
||||
|
||||
filesize@^3.5.4:
|
||||
version "3.5.4"
|
||||
resolved "https://registry.yarnpkg.com/filesize/-/filesize-3.5.4.tgz#742fc7fb6aef4ee3878682600c22f840731e1fda"
|
||||
|
||||
fill-range@^2.1.0:
|
||||
version "2.2.3"
|
||||
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-2.2.3.tgz#50b77dfd7e469bc7492470963699fe7a8485a723"
|
||||
|
@ -2118,6 +2134,12 @@ graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9:
|
|||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/graceful-readlink/-/graceful-readlink-1.0.1.tgz#4cafad76bc62f02fa039b2f94e9a3dd3a391a725"
|
||||
|
||||
gzip-size@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/gzip-size/-/gzip-size-3.0.0.tgz#546188e9bdc337f673772f81660464b389dce520"
|
||||
dependencies:
|
||||
duplexer "^0.1.1"
|
||||
|
||||
handle-thing@^1.2.4:
|
||||
version "1.2.5"
|
||||
resolved "https://registry.yarnpkg.com/handle-thing/-/handle-thing-1.2.5.tgz#fd7aad726bf1a5fd16dfc29b2f7a6601d27139c4"
|
||||
|
@ -2627,7 +2649,7 @@ jquery-ujs@^1.2.1:
|
|||
dependencies:
|
||||
jquery ">=1.8.0"
|
||||
|
||||
jquery@^2.2.1, jquery@>=1.8.0:
|
||||
jquery@>=1.8.0, jquery@^2.2.1:
|
||||
version "2.2.1"
|
||||
resolved "https://registry.yarnpkg.com/jquery/-/jquery-2.2.1.tgz#3c3e16854ad3d2ac44ac65021b17426d22ad803f"
|
||||
|
||||
|
@ -2824,7 +2846,7 @@ loader-runner@^2.3.0:
|
|||
version "2.3.0"
|
||||
resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-2.3.0.tgz#f482aea82d543e07921700d5a46ef26fdac6b8a2"
|
||||
|
||||
loader-utils@0.2.x, loader-utils@^0.2.11, loader-utils@^0.2.16, loader-utils@^0.2.5:
|
||||
loader-utils@^0.2.11, loader-utils@^0.2.16, loader-utils@^0.2.5:
|
||||
version "0.2.16"
|
||||
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-0.2.16.tgz#f08632066ed8282835dff88dfb52704765adee6d"
|
||||
dependencies:
|
||||
|
@ -2903,7 +2925,7 @@ lodash@^3.8.0:
|
|||
version "3.10.1"
|
||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6"
|
||||
|
||||
lodash@^4.0.0, lodash@^4.0.1, lodash@^4.14.0, lodash@^4.17.2, lodash@^4.2.0, lodash@^4.3.0, lodash@^4.5.0:
|
||||
lodash@^4.0.0, lodash@^4.0.1, lodash@^4.14.0, lodash@^4.17.2, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.3.0, lodash@^4.5.0:
|
||||
version "4.17.4"
|
||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"
|
||||
|
||||
|
@ -3216,6 +3238,10 @@ onetime@^1.0.0:
|
|||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/onetime/-/onetime-1.1.0.tgz#a1f7838f8314c516f05ecefcbc4ccfe04b4ed789"
|
||||
|
||||
opener@^1.4.2:
|
||||
version "1.4.3"
|
||||
resolved "https://registry.yarnpkg.com/opener/-/opener-1.4.3.tgz#5c6da2c5d7e5831e8ffa3964950f8d6674ac90b8"
|
||||
|
||||
opn@4.0.2:
|
||||
version "4.0.2"
|
||||
resolved "https://registry.yarnpkg.com/opn/-/opn-4.0.2.tgz#7abc22e644dff63b0a96d5ab7f2790c0f01abc95"
|
||||
|
@ -3964,7 +3990,7 @@ source-map-support@^0.4.2:
|
|||
dependencies:
|
||||
source-map "^0.5.3"
|
||||
|
||||
source-map@0.1.x, source-map@^0.1.41:
|
||||
source-map@^0.1.41:
|
||||
version "0.1.43"
|
||||
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.1.43.tgz#c24bc146ca517c1471f5dacbe2571b2b7f9e3346"
|
||||
dependencies:
|
||||
|
@ -4402,6 +4428,21 @@ wbuf@^1.1.0, wbuf@^1.4.0:
|
|||
dependencies:
|
||||
minimalistic-assert "^1.0.0"
|
||||
|
||||
webpack-bundle-analyzer@^2.3.0:
|
||||
version "2.3.0"
|
||||
resolved "https://registry.yarnpkg.com/webpack-bundle-analyzer/-/webpack-bundle-analyzer-2.3.0.tgz#0d05e96a43033f7cc57f6855b725782ba61e93a4"
|
||||
dependencies:
|
||||
acorn "^4.0.11"
|
||||
chalk "^1.1.3"
|
||||
commander "^2.9.0"
|
||||
ejs "^2.5.5"
|
||||
express "^4.14.1"
|
||||
filesize "^3.5.4"
|
||||
gzip-size "^3.0.0"
|
||||
lodash "^4.17.4"
|
||||
mkdirp "^0.5.1"
|
||||
opener "^1.4.2"
|
||||
|
||||
webpack-dev-middleware@^1.0.11, webpack-dev-middleware@^1.9.0:
|
||||
version "1.10.0"
|
||||
resolved "https://registry.yarnpkg.com/webpack-dev-middleware/-/webpack-dev-middleware-1.10.0.tgz#7d5be2651e692fddfafd8aaed177c16ff51f0eb8"
|
||||
|
|
Loading…
Reference in a new issue