diff --git a/.travis.yml b/.travis.yml index cc5f2913b0..d184869297 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,70 @@ -language: node_js -node_js: 'node' +cache: + directories: + - node_modules + - $HOME/.cache/electron + - $HOME/.cache/electron-builder -script: - - npm run all \ No newline at end of file +jobs: + include: + - stage: test + node_js: node + language: node_js + script: "npm run all" + - stage: "distro [windows+linux]" + os: linux + services: docker + language: generic + script: + - | + docker run --rm \ + --env-file <(env | grep -E 'DEBUG|NODE_|ELECTRON_|NPM_|CI|TRAVIS|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 i && npm run build -- --win --linux --publish" + - stage: "distro [macos]" + os: osx + osx_image: xcode9 + node_js: node + language: node_js + env: + - ELECTRON_CACHE=$HOME/.cache/electron + - ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder + script: npm run build -- --mac --publish + - stage: "nightly build [windows+linux]" + os: linux + services: docker + language: generic + script: + - | + docker run --rm \ + --env-file <(env | grep -E 'DEBUG|NODE_|ELECTRON_|NPM_|CI|TRAVIS|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 i && npm run build -- --win --linux --nightly --no-publish" + - stage: "nightly build [macos]" + os: osx + osx_image: xcode9 + node_js: node + language: node_js + env: + - ELECTRON_CACHE=$HOME/.cache/electron + - ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder + script: 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/client/Gruntfile.js b/client/Gruntfile.js index a5fa9027fe..2253477bdd 100644 --- a/client/Gruntfile.js +++ b/client/Gruntfile.js @@ -149,7 +149,7 @@ module.exports = function(grunt) { grunt.registerTask('auto-test', [ 'karma:unit' ]); - grunt.registerTask('build-client', [ + grunt.registerTask('build', [ 'browserify:client', 'less', 'copy' @@ -157,7 +157,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 bfc7753b1e..0909903bb6 100644 --- a/client/package.json +++ b/client/package.json @@ -7,6 +7,7 @@ "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 e0160b9d3f..9cbcf2ea8f 100644 --- a/electron-builder.json +++ b/electron-builder.json @@ -1,15 +1,9 @@ { - "artifactName": "${productName}-${version}-${os}-${arch}.${ext}", + "appId": "com.camunda.CamundaModeler", + "productName": "Camunda Modeler", "directories": { "output": "distro" }, - "extraFiles": [ - { - "from": "resources/platform/base", - "to": ".", - "filter": [ "**/*" ] - } - ], "files": [ { "filter": [ @@ -34,7 +28,7 @@ ] }, "linux": { - "category": "Education", + "category": "Development", "target": [ { "target": "tar.gz", diff --git a/package.json b/package.json index 64c65c99c5..67d67079f8 100644 --- a/package.json +++ b/package.json @@ -6,19 +6,19 @@ "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", - "release-nightly": "lerna publish --skip-git --skip-npm --canary=nightly --yes", "test": "run-s *:test" }, "author": "Camunda ", diff --git a/resources/platform/base/LICENSE_APP b/resources/platform/base/LICENSE_APP index 1394ce32c8..9413dc0785 100644 --- a/resources/platform/base/LICENSE_APP +++ b/resources/platform/base/LICENSE_APP @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2015 camunda Services GmbH +Copyright (c) 2015-present camunda Services GmbH Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/tasks/distro.js b/tasks/distro.js index 329e55cd4f..980ddce3b1 100644 --- a/tasks/distro.js +++ b/tasks/distro.js @@ -1,5 +1,6 @@ #!/usr/bin/env node -const argv = require('yargs').argv + +const argv = require('yargs').argv; const exec = require('execa').sync; @@ -12,30 +13,53 @@ const { publish } = argv; -const availablePlatforms = { - win: 1, - linux: 1, - mac: 1 -}; - -var 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); +const replaceVersion = nightlyVersion + ? s => s.replace('${version}', 'nightly') + : s => s; + +const artifactOptions = [ + '-c.artifactName=${name}-${version}-${os}-${arch}.${ext}', + '-c.dmg.artifactName=${name}-${version}-${os}.${ext}', + '-c.nsis.artifactName=${name}-${version}-${os}-setup.${ext}', + '-c.nsisWeb.artifactName=${name}-${version}-${os}-web-setup.${ext}' +].map(replaceVersion); + +// interpret shorthand target options +// --win, --linux, --mac +const platforms = [ + argv.win ? 'win' : null, + argv.linux ? 'linux': null, + argv.mac ? 'mac' : null +].filter(f => f); const platformOptions = platforms.map(p => `--${p}`); @@ -58,15 +82,17 @@ const args = [ ...archOptions, ...signingOptions, ...platformOptions, - ...nightlyOptions, - ...publishOptions + ...publishOptions, + ...artifactOptions ]; console.log(` Building ${pkg.name} distro +--- + version: ${nightlyVersion || pkg.version} - platforms: [${ platforms }] + platforms: [${ platforms.length && platforms || 'current' }] publish: ${publish || false} ---