Skip to content

Commit

Permalink
Update builder to support both Node v8 and v10. (WebThingsIO#11)
Browse files Browse the repository at this point in the history
* Update builder to support both Node v8 and v10.

* Limit v10 add-ons.

* Disable zwave-adapter on v10.
  • Loading branch information
mrstegeman authored and hobinjk committed May 24, 2019
1 parent 50fa783 commit a7159f1
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 12 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ dist: trusty
sudo: required

language: node_js
node_js: 8
node_js:
- 8
- 10

os:
- linux
Expand Down
2 changes: 1 addition & 1 deletion build-adapter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ SCRIPT_NAME=$(basename $0)
ADDON_ARCH="$1"

NVM_VERSION="v0.33.8"
NODE_VERSION="--lts"
NODE_VERSION="$2"

if [ -z "${ADDON_ARCH}" ]; then
echo "Usage: ${SCRIPTNAME} addon-arch"
Expand Down
45 changes: 35 additions & 10 deletions build-addons.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

set -e

NODE_VERSION=$(node --version | cut -d. -f1 | sed 's/^v//')

if [ -z "${TRAVIS_OS_NAME}" ]; then
# This means we're running locally. Fake out TRAVIS_OS_NAME.
UNAME=$(uname -s)
Expand Down Expand Up @@ -57,15 +59,38 @@ mkdir -p builder

if [ -z "${ADAPTERS}" ]; then
# No adapters were provided via the environment, build them all
ADAPTERS=(
gpio-adapter
homekit-adapter
microblocks-adapter
serial-adapter
thing-url-adapter
zigbee-adapter
zwave-adapter
)
case "${NODE_VERSION}" in
8)
ADAPTERS=(
gpio-adapter
homekit-adapter
microblocks-adapter
serial-adapter
thing-url-adapter
zigbee-adapter
zwave-adapter
)
;;
10)
# Disable adapters which depend on noble for now, as it fails to build
# with Node v10.
#
# See: https://github.com/noble/noble/issues/805
#
# Also, disable zwave-adapter, as openzwave-shared needs to be updated
# to work with Node v10.
ADAPTERS=(
gpio-adapter
microblocks-adapter
serial-adapter
zigbee-adapter
)
;;
*)
echo "Unsupported NODE_VERSION = ${NODE_VERSION}"
exit 1
;;
esac
fi

for ADDON_ARCH in ${ADDON_ARCHS}; do
Expand All @@ -75,7 +100,7 @@ for ADDON_ARCH in ${ADDON_ARCHS}; do
RPXC=
fi
for ADAPTER in ${ADAPTERS[@]}; do
${RPXC} bash -c "cd ${ADAPTER}; ../build-adapter.sh ${ADDON_ARCH}"
${RPXC} bash -c "cd ${ADAPTER}; ../build-adapter.sh ${ADDON_ARCH} ${NODE_VERSION}"
done
done

Expand Down

0 comments on commit a7159f1

Please sign in to comment.