summaryrefslogtreecommitdiff
path: root/platform/node
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2015-12-16 14:05:23 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2015-12-16 17:49:22 -0800
commit7a4e7376e1422964cb7a456f772104e28003f4d2 (patch)
treed5f2c11bf309f94a7e595f785f66ed02454e4e79 /platform/node
parenta903d2eef022518ad579312555bf82272093e01a (diff)
downloadqtlocation-mapboxgl-7a4e7376e1422964cb7a456f772104e28003f4d2.tar.gz
Move platform scripts into platforms
Diffstat (limited to 'platform/node')
-rwxr-xr-xplatform/node/scripts/after_script.sh51
-rwxr-xr-xplatform/node/scripts/create_node_scheme.sh8
-rwxr-xr-xplatform/node/scripts/install.sh28
-rw-r--r--platform/node/scripts/node.xcscheme98
-rwxr-xr-xplatform/node/scripts/run.sh31
5 files changed, 216 insertions, 0 deletions
diff --git a/platform/node/scripts/after_script.sh b/platform/node/scripts/after_script.sh
new file mode 100755
index 0000000000..af2cd78dd6
--- /dev/null
+++ b/platform/node/scripts/after_script.sh
@@ -0,0 +1,51 @@
+#!/bin/bash
+
+set -e
+set -o pipefail
+
+# Inspect binary.
+if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then
+ ldd ./lib/mapbox-gl-native.node
+else
+ otool -L ./lib/mapbox-gl-native.node
+fi
+
+COMMIT_MESSAGE=$(git show -s --format=%B $TRAVIS_COMMIT | tr -d '\n')
+PACKAGE_JSON_VERSION=$(node -e "console.log(require('./package.json').version)")
+
+if [[ ${TRAVIS_TAG} == node-v${PACKAGE_JSON_VERSION} ]] || test "${COMMIT_MESSAGE#*'[publish binary]'}" != "$COMMIT_MESSAGE"; then
+ source ~/.nvm/nvm.sh
+ nvm use $NODE_VERSION
+
+ npm install aws-sdk
+
+ ./node_modules/.bin/node-pre-gyp package
+
+ if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then
+ ./node_modules/.bin/node-pre-gyp testpackage
+ fi
+
+ ./node_modules/.bin/node-pre-gyp publish info
+
+ if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then
+ source ./platform/linux/scripts/setup.sh
+
+ rm -rf build
+ rm -rf lib
+ npm install --fallback-to-build=false
+ npm test
+ fi
+fi
+
+if [[ ${TRAVIS_OS_NAME} == "linux" ]] && [ ! -z "${AWS_ACCESS_KEY_ID}" ] && [ ! -z "${AWS_SECRET_ACCESS_KEY}" ] ; then
+ # Install and add awscli to PATH for uploading the results
+ pip install --user awscli
+ export PATH="`python -m site --user-base`/bin:${PATH}"
+
+ REPO_NAME=$(basename $TRAVIS_REPO_SLUG)
+ gzip --stdout node_modules/mapbox-gl-test-suite/render-tests/index.html | \
+ aws s3 cp --acl public-read --content-encoding gzip --content-type text/html \
+ - s3://mapbox/$REPO_NAME/render-tests/$TRAVIS_JOB_NUMBER/index.html
+
+ echo http://mapbox.s3.amazonaws.com/$REPO_NAME/render-tests/$TRAVIS_JOB_NUMBER/index.html
+fi
diff --git a/platform/node/scripts/create_node_scheme.sh b/platform/node/scripts/create_node_scheme.sh
new file mode 100755
index 0000000000..5b97918aea
--- /dev/null
+++ b/platform/node/scripts/create_node_scheme.sh
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+NAME=$1
+shift
+CMD=$@
+DIR="build/binding.xcodeproj/xcshareddata/xcschemes"
+mkdir -p "${DIR}"
+
+sed "s#{{NODE_PATH}}#$(dirname `which node`)#;s#{{BLUEPRINT_IDENTIFIER}}#$(hexdump -n 12 -v -e '/1 "%02X"' /dev/urandom)#;s#{{WORKING_DIRECTORY}}#$(pwd)#;s#{{NODE_ARGUMENT}}#${CMD}#" platform/node/scripts/node.xcscheme > "${DIR}/${NAME}.xcscheme"
diff --git a/platform/node/scripts/install.sh b/platform/node/scripts/install.sh
new file mode 100755
index 0000000000..1edc2c91d9
--- /dev/null
+++ b/platform/node/scripts/install.sh
@@ -0,0 +1,28 @@
+#!/usr/bin/env bash
+
+set -e
+set -o pipefail
+
+mapbox_time "checkout_mason" \
+git submodule update --init .mason
+
+export PATH="`pwd`/.mason:${PATH}" MASON_DIR="`pwd`/.mason"
+
+if [ ${TRAVIS_OS_NAME} == "linux" ]; then
+ mapbox_time "install_mesa" \
+ mason install mesa 10.4.3
+fi
+
+if [ ! -d ~/.nvm ]; then
+ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.28.0/install.sh | bash
+fi
+
+source ~/.nvm/nvm.sh
+
+mapbox_time $NODE_VERSION \
+nvm install $NODE_VERSION
+
+nvm alias default $NODE_VERSION
+
+node --version
+npm --version
diff --git a/platform/node/scripts/node.xcscheme b/platform/node/scripts/node.xcscheme
new file mode 100644
index 0000000000..52a89fb81f
--- /dev/null
+++ b/platform/node/scripts/node.xcscheme
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+ LastUpgradeVersion = "0700"
+ version = "1.3">
+ <BuildAction
+ parallelizeBuildables = "YES"
+ buildImplicitDependencies = "YES">
+ <BuildActionEntries>
+ <BuildActionEntry
+ buildForTesting = "YES"
+ buildForRunning = "YES"
+ buildForProfiling = "YES"
+ buildForArchiving = "YES"
+ buildForAnalyzing = "YES">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "{{BLUEPRINT_IDENTIFIER}}"
+ BuildableName = "action_after_build"
+ BlueprintName = "action_after_build"
+ ReferencedContainer = "container:build/binding.xcodeproj">
+ </BuildableReference>
+ </BuildActionEntry>
+ </BuildActionEntries>
+ </BuildAction>
+ <TestAction
+ buildConfiguration = "Debug"
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ shouldUseLaunchSchemeArgsEnv = "YES">
+ <Testables>
+ </Testables>
+ <AdditionalOptions>
+ </AdditionalOptions>
+ </TestAction>
+ <LaunchAction
+ buildConfiguration = "Debug"
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ launchStyle = "0"
+ useCustomWorkingDirectory = "YES"
+ customWorkingDirectory = "{{WORKING_DIRECTORY}}"
+ ignoresPersistentStateOnLaunch = "NO"
+ debugDocumentVersioning = "YES"
+ debugServiceExtension = "internal"
+ allowLocationSimulation = "YES">
+ <PathRunnable
+ runnableDebuggingMode = "0"
+ FilePath = "{{NODE_PATH}}/node">
+ </PathRunnable>
+ <MacroExpansion>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "{{BLUEPRINT_IDENTIFIER}}"
+ BuildableName = "action_after_build"
+ BlueprintName = "action_after_build"
+ ReferencedContainer = "container:build/binding.xcodeproj">
+ </BuildableReference>
+ </MacroExpansion>
+ <CommandLineArguments>
+ <CommandLineArgument
+ argument = "{{NODE_ARGUMENT}}"
+ isEnabled = "YES">
+ </CommandLineArgument>
+ </CommandLineArguments>
+ <EnvironmentVariables>
+ <EnvironmentVariable
+ key = "PATH"
+ value = "{{NODE_PATH}}:$PATH"
+ isEnabled = "YES">
+ </EnvironmentVariable>
+ </EnvironmentVariables>
+ <AdditionalOptions>
+ </AdditionalOptions>
+ </LaunchAction>
+ <ProfileAction
+ buildConfiguration = "Release"
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ savedToolIdentifier = ""
+ useCustomWorkingDirectory = "NO"
+ debugDocumentVersioning = "YES">
+ <MacroExpansion>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "{{BLUEPRINT_IDENTIFIER}}"
+ BuildableName = "action_after_build"
+ BlueprintName = "action_after_build"
+ ReferencedContainer = "container:build/binding.xcodeproj">
+ </BuildableReference>
+ </MacroExpansion>
+ </ProfileAction>
+ <AnalyzeAction
+ buildConfiguration = "Debug">
+ </AnalyzeAction>
+ <ArchiveAction
+ buildConfiguration = "Release"
+ revealArchiveInOrganizer = "YES">
+ </ArchiveAction>
+</Scheme>
diff --git a/platform/node/scripts/run.sh b/platform/node/scripts/run.sh
new file mode 100755
index 0000000000..07395d6a69
--- /dev/null
+++ b/platform/node/scripts/run.sh
@@ -0,0 +1,31 @@
+#!/usr/bin/env bash
+
+set -e
+set -o pipefail
+
+source ./platform/${TRAVIS_OS_NAME}/scripts/setup.sh
+
+BUILDTYPE=${BUILDTYPE:-Release}
+
+################################################################################
+# Build
+################################################################################
+
+source ~/.nvm/nvm.sh
+nvm use $NODE_VERSION
+
+mapbox_time "compile_program" \
+npm install --build-from-source
+
+################################################################################
+# Test
+################################################################################
+
+# Travis OS X has no GPU
+if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then
+ mapbox_time "run_tests" \
+ npm test
+
+ mapbox_time "run_render_tests" \
+ npm run test-suite
+fi