{"_id":"576ab80f42bf703200c59640","category":{"_id":"57683306d8067e1900fc823d","__v":0,"project":"5764745b4f867c0e002bc8ed","version":"5764745b4f867c0e002bc8f0","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-06-20T18:16:38.236Z","from_sync":false,"order":3,"slug":"development","title":"Development"},"version":{"_id":"5764745b4f867c0e002bc8f0","project":"5764745b4f867c0e002bc8ed","__v":4,"createdAt":"2016-06-17T22:06:19.667Z","releaseDate":"2016-06-17T22:06:19.667Z","categories":["5764745b4f867c0e002bc8f1","57683255bb15f40e00a288ce","57683306d8067e1900fc823d","57694b8f47693a0e00002b19"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"__v":1,"githubsync":"","project":"5764745b4f867c0e002bc8ed","parentDoc":null,"user":"5564f227f0f70f0d00a9ab20","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-06-22T16:08:47.932Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"In order to pre-compile our a connector we require every connector to be automatically be built, tested and deployed to Github Releases.\n\nWe have had good success using [AppVeyor](http://www.appveyor.com/) and [Travis-CI](https://travis-ci.org/) as our automated build service.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"AppVeyor\"\n}\n[/block]\nWe use AppVeyor for our windows builds. See below for an example of appveyor.yml\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"environment:\\n  nodejs_version: 5.5.0\\nplatform:\\n  - x64\\n  - x86\\nshallow_clone: true\\nskip_non_tags: true\\ninstall:\\n  - ps: Install-Product node $env:nodejs_version $env:Platform\\n  - node --version\\n  - npm --version\\n  - node -e \\\"console.log(process.arch);\\\"\\n  - FOR /F \\\"delims=\\\" %%a IN ('node -e \\\"console.log(require('./package.json').version)\\\"') DO SET PACKAGE_VERSION=%%~a\\n  - SET PATH=C:\\\\Program Files (x86)\\\\MSBuild\\\\12.0\\\\bin\\\\;%PATH%\\n  - SET GYP_MSVS_VERSION=2013\\n  - if \\\"%PLATFORM%\\\" == \\\"x64\\\" set PATH=C:\\\\Python27-x64;%PATH%\\n  - if \\\"%PLATFORM%\\\" == \\\"x86\\\" SET PATH=C:\\\\python27;%PATH%\\n  - npm install --build-from-source --production\\n  - npm install meshblu-connector-packager\\n  - npm dedupe\\n  - npm install -g flatten-packages\\n  - flatten-packages\\n  - ps: >-\\n      if($env:platform -eq \\\"x86\\\") {\\n        $env:PACKAGER_ARCH=\\\"386\\\"\\n      } else {\\n        $env:PACKAGER_ARCH=\\\"amd64\\\"\\n      }\\n  - npm run package\\n  - ps: $root = Resolve-Path deploy; [IO.Directory]::GetFiles($root.Path, '*.*', 'AllDirectories') | % { Push-AppveyorArtifact $_ -FileName $_.Substring($root.Path.Length + 1) -DeploymentName Connector }\\nbuild: off\\ntest: off\\ndeploy:\\n- provider: GitHub\\n  description: 'Meshblu Connector Bundle'\\n  auth_token:\\n    secure: [appveyor-github-oauth-key]\\n  artifact: Connector\\n  draft: false\\n  prerelease: false\\n  on:\\n    branch: master\\n    appveyor_repo_tag: true\",\n      \"language\": \"yaml\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Travis CI\"\n}\n[/block]\nWe use Travis for building on Linux and macOS. See below for an example `.travis.yml` configuration.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"language: cpp\\nos:\\n- linux\\n- osx\\naddons:\\n  apt:\\n    sources:\\n    - ubuntu-toolchain-r-test\\n    packages:\\n    - g++-4.8\\n    - g++-4.8-multilib\\n    - gcc-multilib\\n    - build-essential\\n    - libbluetooth-dev\\n    - libudev-dev\\n    - libusb-1.0-0-dev\\nenv:\\n  matrix:\\n  - PACKAGER_NODE_VERSION=\\\"5.5\\\" PACKAGER_ARCH=\\\"amd64\\\" MAIN_BUILD=\\\"true\\\"\\n  - PACKAGER_NODE_VERSION=\\\"5.5\\\" PACKAGER_ARCH=\\\"386\\\"\\nmatrix:\\n  exclude:\\n  - os: osx\\n    env: PACKAGER_NODE_VERSION=\\\"5.5\\\" PACKAGER_ARCH=\\\"386\\\"\\nbranches:\\n  only:\\n  - \\\"/^v[0-9]/\\\"\\nbefore_install:\\n- PACKAGER_URL=\\\"https://meshblu-connector.octoblu.com/tools/packager/latest\\\"\\n- curl -fsS \\\"${PACKAGER_URL}/travis_install_node.sh\\\" -o /tmp/travis_install_node.sh\\n- chmod +x /tmp/travis_install_node.sh\\n- \\\". /tmp/travis_install_node.sh\\\"\\n- if [ \\\"$TRAVIS_OS_NAME\\\" == \\\"linux\\\" -a \\\"$MAIN_BUILD\\\" == \\\"true\\\" ]; then export NPM_PUBLISH=\\\"true\\\"; fi\\ninstall:\\n- npm install --build-from-source\\nscript:\\n- npm test\\nbefore_deploy:\\n- npm install --build-from-source --production\\n- npm install meshblu-connector-packager\\n- npm dedupe\\n- npm install -g flatten-packages\\n- flatten-packages\\n- npm run package\\ndeploy:\\n- provider: releases\\n  api_key:\\n    secure: [appveyor-encrypted-github-oauth-key]\\n  file_glob: true\\n  file:\\n  - \\\"deploy/*\\\"\\n  skip_cleanup: true\\n  on:\\n    tags: true\\n- provider: npm\\n  email: serveradmin:::at:::octoblu.com\\n  api_key:\\n    secure: [travis-encrypted-npm-api-key]\\n  on:\\n    tags: true\\n    condition: \\\"$NPM_PUBLISH = true\\\"\",\n      \"language\": \"yaml\",\n      \"name\": null\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"deployment","type":"basic","title":"Deployment"}
In order to pre-compile our a connector we require every connector to be automatically be built, tested and deployed to Github Releases. We have had good success using [AppVeyor](http://www.appveyor.com/) and [Travis-CI](https://travis-ci.org/) as our automated build service. [block:api-header] { "type": "basic", "title": "AppVeyor" } [/block] We use AppVeyor for our windows builds. See below for an example of appveyor.yml [block:code] { "codes": [ { "code": "environment:\n nodejs_version: 5.5.0\nplatform:\n - x64\n - x86\nshallow_clone: true\nskip_non_tags: true\ninstall:\n - ps: Install-Product node $env:nodejs_version $env:Platform\n - node --version\n - npm --version\n - node -e \"console.log(process.arch);\"\n - FOR /F \"delims=\" %%a IN ('node -e \"console.log(require('./package.json').version)\"') DO SET PACKAGE_VERSION=%%~a\n - SET PATH=C:\\Program Files (x86)\\MSBuild\\12.0\\bin\\;%PATH%\n - SET GYP_MSVS_VERSION=2013\n - if \"%PLATFORM%\" == \"x64\" set PATH=C:\\Python27-x64;%PATH%\n - if \"%PLATFORM%\" == \"x86\" SET PATH=C:\\python27;%PATH%\n - npm install --build-from-source --production\n - npm install meshblu-connector-packager\n - npm dedupe\n - npm install -g flatten-packages\n - flatten-packages\n - ps: >-\n if($env:platform -eq \"x86\") {\n $env:PACKAGER_ARCH=\"386\"\n } else {\n $env:PACKAGER_ARCH=\"amd64\"\n }\n - npm run package\n - ps: $root = Resolve-Path deploy; [IO.Directory]::GetFiles($root.Path, '*.*', 'AllDirectories') | % { Push-AppveyorArtifact $_ -FileName $_.Substring($root.Path.Length + 1) -DeploymentName Connector }\nbuild: off\ntest: off\ndeploy:\n- provider: GitHub\n description: 'Meshblu Connector Bundle'\n auth_token:\n secure: [appveyor-github-oauth-key]\n artifact: Connector\n draft: false\n prerelease: false\n on:\n branch: master\n appveyor_repo_tag: true", "language": "yaml" } ] } [/block] [block:api-header] { "type": "basic", "title": "Travis CI" } [/block] We use Travis for building on Linux and macOS. See below for an example `.travis.yml` configuration. [block:code] { "codes": [ { "code": "language: cpp\nos:\n- linux\n- osx\naddons:\n apt:\n sources:\n - ubuntu-toolchain-r-test\n packages:\n - g++-4.8\n - g++-4.8-multilib\n - gcc-multilib\n - build-essential\n - libbluetooth-dev\n - libudev-dev\n - libusb-1.0-0-dev\nenv:\n matrix:\n - PACKAGER_NODE_VERSION=\"5.5\" PACKAGER_ARCH=\"amd64\" MAIN_BUILD=\"true\"\n - PACKAGER_NODE_VERSION=\"5.5\" PACKAGER_ARCH=\"386\"\nmatrix:\n exclude:\n - os: osx\n env: PACKAGER_NODE_VERSION=\"5.5\" PACKAGER_ARCH=\"386\"\nbranches:\n only:\n - \"/^v[0-9]/\"\nbefore_install:\n- PACKAGER_URL=\"https://meshblu-connector.octoblu.com/tools/packager/latest\"\n- curl -fsS \"${PACKAGER_URL}/travis_install_node.sh\" -o /tmp/travis_install_node.sh\n- chmod +x /tmp/travis_install_node.sh\n- \". /tmp/travis_install_node.sh\"\n- if [ \"$TRAVIS_OS_NAME\" == \"linux\" -a \"$MAIN_BUILD\" == \"true\" ]; then export NPM_PUBLISH=\"true\"; fi\ninstall:\n- npm install --build-from-source\nscript:\n- npm test\nbefore_deploy:\n- npm install --build-from-source --production\n- npm install meshblu-connector-packager\n- npm dedupe\n- npm install -g flatten-packages\n- flatten-packages\n- npm run package\ndeploy:\n- provider: releases\n api_key:\n secure: [appveyor-encrypted-github-oauth-key]\n file_glob: true\n file:\n - \"deploy/*\"\n skip_cleanup: true\n on:\n tags: true\n- provider: npm\n email: serveradmin@octoblu.com\n api_key:\n secure: [travis-encrypted-npm-api-key]\n on:\n tags: true\n condition: \"$NPM_PUBLISH = true\"", "language": "yaml", "name": null } ] } [/block]