信号量CI一直在执行艰巨的服务器任务时失败

时间:2018-06-27 11:51:04

标签: javascript github gruntjs mean-stack semaphore-ci

我正在尝试为我们的MEAN-stack网络平台实现CI。 我结合我们的G​​ithub存储库激活了Semaphore CI,并运行2条命令:npm install => npm test

我的npm测试具有以下配置:

"test": "grunt test"

我的咕unt测试配置:

'use strict';

/**
 * Module dependencies.
 */
var _ = require('lodash'),
    defaultAssets = require('./config/assets/default'),
    testAssets = require('./config/assets/test'),
    fs = require('fs'),
    path = require('path');

module.exports = function(grunt) {
    // Project Configuration
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        env: {
            test: {
                NODE_ENV: 'test'
            },
            dev: {
                NODE_ENV: 'development'
            },
            prod: {
                NODE_ENV: 'production'
            }
        },
        watch: {
            serverViews: {
                files: defaultAssets.server.views,
                options: {
                    livereload: true
                }
            },
            serverJS: {
                files: _.union(defaultAssets.server.gruntConfig, defaultAssets.server.allJS),
                tasks: ['jshint'],
                options: {
                    livereload: true
                }
            },
            clientViews: {
                files: defaultAssets.client.views,
                options: {
                    livereload: true
                }
            },
            clientJS: {
                files: defaultAssets.client.js,
                tasks: ['jshint'],
                options: {
                    livereload: true
                }
            },
            clientCSS: {
                files: defaultAssets.client.css,
                tasks: ['csslint'],
                options: {
                    livereload: true
                }
            },
            clientSCSS: {
                files: defaultAssets.client.sass,
                tasks: ['sass', 'csslint'],
                options: {
                    livereload: true
                }
            },
            clientLESS: {
                files: defaultAssets.client.less,
                tasks: ['less', 'csslint'],
                options: {
                    livereload: true
                }
            }
        },
        nodemon: {
            dev: {
                script: 'server.js',
                options: {
                    nodeArgs: ['--debug'],
                    ext: 'js,html',
                    watch: _.union(defaultAssets.server.gruntConfig, defaultAssets.server.views, defaultAssets.server.allJS, defaultAssets.server.config)
                }
            }
        },
        concurrent: {
            default: ['nodemon', 'watch'],
            debug: ['nodemon', 'watch', 'node-inspector'],
            options: {
                logConcurrentOutput: true
            }
        },
        jshint: {
            all: {
                src: _.union(defaultAssets.server.gruntConfig, defaultAssets.server.allJS, defaultAssets.client.js, testAssets.tests.server, testAssets.tests.client, testAssets.tests.e2e),
                options: {
                    jshintrc: true,
                    node: true,
                    mocha: true,
                    jasmine: true
                }
            }
        },
        csslint: {
            options: {
                csslintrc: '.csslintrc'
            },
            all: {
                src: defaultAssets.client.css
            }
        },
        babel: {
            options: {
                sourceMap: false,
                presets: ['env']
            },
            dist: {
                files: [{
                    expand: true,
                    cwd: './',
                    ext: '.js',
                    src: defaultAssets.client.js,
                    dest: 'dist/',
                }]
            }
        },
        ngAnnotate: {
            production: {
                files: {
                    'public/dist/application.js': [
                        'dist/modules/core/client/app/config.js',
                        'dist/modules/core/client/app/init.js',
                        'dist/modules/*/client/config/*.client.routes.js',
                        'dist/modules/*/client/*.js',
                        'dist/modules/*/client/**/*.js',
                    ],
                    // 'public/dist/application.js': defaultAssets.client.js
                }
            }
        },
        uglify: {
            production: {
                options: {
                    mangle: false
                },
                files: {
                    'public/dist/application.min.js': 'public/dist/application.js'
                }
            }
        },
        cssmin: {
            combine: {
                files: {
                    'public/dist/application.min.css': defaultAssets.client.css
                }
            }
        },
        sass: {
            dist: {
                files: [{
                    expand: true,
                    src: defaultAssets.client.sass,
                    ext: '.css',
                    rename: function(base, src) {
                        return src.replace('/scss/', '/css/');
                    }
                }]
            }
        },
        less: {
            dist: {
                files: [{
                    expand: true,
                    src: defaultAssets.client.less,
                    ext: '.css',
                    rename: function(base, src) {
                        return src.replace('/less/', '/css/');
                    }
                }]
            }
        },
        'node-inspector': {
            custom: {
                options: {
                    'web-port': 1337,
                    'web-host': 'localhost',
                    'debug-port': 5858,
                    'save-live-edit': true,
                    'no-preload': true,
                    'stack-trace-limit': 50,
                    'hidden': []
                }
            }
        },
        mochaTest: {
            src: testAssets.tests.server,
            options: {
                reporter: 'spec',
                timeout: 10000
            }
        },
        karma: {
            unit: {
                configFile: 'karma.conf.js'
            }
        },
        protractor: {
            options: {
                configFile: 'protractor.conf.js',
                keepAlive: true,
                noColor: false
            },
            e2e: {
                options: {
                    args: {} // Target-specific arguments
                }
            }
        },
        copy: {
            localConfig: {
                src: 'config/env/local.example.js',
                dest: 'config/env/local.js',
                filter: function() {
                    return !fs.existsSync('config/env/local.js');
                }
            }
        },
        webfont: {
            icons: {
            src: 'modules/core/client/css/fonts/*',
            dest: 'public/dist/fonts'
            }
        },
        mocha_istanbul: {
            coverage: {
                src: 'modules/*/tests/*', // a folder works nicely
                options: {
                    mask: '*.tests.js'
                }
            },
            coverageSpecial: {
                src: ['testSpecial/*/*.js', 'testUnique/*/*.js'], // specifying file patterns works as well
                options: {
                    coverageFolder: 'coverageSpecial',
                    mask: '*.tests.js',
                    mochaOptions: ['--harmony','--async-only'], // any extra options
                    istanbulOptions: ['--harmony','--handle-sigint']
                }
            },
            coveralls: {
                src: ['test', 'testSpecial', 'testUnique'], // multiple folders also works
                options: {
                    coverfage:true, // this will make the grunt.event.on('coverage') event listener to be triggered
                    check: {
                        lines: 75,
                        statements: 75
                    },
                    root: './lib', // define where the cover task should consider the root of libraries that are covered by tests
                    reportFormats: ['cobertura','lcovonly']
                }
            }
        },
        istanbul_check_coverage: {
          default: {
            options: {
              coverageFolder: 'coverage*', // will check both coverage folders and merge the coverage results
              check: {
                lines: 80,
                statements: 80
              }
            }
          }
        }
    });

    // Load NPM tasks
    require('load-grunt-tasks')(grunt);

    // Making grunt default to force in order not to break the project.
    grunt.option('force', true);

    // Make sure upload directory exists
    grunt.task.registerTask('mkdir:upload', 'Task that makes sure upload directory exists.', function() {
        // Get the callback
        var done = this.async();

        grunt.file.mkdir(path.normalize(__dirname + '/modules/users/client/img/profile/uploads'));

        done();
    });

    // Connect to the MongoDB instance and load the models
    grunt.task.registerTask('mongoose', 'Task that connects to the MongoDB instance and loads the application models.', function() {
        // Get the callback
        var done = this.async();

        // Use mongoose configuration
        var mongoose = require('./config/lib/mongoose.js');

        // Connect to database
        mongoose.connect(function(db) {
            done();
        });
    });

    grunt.task.registerTask('server', 'Starting the server', function() {
        // Get the callback
        var done = this.async();

        var path = require('path');
        var app = require(path.resolve('./config/lib/app'));
        var server = app.start(function() {
            done();
        });
    });

    grunt.event.on('coverage', function(lcovFileContents, done){
        // Check below on the section "The coverage event"
        console.log(lcovFileContents);
        done();
    });

    grunt.loadNpmTasks('grunt-mocha-istanbul');
    grunt.registerTask('coveralls', ['mocha_istanbul:coveralls']);
    grunt.registerTask('coverage', ['env:test', 'server', 'mocha_istanbul:coverage']);
    // Lint CSS and JavaScript files.
    grunt.registerTask('lint', ['sass', 'less', 'csslint']);

    // Lint project files and minify them into two production files.
    grunt.registerTask('build', ['env:dev', 'lint', 'webfont', 'babel', 'ngAnnotate', 'uglify', 'cssmin']);

    // Run the project tests
    grunt.registerTask('test', ['env:test', 'lint', 'mkdir:upload', 'copy:localConfig', 'server', 'mochaTest', 'karma:unit']);
    grunt.registerTask('test:server', ['env:test', 'lint', 'server', 'mochaTest']);
    grunt.registerTask('test:client', ['env:test', 'lint', 'server', 'karma:unit']);
    // Run the project in development mode
    grunt.registerTask('default', ['env:dev', 'lint', 'mkdir:upload', 'copy:localConfig', 'concurrent:default']);

    // Run the project in debug mode
    grunt.registerTask('debug', ['env:dev', 'lint', 'mkdir:upload', 'copy:localConfig', 'concurrent:debug']);

    // Run the project in production mode
    grunt.registerTask('prod', ['build', 'env:prod', 'mkdir:upload', 'copy:localConfig']);
};

