[MM-18135] use no sandbox, separate linting, circle 2.1 (#1029)

* [MM-18135] use no sandbox, separate linting, circle 2.1

* [MM-18135] merge lint and test step, use -quiet, clarify changing debugging port
This commit is contained in:
Guillermo Vayá
2019-09-06 22:44:52 +02:00
committed by GitHub
parent 32b747ab30
commit 304d26cece
4 changed files with 61 additions and 28 deletions

View File

@@ -1,17 +1,55 @@
version: 2
jobs:
build:
version: 2.1
executors:
wine-chrome:
working_directory: ~/mattermost-desktop
docker:
- image: electronuserland/builder:wine-chrome
wine-mono:
working_directory: ~/mattermost-desktop
docker:
- image: electronuserland/builder:wine-mono
commands:
update_image:
description: "Update base image"
parameters:
apt_opts:
type: string
default: ""
steps:
- run: apt-get update && apt-get -y install << parameters.apt_opts >>
- run: npm install
jobs:
check:
executor: wine-chrome
steps:
- checkout
- update_image:
apt_opts: "--no-install-recommends"
- restore_cache:
key: lint-{{ arch }}-{{ .Branch }}-{{ checksum "package-lock.json" }}
- run: npm run lint:js-quiet
- run: ELECTRON_DISABLE_SANDBOX=1 xvfb-run npm run test:app
- run: mkdir -p /tmp/test-results
- run: cp test-results.xml /tmp/test-results/
- store_test_results:
path: /tmp/test-results
- save_cache:
key: lint-{{ arch }}-{{ .Branch }}-{{ checksum "package-lock.json" }}
paths:
- "node_modules"
- "src/node_modules"
build:
executor: wine-mono
steps:
- checkout
- restore_cache:
key: npm-{{ arch }}-{{ .Branch }}-{{ checksum "package-lock.json" }}
- restore_cache:
key: npm-{{ arch }}-{{ .Branch }}-{{ checksum "src/package-lock.json" }}
- run: apt-get update && apt-get -y install --no-install-recommends jq icnsutils graphicsmagick tzdata
- run: npm install
- update_image:
apt_opts: "--no-install-recommends jq icnsutils graphicsmagick tzdata"
- run: npm run build
- run: npm run package:windows
- run: jq '.mac.target=["zip"]' electron-builder.json > /tmp/electron-builder.json && cp /tmp/electron-builder.json .
@@ -19,7 +57,6 @@ jobs:
- run: npm run package:linux
- run: mkdir -p /tmp/artifacts
- run: sh -x ./scripts/cp_artifacts.sh release /tmp/artifacts
- run: npm run lint:js
- save_cache:
key: npm-{{ arch }}-{{ .Branch }}-{{ checksum "package-lock.json" }}
paths:
@@ -38,24 +75,11 @@ jobs:
path: storybook/
destination: storybook
test:
working_directory: ~/mattermost-desktop
docker:
- image: electronuserland/builder:wine-chrome
steps:
- checkout
- run: apt-get update && apt-get -y install --no-install-recommends libgconf-2-4
- run: npm install
# https://github.com/SeleniumHQ/docker-selenium/issues/222#issuecomment-221307583
- run: DBUS_SESSION_BUS_ADDRESS=/dev/null xvfb-run npm test
- run: mkdir -p /tmp/test-results
- run: cp test-results.xml /tmp/test-results/
- store_test_results:
path: /tmp/test-results
workflows:
version: 2
build_and_test:
jobs:
- build
- test
- check
- build:
requires:
- check

View File

@@ -25,13 +25,14 @@
"watch": "run-p watch:*",
"watch:main": "node scripts/watch_main_and_preload.js",
"watch:renderer": "webpack-dev-server --config webpack.config.renderer.js",
"test": "npm-run-all test:* lint:*",
"test": "npm-run-all lint:js test:*",
"test:app": "cross-env NODE_ENV=production npm run build && mocha -r @babel/register --reporter mocha-circleci-reporter --recursive test/specs",
"package:all": "cross-env NODE_ENV=production npm-run-all check-build-config package:windows package:mac package:linux",
"package:windows": "cross-env NODE_ENV=production npm-run-all check-build-config build && build --win --x64 --ia32 --publish=never",
"package:mac": "cross-env NODE_ENV=production npm-run-all check-build-config build && build --mac --publish=never",
"package:linux": "cross-env NODE_ENV=production npm-run-all check-build-config build && build --linux --x64 --ia32 --publish=never",
"lint:js": "eslint --ignore-path .gitignore --ignore-pattern node_modules --ext .js --ext .jsx .",
"lint:js-quiet": "eslint --ignore-path .gitignore --ignore-pattern node_modules --ext .js --ext .jsx . --quiet",
"fix:js": "eslint --ignore-path .gitignore --ignore-pattern node_modules --quiet --ext .js --ext .jsx . --fix",
"check-build-config": "node -r @babel/register scripts/check_build_config.js"
},
@@ -51,7 +52,7 @@
"cross-env": "^5.2.0",
"css-loader": "^1.0.1",
"devtron": "^1.4.0",
"electron": "^5.0.4",
"electron": "^5.0.10",
"electron-builder": "^20.44.4",
"electron-connect": "^0.6.3",
"eslint": "^5.9.0",

View File

@@ -49,10 +49,19 @@ module.exports = {
},
getSpectronApp() {
return new Application({
const options = {
path: electronBinaryPath,
args: [`${path.join(sourceRootDir, 'src')}`, `--data-dir=${userDataDir}`, '--disable-dev-mode'],
});
// enable this if chromedriver hangs to see logs
// chromeDriverLogPath: '../chromedriverlog.txt',
};
if (process.platform === 'darwin') {
// on a mac, debbuging port might conflict with other apps
// this changes the default debugging port so chromedriver can run without issues.
options.chromeDriverArgs.push('remote-debugging-port=9222');
}
return new Application(options);
},
addClientCommands(client) {

View File

@@ -27,7 +27,6 @@ describe('application', function desc() {
await this.app.client.waitUntilWindowLoaded();
const count = await this.app.client.getWindowCount();
count.should.equal(1);
const opened = await this.app.browserWindow.isDevToolsOpened();
opened.should.be.false;