[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:
@@ -1,17 +1,55 @@
|
|||||||
version: 2
|
version: 2.1
|
||||||
jobs:
|
executors:
|
||||||
build:
|
wine-chrome:
|
||||||
|
working_directory: ~/mattermost-desktop
|
||||||
|
docker:
|
||||||
|
- image: electronuserland/builder:wine-chrome
|
||||||
|
wine-mono:
|
||||||
working_directory: ~/mattermost-desktop
|
working_directory: ~/mattermost-desktop
|
||||||
docker:
|
docker:
|
||||||
- image: electronuserland/builder:wine-mono
|
- 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:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
key: npm-{{ arch }}-{{ .Branch }}-{{ checksum "package-lock.json" }}
|
key: npm-{{ arch }}-{{ .Branch }}-{{ checksum "package-lock.json" }}
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
key: npm-{{ arch }}-{{ .Branch }}-{{ checksum "src/package-lock.json" }}
|
key: npm-{{ arch }}-{{ .Branch }}-{{ checksum "src/package-lock.json" }}
|
||||||
- run: apt-get update && apt-get -y install --no-install-recommends jq icnsutils graphicsmagick tzdata
|
- update_image:
|
||||||
- run: npm install
|
apt_opts: "--no-install-recommends jq icnsutils graphicsmagick tzdata"
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
- run: npm run package:windows
|
- run: npm run package:windows
|
||||||
- run: jq '.mac.target=["zip"]' electron-builder.json > /tmp/electron-builder.json && cp /tmp/electron-builder.json .
|
- 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: npm run package:linux
|
||||||
- run: mkdir -p /tmp/artifacts
|
- run: mkdir -p /tmp/artifacts
|
||||||
- run: sh -x ./scripts/cp_artifacts.sh release /tmp/artifacts
|
- run: sh -x ./scripts/cp_artifacts.sh release /tmp/artifacts
|
||||||
- run: npm run lint:js
|
|
||||||
- save_cache:
|
- save_cache:
|
||||||
key: npm-{{ arch }}-{{ .Branch }}-{{ checksum "package-lock.json" }}
|
key: npm-{{ arch }}-{{ .Branch }}-{{ checksum "package-lock.json" }}
|
||||||
paths:
|
paths:
|
||||||
@@ -38,24 +75,11 @@ jobs:
|
|||||||
path: storybook/
|
path: storybook/
|
||||||
destination: 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:
|
workflows:
|
||||||
version: 2
|
version: 2
|
||||||
build_and_test:
|
build_and_test:
|
||||||
jobs:
|
jobs:
|
||||||
- build
|
- check
|
||||||
- test
|
- build:
|
||||||
|
requires:
|
||||||
|
- check
|
||||||
|
@@ -25,13 +25,14 @@
|
|||||||
"watch": "run-p watch:*",
|
"watch": "run-p watch:*",
|
||||||
"watch:main": "node scripts/watch_main_and_preload.js",
|
"watch:main": "node scripts/watch_main_and_preload.js",
|
||||||
"watch:renderer": "webpack-dev-server --config webpack.config.renderer.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",
|
"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: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: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: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",
|
"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": "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",
|
"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"
|
"check-build-config": "node -r @babel/register scripts/check_build_config.js"
|
||||||
},
|
},
|
||||||
@@ -51,7 +52,7 @@
|
|||||||
"cross-env": "^5.2.0",
|
"cross-env": "^5.2.0",
|
||||||
"css-loader": "^1.0.1",
|
"css-loader": "^1.0.1",
|
||||||
"devtron": "^1.4.0",
|
"devtron": "^1.4.0",
|
||||||
"electron": "^5.0.4",
|
"electron": "^5.0.10",
|
||||||
"electron-builder": "^20.44.4",
|
"electron-builder": "^20.44.4",
|
||||||
"electron-connect": "^0.6.3",
|
"electron-connect": "^0.6.3",
|
||||||
"eslint": "^5.9.0",
|
"eslint": "^5.9.0",
|
||||||
|
@@ -49,10 +49,19 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
getSpectronApp() {
|
getSpectronApp() {
|
||||||
return new Application({
|
const options = {
|
||||||
path: electronBinaryPath,
|
path: electronBinaryPath,
|
||||||
args: [`${path.join(sourceRootDir, 'src')}`, `--data-dir=${userDataDir}`, '--disable-dev-mode'],
|
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) {
|
addClientCommands(client) {
|
||||||
|
@@ -27,7 +27,6 @@ describe('application', function desc() {
|
|||||||
await this.app.client.waitUntilWindowLoaded();
|
await this.app.client.waitUntilWindowLoaded();
|
||||||
const count = await this.app.client.getWindowCount();
|
const count = await this.app.client.getWindowCount();
|
||||||
count.should.equal(1);
|
count.should.equal(1);
|
||||||
|
|
||||||
const opened = await this.app.browserWindow.isDevToolsOpened();
|
const opened = await this.app.browserWindow.isDevToolsOpened();
|
||||||
opened.should.be.false;
|
opened.should.be.false;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user