我一直得到相同的输出,并且使用信号量构建失败:

> karaton@0.4.0 test /home/runner/Karaton_Webplatform_Staging
> grunt test

Running "env:test" (env) task

Running "sass:dist" (sass) task
Warning: 
You need to have Ruby and Sass installed and in your PATH for this task to work.
More info: https://github.com/gruntjs/grunt-contrib-sass
 Used --force, continuing.

Running "less:dist" (less) task

Running "csslint:all" (csslint) task
Linting modules/core/client/css/core.css...ERROR
[L15:C1]
WARNING: Rule is empty. Rules without any properties specified should be removed. (empty-rules) Browsers: All
[L51:C1]
WARNING: Outlines shouldn't be hidden unless other visual changes are made. Use of outline: none or outline: 0 should be limited to :focus rules. (outline-none) Browsers: All
[L95:C3]
WARNING: The property -moz-animation is compatible with -webkit-animation and should be included as well. Include all compatible vendor prefixes to reach a wider range of users. (compatible-vendor-prefixes) Browsers: All
[L109:C5]
WARNING: Missing standard property 'transform' to go along with '-webkit-transform'. When using a vendor-prefixed property, make sure to include the standard one. (vendor-prefix) Browsers: All
[L112:C5]
WARNING: Missing standard property 'transform' to go along with '-webkit-transform'. When using a vendor-prefixed property, make sure to include the standard one. (vendor-prefix) Browsers: All
[L457:C1]
WARNING: Outlines shouldn't be hidden unless other visual changes are made. Use of outline: none or outline: 0 should be limited to :focus rules. (outline-none) Browsers: All
[L660:C3]
WARNING: display:inline has no effect on floated elements (but may be used to fix the IE6 double-margin bug). Certain properties shouldn't be used with certain display property values. (display-property-grouping) Browsers: All
[L662:C3]
WARNING: width can't be used with display: inline. Certain properties shouldn't be used with certain display property values. (display-property-grouping) Browsers: All
[L804:C1]
>> ERROR: Unknown @ rule: @-ms-keyframes. This rule looks for recoverable syntax errors. (errors) Browsers: All
[L833:C1]
>> ERROR: Unknown @ rule: @-ms-keyframes. This rule looks for recoverable syntax errors. (errors) Browsers: All
[L898:C17]
WARNING: Values of 0 shouldn't have units specified. You don't need to specify units when a value is 0. (zero-units) Browsers: All
[L898:C29]
WARNING: Values of 0 shouldn't have units specified. You don't need to specify units when a value is 0. (zero-units) Browsers: All
[L943:C1]
WARNING: The properties padding-top, padding-bottom, padding-left, padding-right can be replaced by padding. Use shorthand properties where possible. (shorthand) Browsers: All
[L969:C16]
WARNING: Values of 0 shouldn't have units specified. You don't need to specify units when a value is 0. (zero-units) Browsers: All
[L973:C17]
WARNING: Values of 0 shouldn't have units specified. You don't need to specify units when a value is 0. (zero-units) Browsers: All
[L985:C16]
WARNING: Values of 0 shouldn't have units specified. You don't need to specify units when a value is 0. (zero-units) Browsers: All
[L1029:C17]
WARNING: Values of 0 shouldn't have units specified. You don't need to specify units when a value is 0. (zero-units) Browsers: All
[L1033:C16]
WARNING: Values of 0 shouldn't have units specified. You don't need to specify units when a value is 0. (zero-units) Browsers: All
[L1096:C3]
WARNING: Fallback background-color (hex or RGB) should precede RGBA background-color. For older browsers that don't support RGBA, HSL, or HSLA, provide a fallback color. (fallback-colors) Browsers: IE6,IE7,IE8
[L1309:C1]
WARNING: Outlines should only be modified using :focus. Use of outline: none or outline: 0 should be limited to :focus rules. (outline-none) Browsers: All
[L1333:C16]
WARNING: Values of 0 shouldn't have units specified. You don't need to specify units when a value is 0. (zero-units) Browsers: All
[L1341:C16]
[L1398:C1]
WARNING: Outlines should only be modified using :focus. Use of outline: none or outline: 0 should be limited to :focus rules. (outline-none) Browsers: All
[L1448:C1]
WARNING: Outlines should only be modified using :focus. Use of outline: none or outline: 0 should be limited to :focus rules. (outline-none) Browsers: All
WARNING: Values of 0 shouldn't have units specified. You don't need to specify units when a value is 0. (zero-units) Browsers: All
[L1380:C1]
WARNING: Outlines should only be modified using :focus. Use of outline: none or outline: 0 should be limited to :focus rules. (outline-none) Browsers: All
[L1389:C1]
WARNING: Outlines should only be modified using :focus. Use of outline: none or outline: 0 should be limited to :focus rules. (outline-none) Browsers: All
WARNING: Values of 0 shouldn't have units specified. You don't need to specify units when a value is 0. (zero-units) Browsers: All
[L898:C21]
WARNING: Values of 0 shouldn't have units specified. You don't need to specify units when a value is 0. (zero-units) Browsers: All
[L907:C17]
WARNING: Values of 0 shouldn't have units specified. You don't need to specify units when a value is 0. (zero-units) Browsers: All
[L907:C21]
WARNING: Values of 0 shouldn't have units specified. You don't need to specify units when a value is 0. (zero-units) Browsers: All
[L907:C29]
[L1453:C1]
WARNING: Outlines should only be modified using :focus. Use of outline: none or outline: 0 should be limited to :focus rules. (outline-none) Browsers: All
[L1458:C1]
WARNING: Outlines should only be modified using :focus. Use of outline: none or outline: 0 should be limited to :focus rules. (outline-none) Browsers: All
[L1521:C1]
WARNING: Outlines should only be modified using :focus. Use of outline: none or outline: 0 should be limited to :focus rules. (outline-none) Browsers: All
[L1549:C10]
WARNING: Values of 0 shouldn't have units specified. You don't need to specify units when a value is 0. (zero-units) Browsers: All
[L1685:C1]
WARNING: Don't use IDs in selectors. Selectors should not contain IDs. (ids) Browsers: All
[L1730:C1]
WARNING: Outlines should only be modified using :focus. Use of outline: none or outline: 0 should be limited to :focus rules. (outline-none) Browsers: All
Warning: Task "csslint:all" failed. Used --force, continuing.

Running "mkdir:upload" task

Running "copy:localConfig" (copy) task
[L1462:C1]
WARNING: Outlines should only be modified using :focus. Use of outline: none or outline: 0 should be limited to :focus rules. (outline-none) Browsers: All
[L1467:C1]
WARNING: Outlines should only be modified using :focus. Use of outline: none or outline: 0 should be limited to :focus rules. (outline-none) Browsers: All
Copied 1 file

Running "server" task


body-parser deprecated bodyParser: use individual json/urlencoded middlewares config/lib/express.js:84:11
body-parser deprecated undefined extended: provide extended option node_modules/body-parser/index.js:105:29
Fatal error: Unexpected token ...
npm ERR! Test failed.  See above for more details.

因为它只显示...,所以我无法弄清楚令牌和失败的位置,因此无法正常工作。你们有什么主意,我应该怎么做才能避免出现此错误?

如果您需要更多代码或更多项目设置,请告诉我,我将对其进行更新。

谢谢!

0 个答案:

没有答案