diff --git a/.travis.yml b/.travis.yml index cc5f2913b0..f7da8fb3c3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,70 @@ -language: node_js -node_js: 'node' +language: + - node_js -script: - - npm run all \ No newline at end of file +node_js: + - node + +cache: + directories: + - node_modules + - $HOME/.cache/electron + - $HOME/.cache/electron-builder + +jobs: + include: + - stage: test + script: npm run all -- --x64 + - stage: "distro [windows+linux]" + os: linux + services: docker + language: generic + script: + - | + docker run --rm \ + --env-file <(env | grep -iE 'DEBUG|NODE_|ELECTRON_|YARN_|NPM_|CI|CIRCLE|TRAVIS|APPVEYOR_|WIN_CSC_|CSC_|_TOKEN|_KEY|AWS_|STRIP|BUILD_') \ + -v ${PWD}:/project \ + -v ~/.cache/electron:/root/.cache/electron \ + -v ~/.cache/electron-builder:/root/.cache/electron-builder \ + electronuserland/builder:wine \ + /bin/bash -c "npm install && npm run build -- --win --linux" + - stage: "distro [macos]" + os: osx + osx_image: xcode9 + env: + - ELECTRON_CACHE=$HOME/.cache/electron + - ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder + script: npm install && npm run build -- --mac + - stage: "nightly build [windows+linux]" + os: linux + services: docker + language: generic + script: + - | + docker run --rm \ + --env-file <(env | grep -iE 'DEBUG|NODE_|ELECTRON_|YARN_|NPM_|CI|CIRCLE|TRAVIS|APPVEYOR_|WIN_CSC_|CSC_|_TOKEN|_KEY|AWS_|STRIP|BUILD_') \ + -v ${PWD}:/project \ + -v ~/.cache/electron:/root/.cache/electron \ + -v ~/.cache/electron-builder:/root/.cache/electron-builder \ + electronuserland/builder:wine \ + /bin/bash -c "npm install && npm run build -- --win --linux --nightly --no-publish" + - stage: "nightly build [macos]" + os: osx + osx_image: xcode9 + env: + - ELECTRON_CACHE=$HOME/.cache/electron + - ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder + script: npm install && npm run build -- --mac --nightly --no-publish + +before_cache: + - rm -rf $HOME/.cache/electron-builder/wine + +stages: + - test + - name: "distro [windows+linux]" + if: tag =~ ^v\d + - name: "distro [macos]" + if: tag =~ ^v\d + - name: "nightly build [windows+linux]" + if: type IN (cron) + - name: "nightly build [macos]" + if: type IN (cron) \ No newline at end of file diff --git a/app/package.json b/app/package.json index 04d76a58e1..271a598dfc 100644 --- a/app/package.json +++ b/app/package.json @@ -1,6 +1,6 @@ { "name": "camunda-modeler", - "version": "1.14.0", + "version": "1.15.1", "description": "Camunda Modeler for BPMN, DMN and CMMN, based on bpmn.io", "private": true, "main": "lib/index.js", diff --git a/client/Gruntfile.js b/client/Gruntfile.js index bdc38a6682..fe9dc33eb1 100644 --- a/client/Gruntfile.js +++ b/client/Gruntfile.js @@ -128,7 +128,7 @@ module.exports = function(grunt) { grunt.registerTask('auto-test', [ 'karma:unit' ]); - grunt.registerTask('build-client', [ + grunt.registerTask('build', [ 'browserify:client', 'less', 'copy' @@ -136,7 +136,7 @@ module.exports = function(grunt) { grunt.registerTask('default', [ 'test', - 'build-client' + 'build' ]); grunt.registerTask('auto-build', [ diff --git a/client/package.json b/client/package.json index aff5b8f440..e298ebd953 100644 --- a/client/package.json +++ b/client/package.json @@ -1,12 +1,13 @@ { "name": "camunda-modeler-client", - "version": "1.14.0", + "version": "1.15.1", "description": "Camunda Modeler client application", "private": true, "scripts": { "test": "cross-env NODE_ENV=test grunt test", "auto-test": "cross-env NODE_ENV=test grunt auto-test", "all": "cross-env NODE_ENV=production grunt", + "build": "cross-env NODE_ENV=production grunt build", "dev": "cross-env NODE_ENV=development grunt auto-build" }, "dependencies": { diff --git a/electron-builder.json b/electron-builder.json index 40c29d81a0..1e7bfc0867 100644 --- a/electron-builder.json +++ b/electron-builder.json @@ -1,5 +1,6 @@ { - "artifactName": "${productName}-${version}-${os}-${arch}.${ext}", + "appId": "com.camunda.CamundaModeler", + "productName": "Camunda Modeler", "directories": { "output": "distro" }, @@ -24,6 +25,7 @@ "win": { "target": [ "nsis", + "nsis-web", "zip" ] }, diff --git a/package.json b/package.json index d795481883..ddade15732 100644 --- a/package.json +++ b/package.json @@ -6,15 +6,16 @@ "app:auto-test": "npm run app:test -- --watch", "app:dev": "electron app/dev", "app:test": "mocha -r ./app/test/expect --recursive app/test", - "client:all": "(cd client && npm run all)", + "client:build": "(cd client && npm run build)", "client:auto-test": "(cd client && npm run auto-test)", "client:dev": "(cd client && npm run dev)", "client:test": "(cd client && npm run test)", - "all": "run-s clean lint test client:all \"build -- {@}\" --", + "all": "run-s clean lint test \"build -- {@}\" --", "auto-test": "run-p *:auto-test", - "clean": "del distro/*", + "clean": "del 'distro/*' app/public", "dev": "run-p *:dev", "distro": "node tasks/distro.js", + "build": "run-s client:build \"distro -- {@}\" --", "lint": "eslint .", "postinstall": "lerna bootstrap", "release": "lerna publish", diff --git a/tasks/distro.js b/tasks/distro.js index 3826df613c..336b5eaddb 100644 --- a/tasks/distro.js +++ b/tasks/distro.js @@ -1,5 +1,21 @@ #!/usr/bin/env node -const argv = require('yargs').argv + +const argv = require('yargs') + .option('nightly', { + describe: 'build nightly distro', + type: 'boolean' + }) + .option('publish', { + describe: 'publish distro', + type: 'boolean' + }) + .option('targets', { + describe: 'target platforms to build distributions for', + coerce: function(val) { + return val.split(/,/g); + } + }) + .argv; const exec = require('execa').sync; @@ -12,46 +28,75 @@ const { publish } = argv; -const availablePlatforms = { - win: 1, - linux: 1, - mac: 1 -}; -var nightlyOptions = []; +let nightlyOptions = []; -let nightlyVersion = nightly && getVersion(pkg, nightly && { +let nightlyVersion = nightly && getVersion(pkg, { nightly: 'nightly' }); if (nightlyVersion) { nightlyOptions = [ - `-c.buildVersion=${nightlyVersion}`, '-c.artifactName=${productName}-${os}-${arch}.${ext}' ]; + + const publishNightlyArgs = [ + 'publish', + `--repo-version=${nightlyVersion}`, + '--skip-npm', + '--skip-git', + '--yes' + ]; + + console.log(` +Setting ${pkg.name} version to nightly + +--- + +lerna ${ publishNightlyArgs.join(' ') } + +--- +`); + + exec('lerna', publishNightlyArgs, { + stdio: 'inherit' + }); } -const platforms = - Object.keys(availablePlatforms) - .map(k => argv[k] && k) - .filter(k => k); +// interpret shorthand target options +// --win, --linux, --mac(os) +const platforms = argv.targets || [ + argv.win ? 'win' : null, + argv.linux ? 'linux': null, + (argv.macos || argv.mac) ? 'macos' : null +].filter(f => f); const platformOptions = platforms.map(p => `--${p}`); -const publishOptions = publish ? [ '--publish=always' ] : []; +const publishOptions = typeof publish !== undefined ? [ + `--publish=${ publish ? 'always' : 'never' }` +] : []; + +const archOptions = 'x64' in argv ? [ '--x64' ] : [ + '--ia32', + '--x64', +]; const args = [ + ...archOptions, ...platformOptions, - ...nightlyOptions, - ...publishOptions + ...publishOptions, + ...nightlyOptions ]; console.log(` Building ${pkg.name} distro +--- + version: ${nightlyVersion || pkg.version} - platforms: [${ platforms }] + platforms: [${ platforms.length && platforms || 'current' }] publish: ${publish || false} ---