mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-03-03 19:43:04 +08:00
Remove benchmark mode, npm scripts related to cloud codebase
This commit is contained in:
parent
555b4136b8
commit
c71d8fad72
14 changed files with 24 additions and 227 deletions
|
@ -51,7 +51,7 @@ install:
|
|||
- nvm use --delete-prefix $NODE_VERSION
|
||||
|
||||
script:
|
||||
- npm install && npm run build-client && npm run upload-client
|
||||
- npm install && npm run build && npm run upload
|
||||
|
||||
cache:
|
||||
directories:
|
||||
|
|
|
@ -26,9 +26,9 @@ build_script:
|
|||
|
||||
deploy_script:
|
||||
- ps: |
|
||||
npm run build-client
|
||||
npm run build
|
||||
node packages/client-app/build/create-signed-windows-installer.js
|
||||
npm run upload-client
|
||||
npm run upload
|
||||
|
||||
environment:
|
||||
matrix:
|
||||
|
|
26
package.json
26
package.json
|
@ -42,24 +42,14 @@
|
|||
"underscore": "1.8.x"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "npm run client",
|
||||
"test": "npm run test-client && npm run test-cloud",
|
||||
"client": "packages/client-app/node_modules/.bin/electron packages/client-app --enable-logging --dev",
|
||||
"benchmark": "packages/client-app/node_modules/.bin/electron packages/client-app --enable-logging --dev --benchmark",
|
||||
"test-client": "packages/client-app/node_modules/.bin/electron packages/client-app --enable-logging --test",
|
||||
"test-client-window": "packages/client-app/node_modules/.bin/electron packages/client-app --enable-logging --test=window",
|
||||
"test-client-junit": "",
|
||||
"lint-client": "grunt lint --gruntfile=packages/client-app/build/Gruntfile.js --base=./",
|
||||
"build-client": "grunt build-client --gruntfile=packages/client-app/build/Gruntfile.js --base=./",
|
||||
"upload-client": "grunt upload-client --gruntfile=packages/client-app/build/Gruntfile.js --base=./",
|
||||
"cloud": "pm2 stop all; pm2 delete all; pm2 start packages/cloud-core/pm2-dev.yml --no-daemon",
|
||||
"cloud-debug": "pm2 stop all; pm2 delete all; pm2 start packages/cloud-core/pm2-debug-cloud-api.yml --no-daemon",
|
||||
"test-cloud": "cd packages/cloud-api && npm test && cd ../cloud-core && npm test && cd ../cloud-workers && npm test",
|
||||
"stop": "npm run stop-cloud",
|
||||
"stop-cloud": "pm2 stop all; pm2 delete all;",
|
||||
"build-cloud": "docker build .",
|
||||
"postinstall": "node scripts/postinstall.js",
|
||||
"daily": "node scripts/daily.js"
|
||||
"start": "packages/client-app/node_modules/.bin/electron packages/client-app --enable-logging --dev",
|
||||
"test": "packages/client-app/node_modules/.bin/electron packages/client-app --enable-logging --test",
|
||||
"test-window": "packages/client-app/node_modules/.bin/electron packages/client-app --enable-logging --test=window",
|
||||
"test-junit": "",
|
||||
"lint": "grunt lint --gruntfile=packages/client-app/build/Gruntfile.js --base=./",
|
||||
"build": "grunt build-client --gruntfile=packages/client-app/build/Gruntfile.js --base=./",
|
||||
"upload": "grunt upload-client --gruntfile=packages/client-app/build/Gruntfile.js --base=./",
|
||||
"postinstall": "node scripts/postinstall.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
@ -96,6 +96,10 @@ We do have a few heuristics:
|
|||
changes that happened.
|
||||
- Read "[How to Write a Git Commit Message](http://chris.beams.io/posts/git-commit/)" if you haven't already (but don't be too prescriptivist about it!)
|
||||
|
||||
# Running Against Open Source Sync Engine
|
||||
# CoffeeScript
|
||||
|
||||
See [Configuration](https://github.com/nylas/nylas-mail/blob/master/CONFIGURATION.md)
|
||||
Nylas Mail was originally written in CoffeeScript. You can learn more about why [here](https://github.com/nylas/nylas-mail/issues/9).
|
||||
The codebase is slowly being converted to ES2016 JavaScript. To see progress
|
||||
check out [this spreadsheet](
|
||||
https://docs.google.com/spreadsheets/d/1DsZhrNEzCTBlsrPo82UkUxSgqj_fkGRcgTQ-lurnq7c/edit?usp=sharing
|
||||
)
|
|
@ -26,14 +26,13 @@ let clipboard = null;
|
|||
//
|
||||
export default class Application extends EventEmitter {
|
||||
async start(options) {
|
||||
const {resourcePath, configDirPath, version, devMode, specMode, benchmarkMode, safeMode} = options;
|
||||
const {resourcePath, configDirPath, version, devMode, specMode, safeMode} = options;
|
||||
|
||||
// Normalize to make sure drive letter case is consistent on Windows
|
||||
this.resourcePath = resourcePath;
|
||||
this.configDirPath = configDirPath;
|
||||
this.version = version;
|
||||
this.devMode = devMode;
|
||||
this.benchmarkMode = benchmarkMode;
|
||||
this.specMode = specMode;
|
||||
this.safeMode = safeMode;
|
||||
|
||||
|
@ -77,7 +76,6 @@ export default class Application extends EventEmitter {
|
|||
configDirPath: this.configDirPath,
|
||||
config: this.config,
|
||||
devMode: this.devMode,
|
||||
benchmarkMode: this.benchmarkMode,
|
||||
specMode: this.specMode,
|
||||
safeMode: this.safeMode,
|
||||
initializeInBackground: initializeInBackground,
|
||||
|
|
|
@ -23,9 +23,6 @@ const setupConfigDir = (args) => {
|
|||
if (args.specMode) {
|
||||
defaultDirName = "nylas-spec";
|
||||
}
|
||||
if (args.benchmarkMode) {
|
||||
defaultDirName = "nylas-bench";
|
||||
}
|
||||
const configDirPath = path.join(app.getPath('appData'), defaultDirName);
|
||||
mkdirp.sync(configDirPath);
|
||||
|
||||
|
@ -42,7 +39,6 @@ const setupErrorLogger = (args = {}) => {
|
|||
const errorLogger = new ErrorLogger({
|
||||
inSpecMode: args.specMode,
|
||||
inDevMode: args.devMode,
|
||||
inBenchmarkMode: args.benchmarkMode,
|
||||
resourcePath: args.resourcePath,
|
||||
});
|
||||
process.on('uncaughtException', errorLogger.reportError);
|
||||
|
@ -55,7 +51,6 @@ const declareOptions = (argv) => {
|
|||
const options = optimist(argv);
|
||||
options.usage("Nylas Mail v" + (app.getVersion()) + "\n\nUsage: nylas-mail [options]\n\nRun Nylas Mail: The open source extensible email client\n\n`nylas-mail --dev` to start the client in dev mode.\n\n`n1 --test` to run unit tests.");
|
||||
options.alias('d', 'dev').boolean('d').describe('d', 'Run in development mode.');
|
||||
options.alias('b', 'benchmark').boolean('b').describe('b', 'Run in benchmark mode.');
|
||||
options.alias('t', 'test').boolean('t').describe('t', 'Run the specified specs and exit with error code on failures.');
|
||||
options.boolean('safe').describe('safe', 'Do not load packages from ~/.nylas-mail/packages or ~/.nylas/dev/packages.');
|
||||
options.alias('h', 'help').boolean('h').describe('h', 'Print this usage message.');
|
||||
|
@ -81,8 +76,7 @@ const parseCommandLine = (argv) => {
|
|||
process.stdout.write(version + "\n");
|
||||
process.exit(0);
|
||||
}
|
||||
const devMode = args['dev'] || args['test'] || args['benchmark'];
|
||||
const benchmarkMode = args['benchmark'];
|
||||
const devMode = args['dev'] || args['test'];
|
||||
const logFile = args['log-file'];
|
||||
const specMode = args['test'];
|
||||
const jUnitXmlPath = args['junit-xml'];
|
||||
|
@ -130,7 +124,6 @@ const parseCommandLine = (argv) => {
|
|||
background,
|
||||
logFile,
|
||||
specMode,
|
||||
benchmarkMode,
|
||||
jUnitXmlPath,
|
||||
safeMode,
|
||||
configDirPath,
|
||||
|
|
|
@ -28,7 +28,6 @@ class NylasWindow
|
|||
pathToOpen,
|
||||
@isSpec,
|
||||
@devMode,
|
||||
@benchmarkMode,
|
||||
@windowKey,
|
||||
@safeMode,
|
||||
@neverClose,
|
||||
|
@ -84,7 +83,6 @@ class NylasWindow
|
|||
loadSettings.appVersion = app.getVersion()
|
||||
loadSettings.resourcePath = @resourcePath
|
||||
loadSettings.devMode ?= false
|
||||
loadSettings.benchmarkMode ?= false
|
||||
loadSettings.safeMode ?= false
|
||||
loadSettings.mainWindow ?= @mainWindow
|
||||
loadSettings.windowType ?= "default"
|
||||
|
|
|
@ -16,14 +16,13 @@ let winNum = 0;
|
|||
export default class WindowLauncher {
|
||||
static EMPTY_WINDOW = "emptyWindow"
|
||||
|
||||
constructor({devMode, benchmarkMode, safeMode, specMode, resourcePath, configDirPath, onCreatedHotWindow, config}) {
|
||||
constructor({devMode, safeMode, specMode, resourcePath, configDirPath, onCreatedHotWindow, config}) {
|
||||
this.defaultWindowOpts = {
|
||||
frame: process.platform !== "darwin",
|
||||
hidden: false,
|
||||
toolbar: true,
|
||||
devMode,
|
||||
safeMode,
|
||||
benchmarkMode,
|
||||
resizable: true,
|
||||
windowType: WindowLauncher.EMPTY_WINDOW,
|
||||
bootstrapScript: require.resolve("../secondary-window-bootstrap"),
|
||||
|
|
|
@ -9,7 +9,7 @@ const ONBOARDING_WINDOW = "onboarding"
|
|||
|
||||
export default class WindowManager {
|
||||
|
||||
constructor({devMode, benchmarkMode, safeMode, specMode, resourcePath, configDirPath, initializeInBackground, config}) {
|
||||
constructor({devMode, safeMode, specMode, resourcePath, configDirPath, initializeInBackground, config}) {
|
||||
this.initializeInBackground = initializeInBackground;
|
||||
this._windows = {};
|
||||
|
||||
|
@ -17,7 +17,7 @@ export default class WindowManager {
|
|||
this._registerWindow(win);
|
||||
this._didCreateNewWindow(win);
|
||||
}
|
||||
this.windowLauncher = new WindowLauncher({devMode, benchmarkMode, safeMode, specMode, resourcePath, configDirPath, config, onCreatedHotWindow});
|
||||
this.windowLauncher = new WindowLauncher({devMode, safeMode, specMode, resourcePath, configDirPath, config, onCreatedHotWindow});
|
||||
}
|
||||
|
||||
get(windowKey) {
|
||||
|
@ -215,7 +215,6 @@ export default class WindowManager {
|
|||
hidden: true,
|
||||
isSpec: true,
|
||||
devMode: true,
|
||||
benchmarkMode: false,
|
||||
toolbar: false,
|
||||
}
|
||||
|
||||
|
|
|
@ -172,7 +172,7 @@ export default class NylasEnvConstructor {
|
|||
const ActionBridge = require('./flux/action-bridge').default;
|
||||
const MailsyncBridge = require('./flux/mailsync-bridge').default;
|
||||
|
||||
const {devMode, benchmarkMode, safeMode, resourcePath, configDirPath, windowType} = this.getLoadSettings();
|
||||
const {devMode, safeMode, resourcePath, configDirPath, windowType} = this.getLoadSettings();
|
||||
const specMode = this.inSpecMode();
|
||||
|
||||
document.body.classList.add(`platform-${process.platform}`);
|
||||
|
@ -203,7 +203,7 @@ export default class NylasEnvConstructor {
|
|||
|
||||
this.keymaps = new KeymapManager({configDirPath, resourcePath});
|
||||
this.commands = new CommandRegistry();
|
||||
this.packages = new PackageManager({devMode, benchmarkMode, configDirPath, resourcePath, safeMode, specMode});
|
||||
this.packages = new PackageManager({devMode, configDirPath, resourcePath, safeMode, specMode});
|
||||
this.styles = new StyleManager();
|
||||
this.themes = new ThemeManager({packageManager: this.packages, configDirPath, resourcePath, safeMode});
|
||||
this.spellchecker = require('./spellchecker').default;
|
||||
|
@ -476,10 +476,6 @@ export default class NylasEnvConstructor {
|
|||
return this.getLoadSettings().devMode;
|
||||
}
|
||||
|
||||
inBenchmarkMode() {
|
||||
return this.getLoadSettings().benchmarkMode;
|
||||
}
|
||||
|
||||
// Public: Is the current window in safe mode?
|
||||
inSafeMode() {
|
||||
return this.getLoadSettings().safeMode;
|
||||
|
|
|
@ -1,50 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
function print_help {
|
||||
OUTPUT=$(cat <<- EOM
|
||||
|
||||
A script to benchmark the initial sync performance of Nylas Mail. To use,
|
||||
simply run the script after authing whatever accounts you wish to measure
|
||||
in your development version of Nylas Mail. The benchmarking script will
|
||||
clear all of the data except for your accounts and open and close Nylas
|
||||
Mail several times, printing out the number of messages synced after each
|
||||
iteration.
|
||||
)
|
||||
echo "$OUTPUT"
|
||||
}
|
||||
|
||||
if [[ $1 == '-h' || $1 == '--help' ]]
|
||||
then
|
||||
print_help
|
||||
exit 0
|
||||
fi
|
||||
|
||||
CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
NYLAS_DIR="$HOME/.nylas-bench"
|
||||
EDGEHILL_DB="$NYLAS_DIR/edgehill.db"
|
||||
TIME_LIMIT=120
|
||||
ITERS=5
|
||||
|
||||
for i in `seq 1 $ITERS`
|
||||
do
|
||||
bash $CWD/drop-data-except-accounts.sh > /dev/null
|
||||
|
||||
(npm run benchmark &> /dev/null &)
|
||||
|
||||
sleep $TIME_LIMIT
|
||||
|
||||
ELECTRON_PID=`ps aux | grep "Electron packages/client-app" | grep -v grep | awk '{print $2}'`
|
||||
kill -9 $ELECTRON_PID
|
||||
|
||||
MESSAGE_COUNT=`sqlite3 $EDGEHILL_DB 'SELECT COUNT(*) FROM Message'`
|
||||
echo "Synced Messages: $MESSAGE_COUNT"
|
||||
|
||||
# Sometimes it takes a while to shutdown
|
||||
while [[ $ELECTRON_PID != '' ]]
|
||||
do
|
||||
sleep 1
|
||||
ELECTRON_PID=`ps aux | grep "Electron packages/client-app" | grep -v grep | awk '{print $2}'`
|
||||
done
|
||||
done
|
|
@ -1,30 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
function get_next_commit() {
|
||||
local LAST_COMMIT=$1
|
||||
local NEXT_COMMIT=$(git log master ^$LAST_COMMIT --ancestry-path --pretty=oneline | cut -d" " -f1 | tail -n 1)
|
||||
echo "$NEXT_COMMIT"
|
||||
}
|
||||
|
||||
BENCHMARK_RESULTS_DIR="$HOME/.benchmark_results"
|
||||
mkdir -p $BENCHMARK_RESULTS_DIR
|
||||
|
||||
CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
cd $CWD/..
|
||||
|
||||
git checkout -q master
|
||||
git pull -q --rebase
|
||||
|
||||
LAST_COMMIT=$(cat $BENCHMARK_RESULTS_DIR/last_commit)
|
||||
NEXT_COMMIT=$(get_next_commit $LAST_COMMIT)
|
||||
|
||||
while [[ $NEXT_COMMIT != '' ]]
|
||||
do
|
||||
echo $NEXT_COMMIT
|
||||
git checkout -q $NEXT_COMMIT
|
||||
bash $CWD/benchmark-initial-sync.sh > "$BENCHMARK_RESULTS_DIR/$NEXT_COMMIT-results.txt"
|
||||
echo "$NEXT_COMMIT" > "$BENCHMARK_RESULTS_DIR/last_commit"
|
||||
NEXT_COMMIT=$(get_next_commit $NEXT_COMMIT)
|
||||
done
|
|
@ -1,30 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This just checks the time every 60 seconds to see if it should run the benchmarks.
|
||||
# This is a hack to work around cron's/automator's inability to start GUI apps
|
||||
# using `npm start`.
|
||||
|
||||
CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
BENCHMARK_SCRIPT=$CWD/benchmark-new-commits.sh
|
||||
UPLOAD_SCRIPT=$CWD/upload-benchmark-data.py
|
||||
BENCHMARK_RESULTS_DIR=$HOME/.benchmark_results
|
||||
TARGET_TIME="$1"
|
||||
|
||||
if [[ $# != 1 ]]
|
||||
then
|
||||
echo "Usage: run-once-per-day.sh '23:00'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
while [[ true ]]
|
||||
do
|
||||
CURRENT_TIME=$(date +"%H:%M")
|
||||
|
||||
if [[ $CURRENT_TIME = $TARGET_TIME ]]
|
||||
then
|
||||
/bin/bash $BENCHMARK_SCRIPT
|
||||
python $UPLOAD_SCRIPT $BENCHMARK_RESULTS_DIR
|
||||
fi
|
||||
sleep 60
|
||||
done
|
||||
|
|
@ -1,70 +0,0 @@
|
|||
import os
|
||||
import re
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
from dateutil.parser import parse as parse_datestr
|
||||
from glob import glob
|
||||
|
||||
import gspread
|
||||
|
||||
from oauth2client.service_account import ServiceAccountCredentials
|
||||
|
||||
scope = ['https://spreadsheets.google.com/feeds']
|
||||
|
||||
|
||||
def usage():
|
||||
print "./scripts/upload-benchmark-data.py <datadir>"
|
||||
|
||||
|
||||
def anymean(filename):
|
||||
output = subprocess.check_output(['./scripts/toolbox/any_mean.py', filename])
|
||||
if output == '':
|
||||
return 0.0, 0.0
|
||||
|
||||
# e.g. 'Synced Messages: 77.00 +-0.00'
|
||||
synced_messages, confidence_interval = re.match('^Synced Messages: ([0-9.]+) (\+-[0-9.]+)$', output).groups()
|
||||
return synced_messages, confidence_interval
|
||||
|
||||
|
||||
def update_spreadsheet(datadir):
|
||||
credentials = ServiceAccountCredentials.from_json_keyfile_name('client_secret.json', scope)
|
||||
gc = gspread.authorize(credentials)
|
||||
worksheet = gc.open("Nylas Mail Benchmarks").sheet1
|
||||
|
||||
filenames = []
|
||||
for filename in glob('{datadir}/*-results.txt'.format(datadir=datadir)):
|
||||
gitsha = re.match('^(.*)-results.txt$', os.path.basename(filename)).groups(0)[0]
|
||||
formatted_datetime = subprocess.check_output(['git', 'show', '-s', '--format=%ci', gitsha])
|
||||
parsed_datetime = parse_datestr(formatted_datetime)
|
||||
filenames.append((filename, gitsha, parsed_datetime))
|
||||
|
||||
new_data = []
|
||||
for filename, gitsha, parsed_datetime in sorted(filenames, key=lambda t: t[2]):
|
||||
synced_messages, confidence_interval = anymean(filename)
|
||||
row = (parsed_datetime.strftime("%Y-%m-%d %H:%M:%S"), gitsha, synced_messages, confidence_interval)
|
||||
new_data.append(row)
|
||||
print row
|
||||
|
||||
# TODO: might want to use the batch upload api in order to not run into rate-limits
|
||||
for i, new_row in enumerate(new_data):
|
||||
row_num = i+2
|
||||
existing_row = worksheet.range('A{row_num}:D{row_num}'.format(row_num=row_num))
|
||||
for j, cell in enumerate(existing_row):
|
||||
col_num = j+1
|
||||
cell.value = new_row[j]
|
||||
print "updating cell {row_num}:{col_num} with {val}".format(row_num=row_num, col_num=col_num, val=cell.value)
|
||||
worksheet.update_cells(existing_row)
|
||||
|
||||
|
||||
def main():
|
||||
if len(sys.argv) != 2:
|
||||
usage()
|
||||
return 1
|
||||
|
||||
datadir = sys.argv[1]
|
||||
update_spreadsheet(datadir)
|
||||
return 0
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
Loading…
Reference in a new issue