Skip to content

Commit

Permalink
Merge branch 'add_new_spectron_test' into dev, fixes #983
Browse files Browse the repository at this point in the history
  • Loading branch information
rbuels committed May 2, 2018
2 parents c7774be + 3ef66f9 commit 99c8522
Show file tree
Hide file tree
Showing 22 changed files with 2,303 additions and 161 deletions.
7 changes: 6 additions & 1 deletion .travis.yml
@@ -1,4 +1,4 @@
sudo: false
sudo: true
dist: trusty
language: perl
python: 2.7.10
Expand All @@ -25,6 +25,10 @@ env:
global:
- GECKODRIVER_VERSION=0.19.1
- PHANTOMJS_VERSION=2.1.1
before_install:
- sudo dpkg --add-architecture i386
- sudo apt-get -qq update
- sudo apt-get install wine1.6
install:
- "export PATH=$PWD/travis_phantomjs/phantomjs-$PHANTOMJS_VERSION-linux-x86_64/bin:$PATH"
- "if [ $(phantomjs --version) != $PHANTOMJS_VERSION ]; then rm -rf $PWD/travis_phantomjs; mkdir -p $PWD/travis_phantomjs; fi"
Expand Down Expand Up @@ -54,6 +58,7 @@ script:
- prove -Isrc/perl5 -r -j3 tests/perl_tests;
- utils/jb_run.js -p 9000 & sleep 2
- node_modules/.bin/phantomjs tests/js_tests/run-jasmine.js http://localhost:9000/tests/js_tests/index.html
- xvfb-run node_modules/.bin/ava --timeout=60s tests/electron_tests
- MOZ_HEADLESS=1 SELENIUM_BROWSER=firefox JBROWSE_URL=http://localhost:9000/index.html tests/selenium_tests/travis_wrapper.sh;
# if we are building for inclusion into the `dev` branch, build the releases and test the minimal one too
- |
Expand Down
Binary file added browser/icons/jbrowse-64x64.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added browser/icons/jbrowse.icns
Binary file not shown.
Binary file added browser/icons/jbrowse.ico
Binary file not shown.
Binary file added browser/icons/jbrowse.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added browser/icons/jbrowse.xcf
Binary file not shown.
82 changes: 82 additions & 0 deletions browser/icons/png2icns.sh
@@ -0,0 +1,82 @@
#!/bin/sh


# Exec Paths
SIPS='/usr/bin/sips'
ICONUTIL='/usr/bin/iconutil'
if [ ! -x "${SIPS}" ]; then
echo "Cannot find required SIPS executable at: ${SIPS}" >&2
exit 1;
fi
if [ ! -x "${ICONUTIL}" ]; then
echo "Cannot find required ICONUTIL executable at: ${ICONUTIL}" >&2
exit 1;
fi

# Parameters
SOURCE=$1

# Get source image
if [ -z "${SOURCE}" ]; then
echo "No source image specified, searching in current directory...\c"
SOURCE=$( ls *.png | head -n1 )
if [ -z "${SOURCE}" ]; then
echo "No source image specified and none found."
exit 1;
else
echo "FOUND";
fi
fi


# File Infrastructure
NAME=$(basename "${SOURCE}")
EXT="${NAME##*.}"
BASE="${NAME%.*}"
ICONSET="${BASE}.iconset"

# Debug Info
echo "SOURCE: ${SOURCE}"
echo "NAME: $NAME"
echo "BASE: $BASE"
echo "EXT: $EXT"
echo "ICONSET: $ICONSET"

# Get source image info
SRCWIDTH=$( $SIPS -g pixelWidth "${SOURCE}" | tail -n1 | awk '{print $2}')
SRCHEIGHT=$( $SIPS -g pixelHeight "${SOURCE}" | tail -n1 | awk '{print $2}' )
SRCFORMAT=$( $SIPS -g format "${SOURCE}" | tail -n1 | awk '{print $2}' )

# Debug Info
echo "SRCWIDTH: $SRCWIDTH"
echo "SRCHEIGHT: $SRCHEIGHT"
echo "SRCFORMAT: $SRCFORMAT"

