-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
149 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,27 @@ | ||
sudo: required | ||
dist: xenial | ||
addons: | ||
chrome: stable | ||
language: node_js | ||
services: | ||
- xvfb | ||
cache: | ||
yarn: true | ||
node_js: | ||
- "12" | ||
cache: | ||
- node_modules | ||
cache: yarn | ||
before_install: | ||
- export START_TIME=$( date +%s ) | ||
- export COVERALLS_SERVICE_JOB_ID=$( TRAVIS_JOB_ID ) | ||
- export COVERALLS_SERVICE_NAME="CKEditor5 code coverage" | ||
- npm i -g yarn | ||
install: | ||
- yarn install | ||
# The "./manual/all-features-dll.js" test requires building DLL. | ||
- yarn run dll:build | ||
script: | ||
- node ./scripts/continuous-integration-script.js | ||
- yarn run lint | ||
- yarn run stylelint | ||
- ./scripts/check-manual-tests.sh -r ckeditor5 -f ckeditor5 | ||
- yarn run docs --strict | ||
- 'if [ $TRAVIS_TEST_RESULT -eq 0 ]; then | ||
travis_wait 30 yarn run docs:build-and-publish-nightly; | ||
fi' | ||
- ./scripts/ci/travis-check.js | ||
# "travis_wait" does not work in child processes. Hence, it must be called from the configuration file. | ||
- if [[ $TRAVIS_JOB_TYPE == "Validation" && $TRAVIS_TEST_RESULT -eq 0 ]]; then travis_wait 30 yarn run docs:build-and-publish-nightly; fi | ||
after_script: | ||
- export END_TIME=$( date +%s ) | ||
- ckeditor5-dev-tests-notify-travis-status | ||
env: | ||
global: | ||
- secure: RO140EQDHmEOPJPikk8eCY5IdHpnEKGm41p5U1ewAbeZv1DpCG+rSumR2JdYl75kFAaZvCSm1NuVMM+kmYd+/z+LQbKj7QH5G/UHNho3H89blIU6WlJhT0YR5vclm9rvnEvOtxnfODca1Qrw+CaCoJks2o4VYbJB7mOBVNsh7Bc= | ||
jobs: | ||
- TRAVIS_JOB_TYPE=Tests | ||
- TRAVIS_JOB_TYPE=Validation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
#!/usr/bin/env node | ||
|
||
/** | ||
* @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
*/ | ||
|
||
/* eslint-env node */ | ||
|
||
'use strict'; | ||
|
||
const childProcess = require( 'child_process' ); | ||
const crypto = require( 'crypto' ); | ||
const path = require( 'path' ); | ||
|
||
const ROOT_DIRECTORY = path.join( __dirname, '..', '..' ); | ||
const { TRAVIS_JOB_TYPE } = process.env; | ||
|
||
const RED = '\x1B[0;31m'; | ||
const GREEN = '\x1B[32m'; | ||
const CYAN = '\x1B[36;1m'; | ||
const MAGENTA = '\x1B[35;1m'; | ||
const NO_COLOR = '\x1B[0m'; | ||
|
||
// Tests + Code coverage. | ||
if ( TRAVIS_JOB_TYPE === 'Tests' ) { | ||
console.log( `\n${ CYAN }Running the "Tests" build.${ NO_COLOR }\n` ); | ||
|
||
exec( 'node', './scripts/ci/check-packages-code-coverage.js' ); | ||
} | ||
|
||
// Verifying the code style. | ||
if ( TRAVIS_JOB_TYPE === 'Validation' ) { | ||
console.log( `\n${ CYAN }Running the "Validation" build.${ NO_COLOR }\n` ); | ||
|
||
// Linters. | ||
exec( 'yarn', 'run', 'lint' ); | ||
exec( 'yarn', 'run', 'stylelint' ); | ||
|
||
// Verifying manual tests. | ||
exec( 'yarn', 'run', 'dll:build' ); | ||
exec( 'sh', './scripts/check-manual-tests.sh', '-r', 'ckeditor5', '-f', 'ckeditor5' ); | ||
|
||
// Build the docs. | ||
exec( 'yarn', 'run', 'docs', '--strict' ); | ||
} | ||
|
||
/** | ||
* Executes the specified command. E.g. for displaying the Node's version, use: | ||
* | ||
* exec( 'node', '-v' ); | ||
* | ||
* The output will be formatted using Travis's structure that increases readability. | ||
* | ||
* @param {..String} command | ||
*/ | ||
function exec( ...command ) { | ||
const travis = { | ||
_lastTimerId: null, | ||
_lastStartTime: null, | ||
|
||
foldStart() { | ||
console.log( `travis_fold:start:script${ MAGENTA }$ ${ command.join( ' ' ) }${ NO_COLOR }` ); | ||
this._timeStart(); | ||
}, | ||
|
||
foldEnd() { | ||
this._timeFinish(); | ||
console.log( '\ntravis_fold:end:script\n' ); | ||
}, | ||
|
||
_timeStart() { | ||
const nanoSeconds = process.hrtime.bigint(); | ||
|
||
this._lastTimerId = crypto.createHash( 'md5' ).update( nanoSeconds.toString() ).digest( 'hex' ); | ||
this._lastStartTime = nanoSeconds; | ||
|
||
// Intentional direct write to stdout, to manually control EOL. | ||
process.stdout.write( `travis_time:start:${ this._lastTimerId }\r\n` ); | ||
}, | ||
|
||
_timeFinish() { | ||
const travisEndTime = process.hrtime.bigint(); | ||
const duration = travisEndTime - this._lastStartTime; | ||
|
||
// Intentional direct write to stdout, to manually control EOL. | ||
process.stdout.write( | ||
`\ntravis_time:end:${ this._lastTimerId }:start=${ this._lastStartTime },` + | ||
`finish=${ travisEndTime },duration=${ duration }\r\n` | ||
); | ||
} | ||
}; | ||
|
||
travis.foldStart(); | ||
|
||
const childProcessStatus = childProcess.spawnSync( command[ 0 ], command.slice( 1 ), { | ||
encoding: 'utf8', | ||
shell: true, | ||
cwd: ROOT_DIRECTORY, | ||
stdio: 'inherit', | ||
stderr: 'inherit' | ||
} ); | ||
|
||
const EXIT_CODE = childProcessStatus.status; | ||
const COLOR = EXIT_CODE ? RED : GREEN; | ||
|
||
travis.foldEnd(); | ||
|
||
console.log( `${ COLOR }The command "${ command.join( ' ' ) }" exited with ${ EXIT_CODE }.${ NO_COLOR }\n` ); | ||
|
||
if ( childProcessStatus.status ) { | ||
// An error occurred. Break the entire script. | ||
process.exit( EXIT_CODE ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters