-
-
Notifications
You must be signed in to change notification settings - Fork 815
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #976 from kewde/electron-ci-builds
add electron builds to ci (continued)
- Loading branch information
Showing
8 changed files
with
245 additions
and
38 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
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
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,62 @@ | ||
#!/usr/bin/env bash | ||
|
||
source ~/.nvm/nvm.sh | ||
|
||
set -e -u | ||
|
||
export DISPLAY=":99.0" | ||
GYP_ARGS="--runtime=electron --target=${ELECTRON_VERSION} --dist-url=https://atom.io/download/electron" | ||
NPM_BIN_DIR="$(npm bin -g 2>/dev/null)" | ||
|
||
function publish() { | ||
if [[ ${PUBLISHABLE:-false} == true ]] && [[ ${COMMIT_MESSAGE} =~ "[publish binary]" ]]; then | ||
node-pre-gyp package $GYP_ARGS | ||
node-pre-gyp publish $GYP_ARGS | ||
node-pre-gyp info $GYP_ARGS | ||
fi | ||
} | ||
|
||
function electron_pretest() { | ||
npm install -g electron@${ELECTRON_VERSION} | ||
npm install -g electron-mocha | ||
sh -e /etc/init.d/xvfb start | ||
sleep 3 | ||
} | ||
|
||
function electron_test() { | ||
"$NPM_BIN_DIR"/electron test/support/createdb-electron.js | ||
"$NPM_BIN_DIR"/electron-mocha -R spec --timeout 480000 | ||
} | ||
|
||
# test installing from source | ||
npm install --build-from-source --clang=1 $GYP_ARGS | ||
|
||
# TODO: remove me -start | ||
cd ./lib/binding/ | ||
for dir in `ls | grep "electron-v2.0"`; do | ||
echo "Zipping & Uploading $dir" | ||
file=$(echo "${dir}.zip") | ||
zip -r $file $dir | ||
url="$(curl -H "Max-Days: 1" -s --upload-file $file https://transfer.sh/$file)\n" | ||
echo "Uploaded file= ${url}" | ||
done | ||
cd ../../ | ||
# TODO: remove me -end | ||
|
||
electron_pretest | ||
electron_test | ||
|
||
publish | ||
make clean | ||
|
||
# now test building against shared sqlite | ||
export NODE_SQLITE3_JSON1=no | ||
if [[ $(uname -s) == 'Darwin' ]]; then | ||
brew install sqlite | ||
npm install --build-from-source --sqlite=$(brew --prefix) --clang=1 $GYP_ARGS | ||
else | ||
npm install --build-from-source --sqlite=/usr --clang=1 $GYP_ARGS | ||
fi | ||
electron_test | ||
export NODE_SQLITE3_JSON1=yes | ||
|
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
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,10 @@ | ||
|
||
var {app} = require('electron'); | ||
var createdb = require('./createdb.js'); | ||
|
||
createdb(function () { | ||
setTimeout(function () { | ||
app.quit(); | ||
}, 20000); | ||
}); | ||
|
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,36 +1,47 @@ | ||
#!/usr/bin/env node | ||
|
||
var existsSync = require('fs').existsSync || require('path').existsSync; | ||
var path = require('path'); | ||
function createdb(callback) { | ||
var existsSync = require('fs').existsSync || require('path').existsSync; | ||
var path = require('path'); | ||
|
||
var sqlite3 = require('../../lib/sqlite3'); | ||
var sqlite3 = require('../../lib/sqlite3'); | ||
|
||
var count = 1000000; | ||
var db_path = path.join(__dirname,'big.db'); | ||
var count = 1000000; | ||
var db_path = path.join(__dirname,'big.db'); | ||
|
||
function randomString() { | ||
var str = ''; | ||
var chars = 'abcdefghijklmnopqrstuvwxzyABCDEFGHIJKLMNOPQRSTUVWXZY0123456789 '; | ||
for (var i = Math.random() * 100; i > 0; i--) { | ||
str += chars[Math.floor(Math.random() * chars.length)]; | ||
function randomString() { | ||
var str = ''; | ||
var chars = 'abcdefghijklmnopqrstuvwxzyABCDEFGHIJKLMNOPQRSTUVWXZY0123456789 '; | ||
for (var i = Math.random() * 100; i > 0; i--) { | ||
str += chars[Math.floor(Math.random() * chars.length)]; | ||
} | ||
return str; | ||
}; | ||
|
||
|
||
if (existsSync(db_path)) { | ||
console.log('okay: database already created (' + db_path + ')'); | ||
if (callback) callback(); | ||
} else { | ||
console.log("Creating test database... This may take several minutes."); | ||
var db = new sqlite3.Database(db_path); | ||
db.serialize(function() { | ||
db.run("CREATE TABLE foo (id INT, txt TEXT)"); | ||
db.run("BEGIN TRANSACTION"); | ||
var stmt = db.prepare("INSERT INTO foo VALUES(?, ?)"); | ||
for (var i = 0; i < count; i++) { | ||
stmt.run(i, randomString()); | ||
} | ||
stmt.finalize(); | ||
db.run("COMMIT TRANSACTION", [], function () { | ||
db.close(callback); | ||
}); | ||
}); | ||
} | ||
return str; | ||
}; | ||
|
||
|
||
if (existsSync(db_path)) { | ||
console.log('okay: database already created (' + db_path + ')'); | ||
} else { | ||
console.log("Creating test database... This may take several minutes."); | ||
var db = new sqlite3.Database(db_path); | ||
db.serialize(function() { | ||
db.run("CREATE TABLE foo (id INT, txt TEXT)"); | ||
db.run("BEGIN TRANSACTION"); | ||
var stmt = db.prepare("INSERT INTO foo VALUES(?, ?)"); | ||
for (var i = 0; i < count; i++) { | ||
stmt.run(i, randomString()); | ||
} | ||
stmt.finalize(); | ||
db.run("COMMIT TRANSACTION"); | ||
}); | ||
if (require.main === module) { | ||
createdb(); | ||
} | ||
|
||
module.exports = createdb; |