mirror of
https://github.com/google/blockly.git
synced 2026-01-11 10:57:07 +01:00
Enable google/blockly with continuous build on travis ci (#1023)
* create .travis for ci job * initial checkin for blocky-web travis ci job * rename file to .travis.yaml for typo * remove after_script * added cache * rename .travis.yaml to .travis.yml * Update .travis.yml * include build script * fix yaml file format issue * debug install part * debug build issue * Update .travis.yml * remove cache for now * Update .travis.yml * Update .travis.yml * Update .travis.yml * more debug info * Update .travis.yml * Update .travis.yml * fix typo * installing chrome browser * remove chrome setting config * run build.py as part of npm install * Update .travis.yml * update karma dependency * use karma as test runner * fix typo * remove karma test for now * Update .travis.yml * Update package.json * add npm test target * add browserstack-runner depdendency * update browser support * fix typo for test target * fix chrome typo * added closure dependency * add google-closure-library * include blockly_uncompressed.js and core.js dependency * uncomment out core/*.js files * add kama job as part of install * remove browserstack add on for now * fix karma config typo * add karma-closure * add os support * remove typo config * include more closure files * change os back to linux * use closure-library from node_modules * change log level back to INFO * change npm test target to use open browser command instead of karma * change travis test target to use open command instead of karma * list current directory * find what's in current dir * typo command * Update .travis.yml * typo again * open right index.html * use right path for index.html * xdg-open to open default browser on travis * exit browser after 5s wait * change timeout to 1 min * exit after opening up browser * use browser only * use karma * remove un-needed dependency * clean up script section * fix typo * update build status on readme * initial commit for selenium integration tests * update selenium jar path * fix test_runner.js typo * add more debug info * check java version * add && instead of 9288 * fix java path * add logic to check if selenium is running or not * add some deugging info * initial commit to get chromedriver * add chromedriver flag * add get_chromedriver.sh to package.json and .travel * change browser to chrome for now * fix path issue * update chromdriver path * fix path issue again * more debugging * add debug msg * fix typo * minor fix for getting chromedriver * install latest chrome browser * clean up pakcage.json * use npm target for test run * remove removing trailing comma * fix another trailing comma * updated travis test target * clean up scripts * not sure nmp run preinstall * redirect selenium log to tmp file * revert writing console log to file * update test summary * more clean up * minor clean up before pull request * resolved closure-library conflict 1. add closure-library to dependencies instead of devDependencies. 2. add lint back in scripts block * fix typo (adding comma) in script section
This commit is contained in:
32
.travis.yml
Normal file
32
.travis.yml
Normal file
@@ -0,0 +1,32 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "4"
|
||||
- "stable"
|
||||
sudo: required
|
||||
dist: trusty
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- google-chrome
|
||||
packages:
|
||||
- google-chrome-stable
|
||||
|
||||
before_install:
|
||||
- npm install google-closure-library
|
||||
# Symlink closure library
|
||||
- ln -s $(npm root)/google-closure-library ../closure-library
|
||||
|
||||
before_script:
|
||||
- export CHROME_BIN=/usr/bin/google-chrome
|
||||
- export DISPLAY=:99.0
|
||||
- sh -e /etc/init.d/xvfb start
|
||||
script:
|
||||
- set -x
|
||||
- scripts/get_geckdriver.sh
|
||||
- scripts/get_selenium.sh
|
||||
- scripts/get_chromedriver.sh
|
||||
- scripts/selenium_connect.sh &
|
||||
- node tests/jsunit/test_runner.js
|
||||
|
||||
os:
|
||||
- linux
|
||||
@@ -1,4 +1,5 @@
|
||||
# Blockly
|
||||
# Blockly [](https://travis-ci.org/google/blockly)
|
||||
|
||||
|
||||
Google's Blockly is a web-based, visual programming editor. Users can drag
|
||||
blocks together to build programs. All code is free and open source.
|
||||
|
||||
26
package.json
26
package.json
@@ -2,10 +2,9 @@
|
||||
"name": "blockly",
|
||||
"version": "1.0.0",
|
||||
"description": "Blockly is a library for building visual programming editors.",
|
||||
"keywords": ["blockly"],
|
||||
"scripts": {
|
||||
"lint": "jshint ."
|
||||
},
|
||||
"keywords": [
|
||||
"blockly"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/google/blockly.git"
|
||||
@@ -17,6 +16,11 @@
|
||||
"author": {
|
||||
"name": "Neil Fraser"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "jshint .",
|
||||
"preinstall": "scripts/get_geckdriver.sh && scripts/get_selenium.sh && scripts/get_chromedriver.sh && scripts/selenium_connect.sh &",
|
||||
"test": "node tests/jsunit/test_runner.js"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
@@ -24,12 +28,22 @@
|
||||
},
|
||||
"jshintConfig": {
|
||||
"globalstrict": true,
|
||||
"predef": ["Blockly", "goog", "window", "document", "soy", "XMLHttpRequest"],
|
||||
"predef": [
|
||||
"Blockly",
|
||||
"goog",
|
||||
"window",
|
||||
"document",
|
||||
"soy",
|
||||
"XMLHttpRequest"
|
||||
],
|
||||
"sub": true,
|
||||
"undef": true,
|
||||
"unused": true
|
||||
},
|
||||
"dependencies": {
|
||||
"closure-library": "^1.43629075.2"
|
||||
"install": "^0.8.8",
|
||||
"npm": "^4.4.4",
|
||||
"closure-library": "^1.43629075.2",
|
||||
"webdriverio": "^4.6.2"
|
||||
}
|
||||
}
|
||||
|
||||
12
scripts/get_chromedriver.sh
Executable file
12
scripts/get_chromedriver.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
os_name=`uname`
|
||||
chromedriver_dir="chromedriver"
|
||||
if [ ! -d $chromedriver_dir ]; then
|
||||
mkdir $chromedriver_dir
|
||||
fi
|
||||
|
||||
if [[ $os_name == 'Linux' ]]; then
|
||||
cd chromedriver && curl -L https://chromedriver.storage.googleapis.com/2.29/chromedriver_linux64.zip > tmp.zip && unzip -o tmp.zip && rm tmp.zip
|
||||
elif [[ $os_name == 'Darwin' ]]; then
|
||||
cd chromedriver && curl -L https://chromedriver.storage.googleapis.com/2.29/chromedriver_mac64.zip | tar xz
|
||||
fi
|
||||
7
scripts/get_geckdriver.sh
Executable file
7
scripts/get_geckdriver.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
os_name=`uname`
|
||||
if [[ $os_name == 'Linux' ]]; then
|
||||
cd ../ && curl -L https://github.com/mozilla/geckodriver/releases/download/v0.11.1/geckodriver-v0.11.1-linux64.tar.gz | tar xz
|
||||
elif [[ $os_name == 'Darwin' ]]; then
|
||||
cd ../ && curl -L https://github.com/mozilla/geckodriver/releases/download/v0.11.1/geckodriver-v0.11.1-macos.tar.gz | tar xz
|
||||
fi
|
||||
14
scripts/get_selenium.sh
Executable file
14
scripts/get_selenium.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
DIR="../webdriverio-test"
|
||||
FILE=selenium-server-standalone-3.0.1.jar
|
||||
|
||||
if [ ! -d $DIR ]; then
|
||||
mkdir $DIR
|
||||
fi
|
||||
|
||||
if [ ! -f $DIR/$FILE ]; then
|
||||
cd $DIR && curl -O http://selenium-release.storage.googleapis.com/3.0/selenium-server-standalone-3.0.1.jar
|
||||
fi
|
||||
|
||||
|
||||
|
||||
10
scripts/selenium_connect.sh
Executable file
10
scripts/selenium_connect.sh
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
#check if selenium server is up running
|
||||
pid=`lsof -ti tcp:4444`
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
kill -9 $pid
|
||||
fi
|
||||
java -jar -Dwebdriver.gecko.driver=../geckodriver -Dwebdriver.chrome.driver="chromedriver/chromedriver" ../webdriverio-test/selenium-server-standalone-3.0.1.jar &
|
||||
|
||||
35
tests/jsunit/test_runner.js
Normal file
35
tests/jsunit/test_runner.js
Normal file
@@ -0,0 +1,35 @@
|
||||
var webdriverio = require('webdriverio');
|
||||
var options = {
|
||||
desiredCapabilities: {
|
||||
browserName: 'chrome'
|
||||
}
|
||||
};
|
||||
|
||||
var path = process.cwd();
|
||||
//TODO: change pause to waitunitl
|
||||
var browser = webdriverio
|
||||
.remote(options)
|
||||
.init()
|
||||
.url("file://" + path + "/tests/jsunit/index.html").pause(3000);
|
||||
|
||||
|
||||
browser
|
||||
.getHTML('#closureTestRunnerLog')
|
||||
.then(function(result) {
|
||||
// call js to parse html
|
||||
var regex = /[\d]+\spassed,\s([\d]+)\sfailed./i;
|
||||
var numOfFailure = regex.exec(result)[1];
|
||||
var regex2 = /Unit Tests for Blockly .*]/;
|
||||
var testStatus = regex2.exec(result)[0];
|
||||
console.log("============Blockly Unit Test Summary=================");
|
||||
console.log(testStatus);
|
||||
var regex3 = /\d+ passed,\s\d+ failed/;
|
||||
var detail = regex3.exec(result)[0];
|
||||
console.log(detail);
|
||||
console.log("============Blockly Unit Test Summary=================");
|
||||
if ( parseInt(numOfFailure) !== 0) {
|
||||
console.log(result);
|
||||
process.exit(1);
|
||||
}
|
||||
})
|
||||
.catch(function(err) { console.log(err); process.exit(1); });
|
||||
Reference in New Issue
Block a user