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 and Travis-CI as our automated build service.
AppVeyor
We use AppVeyor for our windows builds. See below for an example of appveyor.yml
environment:
nodejs_version: 5.5.0
platform:
- x64
- x86
shallow_clone: true
skip_non_tags: true
install:
- ps: Install-Product node $env:nodejs_version $env:Platform
- node --version
- npm --version
- node -e "console.log(process.arch);"
- FOR /F "delims=" %%a IN ('node -e "console.log(require('./package.json').version)"') DO SET PACKAGE_VERSION=%%~a
- SET PATH=C:\Program Files (x86)\MSBuild\12.0\bin\;%PATH%
- SET GYP_MSVS_VERSION=2013
- if "%PLATFORM%" == "x64" set PATH=C:\Python27-x64;%PATH%
- if "%PLATFORM%" == "x86" SET PATH=C:\python27;%PATH%
- npm install --build-from-source --production
- npm install meshblu-connector-packager
- npm dedupe
- npm install -g flatten-packages
- flatten-packages
- ps: >-
if($env:platform -eq "x86") {
$env:PACKAGER_ARCH="386"
} else {
$env:PACKAGER_ARCH="amd64"
}
- npm run package
- ps: $root = Resolve-Path deploy; [IO.Directory]::GetFiles($root.Path, '*.*', 'AllDirectories') | % { Push-AppveyorArtifact $_ -FileName $_.Substring($root.Path.Length + 1) -DeploymentName Connector }
build: off
test: off
deploy:
- provider: GitHub
description: 'Meshblu Connector Bundle'
auth_token:
secure: [appveyor-github-oauth-key]
artifact: Connector
draft: false
prerelease: false
on:
branch: master
appveyor_repo_tag: true
Travis CI
We use Travis for building on Linux and macOS. See below for an example .travis.yml
configuration.
language: cpp
os:
- linux
- osx
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
- g++-4.8-multilib
- gcc-multilib
- build-essential
- libbluetooth-dev
- libudev-dev
- libusb-1.0-0-dev
env:
matrix:
- PACKAGER_NODE_VERSION="5.5" PACKAGER_ARCH="amd64" MAIN_BUILD="true"
- PACKAGER_NODE_VERSION="5.5" PACKAGER_ARCH="386"
matrix:
exclude:
- os: osx
env: PACKAGER_NODE_VERSION="5.5" PACKAGER_ARCH="386"
branches:
only:
- "/^v[0-9]/"
before_install:
- PACKAGER_URL="https://meshblu-connector.octoblu.com/tools/packager/latest"
- curl -fsS "${PACKAGER_URL}/travis_install_node.sh" -o /tmp/travis_install_node.sh
- chmod +x /tmp/travis_install_node.sh
- ". /tmp/travis_install_node.sh"
- if [ "$TRAVIS_OS_NAME" == "linux" -a "$MAIN_BUILD" == "true" ]; then export NPM_PUBLISH="true"; fi
install:
- npm install --build-from-source
script:
- npm test
before_deploy:
- npm install --build-from-source --production
- npm install meshblu-connector-packager
- npm dedupe
- npm install -g flatten-packages
- flatten-packages
- npm run package
deploy:
- provider: releases
api_key:
secure: [appveyor-encrypted-github-oauth-key]
file_glob: true
file:
- "deploy/*"
skip_cleanup: true
on:
tags: true
- provider: npm
email: [email protected]
api_key:
secure: [travis-encrypted-npm-api-key]
on:
tags: true
condition: "$NPM_PUBLISH = true"
Updated less than a minute ago