# Check The Source Image
if [ "x${SRCWIDTH}" != "x1024" ] || [ "x${SRCHEIGHT}" != "x1024" ]; then
echo "ERR: Source image should be 1024 x 1024 pixels." >&2
exit 1;
fi
if [ "x${SRCFORMAT}" != "xpng" ]; then
echo "ERR: Source image format should be png." >&2
exit 1;
fi

# Resample image into iconset
mkdir "${ICONSET}"
$SIPS -s format png --resampleWidth 1024 "${SOURCE}" --out "${ICONSET}/icon_512x512@2x.png" > /dev/null 2>&1
$SIPS -s format png --resampleWidth 512 "${SOURCE}" --out "${ICONSET}/icon_512x512.png" > /dev/null 2>&1
cp "${ICONSET}/icon_512x512.png" "${ICONSET}/icon_256x256@2x.png"
$SIPS -s format png --resampleWidth 256 "${SOURCE}" --out "${ICONSET}/icon_256x256.png" > /dev/null 2>&1
cp "${ICONSET}/icon_256x256.png" "${ICONSET}/icon_128x128@2x.png"
$SIPS -s format png --resampleWidth 128 "${SOURCE}" --out "${ICONSET}/icon_128x128.png" > /dev/null 2>&1
$SIPS -s format png --resampleWidth 64 "${SOURCE}" --out "${ICONSET}/icon_32x32@2x.png" > /dev/null 2>&1
$SIPS -s format png --resampleWidth 32 "${SOURCE}" --out "${ICONSET}/icon_32x32.png" > /dev/null 2>&1
cp "${ICONSET}/icon_32x32.png" "${ICONSET}/icon_16x16@2x.png"
$SIPS -s format png --resampleWidth 16 "${SOURCE}" --out "${ICONSET}/icon_16x16.png" > /dev/null 2>&1

# Create an icns file from the iconset
$ICONUTIL -c icns "${ICONSET}"

# Clean up the iconset
rm -rf "${ICONSET}"
19 changes: 4 additions & 15 deletions browser/main.js
Expand Up @@ -4,34 +4,23 @@ const BrowserWindow = electron.BrowserWindow;
const Menu = electron.Menu;

var menu = require('./menu');
var argv = require('optimist').argv;

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow;



// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
let mainWindow;
app.on('ready', function() {
// Create the browser window.
mainWindow = new BrowserWindow({
center: true,
title: 'JBrowseDesktop',
width: 1024,
height: 768
});
var queryString = Object.keys(argv).map(key => key + '=' + argv[key]).join('&');

// and load the index.html of the app.
mainWindow.loadURL('file://' + require('path').resolve(__dirname, '..', 'index.html'));
// Emitted when the window is closed.
mainWindow.loadURL('file://' + require('path').resolve(__dirname, '../index.html?'+queryString));
Menu.setApplicationMenu(Menu.buildFromTemplate(menu));

mainWindow.on('closed', function () {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null;
});
});
Expand Down
52 changes: 27 additions & 25 deletions build/Makefile
Expand Up @@ -19,41 +19,43 @@ RELEASE_DESKTOP_LINUX = $(RELEASE_NAME)-desktop-linux
ZIP=zip -q --symlinks -r
UNZIP=unzip -q
SHASUM=shasum
ELECTRON_VERSION=1.8.4


all: clean release

release: release-dev release-min release-notes.html
release: release-dev release-min release-electron-all release-notes.html
ls -lh *.zip
$(SHASUM) *.zip

release-electron-darwin: release
cd $(RELEASE_MIN)&&./setup.sh legacy&&cd ..
npm install
electron-packager $(RELEASE_MIN) JBrowseDesktop --platform=darwin --arch=x64
$(ZIP) $(RELEASE_DESKTOP_OSX).zip JBrowseDesktop-darwin-x64

release-electron-all: release
echo "Building desktop packages..."
cd $(RELEASE_MIN)&&./setup.sh legacy&&cd ..
npm install
# build all versions
# electron-packager $(RELEASE_MIN) JBrowseDesktop --platform=all --arch=x64
# build specific versions
electron-packager $(RELEASE_MIN) JBrowseDesktop --platform=darwin --arch=x64
electron-packager $(RELEASE_MIN) JBrowseDesktop --platform=win32 --arch=ia32
# zap files that cause problems on windows (because of colons in filenames)
find JBrowseDesktop-win32-ia32 -type f -name "*.3pm" -delete &> /dev/null
# zip packages
$(ZIP) $(RELEASE_DESKTOP_OSX).zip JBrowseDesktop-darwin-x64
$(ZIP) $(RELEASE_DESKTOP_WIN).zip JBrowseDesktop-win32-ia32
# $(ZIP) $(RELEASE_DESKTOP_LINUX).zip JBrowseDesktop-linux-x64
release-electron-setup:
echo "Setting up electron"
cd $(RELEASE_MIN) && cp -r ../node_modules ../extlib . && ./setup.sh && cd ..
cp -R browser $(RELEASE_MIN)

