diff --git a/packages/grpc-native-core/tools/docker/alpine_artifact/Dockerfile b/packages/grpc-native-core/tools/docker/alpine_artifact/Dockerfile new file mode 100644 index 00000000..0674654a --- /dev/null +++ b/packages/grpc-native-core/tools/docker/alpine_artifact/Dockerfile @@ -0,0 +1,2 @@ +FROM node:8-alpine +RUN apk add --no-cache python curl bash build-base diff --git a/packages/grpc-native-core/tools/run_tests/artifacts/build_all_linux_artifacts.sh b/packages/grpc-native-core/tools/run_tests/artifacts/build_all_linux_artifacts.sh new file mode 100755 index 00000000..2d34d4d7 --- /dev/null +++ b/packages/grpc-native-core/tools/run_tests/artifacts/build_all_linux_artifacts.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Copyright 2017 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +source ~/.nvm/nvm.sh + +nvm install 8 +set -ex + +cd $(dirname $0) +tool_dir=$(pwd) +cd $tool_dir/../../.. +base_dir=$(pwd) + +export ARTIFACTS_OUT=$base_dir/artifacts + +rm -rf build || true + +mkdir -p "${ARTIFACTS_OUT}" + +docker build -t alpine_node_artifact $base_dir/tools/docker/alpine_artifact + +$tool_dir/build_artifact_node.sh + +$tool_dir/build_artifact_node_arm.sh + +docker run -e ARTIFACTS_OUT=/var/grpc/artifacts -v $base_dir:/var/grpc alpine_node_artifact bash -c /var/grpc/tools/run_tests/artifacts/build_artifact_node.sh --with-alpine diff --git a/packages/grpc-native-core/tools/run_tests/artifacts/build_artifact_node.bat b/packages/grpc-native-core/tools/run_tests/artifacts/build_artifact_node.bat index 9563da7d..a3323684 100644 --- a/packages/grpc-native-core/tools/run_tests/artifacts/build_artifact_node.bat +++ b/packages/grpc-native-core/tools/run_tests/artifacts/build_artifact_node.bat @@ -12,6 +12,8 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. +set arch_list=ia32 x64 + set node_versions=4.0.0 5.0.0 6.0.0 7.0.0 8.0.0 9.0.0 set electron_versions=1.0.0 1.1.0 1.2.0 1.3.0 1.4.0 1.5.0 1.6.0 1.7.0 @@ -24,21 +26,23 @@ call npm update || goto :error mkdir -p %ARTIFACTS_OUT% -for %%v in (%node_versions%) do ( - call .\node_modules\.bin\node-pre-gyp.cmd configure build --target=%%v --target_arch=%1 +for %%a in (%arch_list%) do ( + for %%v in (%node_versions%) do ( + call .\node_modules\.bin\node-pre-gyp.cmd configure build --target=%%v --target_arch=%%a -@rem Try again after removing openssl headers - rmdir "%USERPROFILE%\.node-gyp\%%v\include\node\openssl" /S /Q - rmdir "%USERPROFILE%\.node-gyp\iojs-%%v\include\node\openssl" /S /Q - call .\node_modules\.bin\node-pre-gyp.cmd build package --target=%%v --target_arch=%1 || goto :error + @rem Try again after removing openssl headers + rmdir "%USERPROFILE%\.node-gyp\%%v\include\node\openssl" /S /Q + rmdir "%USERPROFILE%\.node-gyp\iojs-%%v\include\node\openssl" /S /Q + call .\node_modules\.bin\node-pre-gyp.cmd build package --target=%%v --target_arch=%%a || goto :error - xcopy /Y /I /S build\stage\* %ARTIFACTS_OUT%\ || goto :error -) + xcopy /Y /I /S build\stage\* %ARTIFACTS_OUT%\ || goto :error + ) -for %%v in (%electron_versions%) do ( - cmd /V /C "set "HOME=%USERPROFILE%\electron-gyp" && call .\node_modules\.bin\node-pre-gyp.cmd configure rebuild package --runtime=electron --target=%%v --target_arch=%1 --disturl=https://atom.io/download/electron" || goto :error + for %%v in (%electron_versions%) do ( + cmd /V /C "set "HOME=%USERPROFILE%\electron-gyp" && call .\node_modules\.bin\node-pre-gyp.cmd configure rebuild package --runtime=electron --target=%%v --target_arch=%%a --disturl=https://atom.io/download/electron" || goto :error - xcopy /Y /I /S build\stage\* %ARTIFACTS_OUT%\ || goto :error + xcopy /Y /I /S build\stage\* %ARTIFACTS_OUT%\ || goto :error + ) ) if %errorlevel% neq 0 exit /b %errorlevel% diff --git a/packages/grpc-native-core/tools/run_tests/artifacts/build_artifact_node.sh b/packages/grpc-native-core/tools/run_tests/artifacts/build_artifact_node.sh index 3b4d0456..d8128863 100755 --- a/packages/grpc-native-core/tools/run_tests/artifacts/build_artifact_node.sh +++ b/packages/grpc-native-core/tools/run_tests/artifacts/build_artifact_node.sh @@ -13,12 +13,24 @@ # See the License for the specific language governing permissions and # limitations under the License. -NODE_TARGET_ARCH=$1 -NODE_TARGET_OS=$2 -source ~/.nvm/nvm.sh +NODE_ALPINE_BUILD=false -nvm use 8 -set -ex +while true ; do + case $1 in + --with-alpine) + NODE_ALPINE_BUILD=true + ;; + "") + ;; + *) + echo "Unknown parameter: $1" + exit 1 + ;; + esac + shift || break +done + +NODE_ALPINE_BUILD=$1 umask 022 @@ -30,24 +42,25 @@ mkdir -p "${ARTIFACTS_OUT}" npm update +arch_list=( ia32 x64 ) + node_versions=( 4.0.0 5.0.0 6.0.0 7.0.0 8.0.0 9.0.0 ) electron_versions=( 1.0.0 1.1.0 1.2.0 1.3.0 1.4.0 1.5.0 1.6.0 1.7.0 ) -for version in ${node_versions[@]} +for arch in ${arch_list[@]} do - ./node_modules/.bin/node-pre-gyp configure rebuild package --target=$version --target_arch=$NODE_TARGET_ARCH --grpc_alpine=true - cp -r build/stage/* "${ARTIFACTS_OUT}"/ - if [ "$NODE_TARGET_ARCH" == 'x64' ] && [ "$NODE_TARGET_OS" == 'linux' ] - then - # Cross compile for ARM on x64 - CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ LD=arm-linux-gnueabihf-g++ ./node_modules/.bin/node-pre-gyp configure rebuild package testpackage --target=$version --target_arch=arm + for version in ${node_versions[@]} + do + ./node_modules/.bin/node-pre-gyp configure rebuild package --target=$version --target_arch=$arch --grpc_alpine=$NODE_ALPINE_BUILD cp -r build/stage/* "${ARTIFACTS_OUT}"/ - fi + done + + for version in ${electron_versions[@]} + do + HOME=~/.electron-gyp ./node_modules/.bin/node-pre-gyp configure rebuild package --runtime=electron --target=$version --target_arch=$arch --disturl=https://atom.io/download/electron + cp -r build/stage/* "${ARTIFACTS_OUT}"/ + done done -for version in ${electron_versions[@]} -do - HOME=~/.electron-gyp ./node_modules/.bin/node-pre-gyp configure rebuild package --runtime=electron --target=$version --target_arch=$NODE_TARGET_ARCH --disturl=https://atom.io/download/electron - cp -r build/stage/* "${ARTIFACTS_OUT}"/ -done +rm -rf build || true diff --git a/packages/grpc-native-core/tools/run_tests/artifacts/build_artifact_node_arm.sh b/packages/grpc-native-core/tools/run_tests/artifacts/build_artifact_node_arm.sh new file mode 100755 index 00000000..b33f8dec --- /dev/null +++ b/packages/grpc-native-core/tools/run_tests/artifacts/build_artifact_node_arm.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# Copyright 2017 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +source ~/.nvm/nvm.sh + +nvm use 8 +set -ex + +cd $(dirname $0)/../../.. + +rm -rf build || true + +mkdir -p "${ARTIFACTS_OUT}" + +npm update + +node_versions=( 4.0.0 5.0.0 6.0.0 7.0.0 8.0.0 9.0.0 ) + +for version in ${node_versions[@]} +do + # Cross compile for ARM on x64 + CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ LD=arm-linux-gnueabihf-g++ ./node_modules/.bin/node-pre-gyp configure rebuild package testpackage --target=$version --target_arch=arm + cp -r build/stage/* "${ARTIFACTS_OUT}"/ +done