release-electron-darwin: clean release-min release-electron-setup
echo "Building mac electron"
npx electron-packager $(RELEASE_MIN) $(RELEASE_MIN)-desktop --platform=darwin --electron-version=$(ELECTRON_VERSION) --icon=browser/icons/jbrowse
$(ZIP) $(RELEASE_MIN)-desktop-darwin-x64.zip $(RELEASE_MIN)-desktop-darwin-x64

release-electron-win32: clean release-min release-electron-setup
echo "Building win32 electron"
npx electron-packager $(RELEASE_MIN) $(RELEASE_MIN)-desktop --platform=win32 --electron-version=$(ELECTRON_VERSION) --icon=browser/icons/jbrowse
$(ZIP) $(RELEASE_MIN)-desktop-win32-x64.zip $(RELEASE_MIN)-desktop-win32-x64

release-electron-linux: clean release-min release-electron-setup
echo "Building linux electron"
npx electron-packager $(RELEASE_MIN) $(RELEASE_MIN)-desktop --platform=linux --electron-version=$(ELECTRON_VERSION) --icon=browser/icons/jbrowse
$(ZIP) $(RELEASE_MIN)-desktop-linux-x64.zip $(RELEASE_MIN)-desktop-linux-x64

release-electron-all: release-electron-darwin release-electron-win32 release-electron-linux
echo "Building desktop packages"

release-notes.html: release-notes.txt
build/format_release_notes.pl $< > $@

node_modules:
npm install
yarn install

release-dev: $(JS_SRCFILES) node_modules
rm -rf dist
Expand All @@ -64,7 +66,7 @@ release-dev: $(JS_SRCFILES) node_modules
# zip up the dev release
$(ZIP) $(RELEASE_FULL).zip $(RELEASE_FULL)/;

release-min: $(JS_SRCFILES) node_modules
release-min: release-dev
cp -a $(RELEASE_FULL_DIR) $(RELEASE_MIN_DIR);

for P in src browser css docs/jsdoc tests build node_modules extlib dist; do \
Expand All @@ -91,4 +93,4 @@ release-min: $(JS_SRCFILES) node_modules
clean:
git clean -ffdxq --exclude=/plugins/ --exclude=/node_modules/ --exclude=/extlib/

.PHONY: all clean jbrowse docs doc release release-min release-dev plugins-min
.PHONY: all clean jbrowse docs doc release release-min release-dev plugins-min release-electron-all release-electron-linux release-electron-win32 release-electron-darwin
14 changes: 9 additions & 5 deletions index.html
Expand Up @@ -12,12 +12,15 @@
<meta name="msapplication-TileColor" content="#2d89ef">
<meta name="theme-color" content="#ffffff">

<script type="text/javascript" src="dist/main.bundle.js" charset="utf-8"></script>
<script type="text/javascript">
window.onerror=function(msg){
if( document.body )
document.body.setAttribute("JSError",msg);
}
if(window.process&&process.versions&&process.versions.electron) {
window.electronRequire = require;
delete window.require;
}
</script>
<style>
html, body, div.jbrowse {
Expand All @@ -27,14 +30,15 @@
width: 100%;
}
</style>
<script type="text/javascript" src="dist/main.bundle.js" charset="utf-8"></script>
</head>

<body>
<div class="jbrowse" id="GenomeBrowser">
<div id="LoadingScreen" style="padding: 50px;">
<h1>Loading...</h1>
</div>
</div>
<div id="LoadingScreen" style="padding: 50px;">
<h1>Loading...</h1>
</div>
</div>
<div style="display: none">JBrowseDefaultMainPage</div>
</body>
</html>
18 changes: 15 additions & 3 deletions package.json
Expand Up @@ -5,7 +5,12 @@
"description": "JBrowse - client-side genome browser",
"repository": "https://github.com/GMOD/jbrowse.git",
"scripts": {
"test": "phantomjs tests/js_tests/run-jasmine.js http://localhost:8082/tests/js_tests/index.html",
"test": "npm run test-phantom",
"test-all": "npm run build && npm run test-phantom && npm run test-perl && npm run test-electron && npm run test-selenium",
"test-phantom": "phantomjs tests/js_tests/run-jasmine.js http://localhost:8082/tests/js_tests/index.html",
"test-electron": "ava --timeout=60s tests/electron_tests",
"test-perl": "prove -Isrc/perl5 -j8 -lr tests/perl_tests/",
"test-selenium": "SELENIUM_BROWSER=firefox JBROWSE_URL='http://localhost:8082/index.html' nosetests --verbose tests/selenium_tests/",
"start": "utils/jb_run.js -p 8082",
"watch": "webpack -w",
"build": "webpack",
Expand All @@ -29,11 +34,13 @@
"express": "^4.15.4",
"fs-extra": "^4.0.1",
"node-getopt": "^0.2.3",
"optimist": "^0.6.1",
"shelljs": "^0.7.8"
},
"devDependencies": {
"@gmod/gff": "^1.1.1",
"ajv": "^6.2.1",
"ava": "^0.25.0",
"babel-core": "^6.26.0",
"babel-eslint": "^8.2.2",
"babel-loader": "^7.1.4",
Expand All @@ -49,7 +56,9 @@
"dojo-util": "1.13.0",
"dojo-webpack-plugin": "^2.7.2",
"dojox": "1.13.0",
"electron-screenshot": "^1.0.2",
"electron": "^2.0.0",
"electron-packager": "^12.0.1",
"electron-screenshot": "^1.0.5",
"eslint": "^4.19.1",
"eslint-config-airbnb-base": "^12.1.0",
"eslint-plugin-import": "^2.10.0",
Expand All @@ -63,12 +72,15 @@
"regexp-replace-loader": "^1.0.1",
"sass-loader": "^6.0.7",
"snake-case": "^2.1.0",
"spectron": "^3.8.0",
"spectron-fake-dialog": "^0.0.1",
"style-loader": "^0.20.2",
"tribble-index": "^1.0.1",
"tmp": "^0.0.33",
"uglifyjs-webpack-plugin": "^1.2.2",
"url-loader": "0.5.7",
"util-deprecate": "^1.0.2",
"webpack": "^3.10.0",
"yarn": "^1.5.1"
"yarn": "^1.6.0"
}
}
3 changes: 3 additions & 0 deletions release-notes.txt
Expand Up @@ -25,6 +25,9 @@
* The Perl formatting tools now properly read `include`-ed configuration files. Thanks to @carrere
for pointing out this bug. (issue #551, @rbuels)

* Re-enabled JBrowse Desktop builds based on automatically building on Travis-CI
(issue #1028, @cmdcolin)

# Release 1.14.0 2018-04-18 15:14:58 UTC

## Major improvements
Expand Down
5 changes: 0 additions & 5 deletions setup.sh
Expand Up @@ -173,11 +173,6 @@ log_echo -n "Formatting Volvox example data ...";
bin/flatfile-to-json.pl --bed docs/tutorial/data_files/volvox_segment.bed --out sample_data/json/volvox --trackLabel ChromHMM --trackType CanvasFeatures --clientConfig '{"color": "{chromHMM}", "strandArrow": false}' --config '{"displayMode": "collapsed", "enableCollapsedMouseover": true, "category": "Miscellaneous" }';
bin/generate-names.pl --safeMode -v --out sample_data/json/volvox;

# also recreate some symlinks used by tests and such
if [ -d sample_data/json/modencode ]; then
mkdir -p sample_data/json/modencode/tracks;
ln -sf ../../volvox/tracks/volvox_microarray.wig sample_data/json/modencode/tracks/volvox_microarray.wig;
fi;
mkdir -p sample_data/raw;
if [ ! -e sample_data/raw/volvox ]; then
ln -s ../../docs/tutorial/data_files sample_data/raw/volvox;
Expand Down

0 comments on commit 99c8522

Please sign in to comment.