Skip to content

Commit

Permalink
Splitting node and electron builds.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasnoble committed Jan 17, 2019
1 parent 591c5b9 commit 3593bb6
Show file tree
Hide file tree
Showing 22 changed files with 328 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ npm install -g node-gyp

DO_NATIVE=true
DO_CROSS=true
DO_ELECTRON=true
DO_NODEJS=true

while [ $# -gt 0 ] ; do
case $1 in
Expand All @@ -30,6 +32,14 @@ while [ $# -gt 0 ] ; do
;;
--cross-only)
DO_NATIVE=false
DO_ELECTRON=false
;;
--electron-only)
DO_NODEJS=false
DO_CROSS=false
;;
--nodejs-only)
DO_ELECTRON=false
;;
esac
shift
Expand All @@ -50,7 +60,12 @@ rm -rf build || true
mkdir -p "${ARTIFACTS_OUT}"

if [ "$DO_NATIVE" = "true" ] ; then
$tool_dir/build_artifact_node.sh
if [ "$DO_ELECTRON" = "true" ] ; then
$tool_dir/build_artifact_electron.sh
fi
if [ "$DO_NODEJS" = "true" ] ; then
$tool_dir/build_artifact_node.sh
fi
fi

if [ "$DO_CROSS" = "true" ] ; then
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
@rem Copyright 2016 gRPC authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem http://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.

set arch_list=ia32 x64

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 1.8.0 2.0.0 3.0.0 4.0.0

set PATH=%PATH%;C:\Program Files\nodejs\;%APPDATA%\npm

set JOBS=8

del /f /q BUILD || rmdir build /s /q

call npm update || goto :error

mkdir -p %ARTIFACTS_OUT%

for %%a in (%arch_list%) do (
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
rmdir build /S /Q
)
)
if %errorlevel% neq 0 exit /b %errorlevel%

goto :EOF

:error
exit /b 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash
# Copyright 2016 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.

set -ex

arch_list=( ia32 x64 )
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 1.8.0 2.0.0 3.0.0 4.0.0 )

umask 022

cd $(dirname $0)/../../..

rm -rf build || true

mkdir -p "${ARTIFACTS_OUT}"

npm update

for arch in ${arch_list[@]}
do
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

rm -rf build || true
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ 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 10.0.0 11.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 1.8.0 2.0.0 3.0.0 4.0.0

set PATH=%PATH%;C:\Program Files\nodejs\;%APPDATA%\npm

set JOBS=8
Expand All @@ -40,13 +38,6 @@ for %%a in (%arch_list%) do (
xcopy /Y /I /S build\stage\* %ARTIFACTS_OUT%\ || goto :error
rmdir build /S /Q
)

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
rmdir build /S /Q
)
)
if %errorlevel% neq 0 exit /b %errorlevel%

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@ set -ex

arch_list=( ia32 x64 )
node_versions=( 4.0.0 5.0.0 6.0.0 7.0.0 8.0.0 9.0.0 10.0.0 11.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 1.8.0 2.0.0 3.0.0 4.0.0 )

while true ; do
case $1 in
--with-alpine)
arch_list=( x64 )
electron_versions=( )
;;
"")
;;
Expand Down Expand Up @@ -52,12 +50,6 @@ do
./node_modules/.bin/node-pre-gyp configure rebuild package --target=$version --target_arch=$arch
cp -r build/stage/* "${ARTIFACTS_OUT}"/
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

rm -rf build || true
19 changes: 19 additions & 0 deletions test/kokoro/linux-build-electron.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2018 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.

# Config file for Kokoro (in protobuf text format)

# Location of the continuous shell script in repository.
build_file: "grpc-node/tools/release/kokoro-electron.sh"
timeout_mins: 60
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
# Config file for Kokoro (in protobuf text format)

# Location of the continuous shell script in repository.
build_file: "grpc-node/tools/release/kokoro.sh"
build_file: "grpc-node/tools/release/kokoro-nodejs.sh"
timeout_mins: 60
19 changes: 19 additions & 0 deletions test/kokoro/macos-build-electron.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2018 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.

# Config file for Kokoro (in protobuf text format)

# Location of the continuous shell script in repository.
build_file: "grpc-node/tools/release/kokoro-electron.sh"
timeout_mins: 60
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
# Config file for Kokoro (in protobuf text format)

# Location of the continuous shell script in repository.
build_file: "grpc-node/tools/release/kokoro.sh"
build_file: "grpc-node/tools/release/kokoro-nodejs.sh"
timeout_mins: 60
19 changes: 19 additions & 0 deletions test/kokoro/windows-build-electron.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2018 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.

# Config file for Kokoro (in protobuf text format)

# Location of the continuous shell script in repository.
build_file: "grpc-node/tools/release/kokoro-electron.bat"
timeout_mins: 60
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
# Config file for Kokoro (in protobuf text format)

# Location of the continuous shell script in repository.
build_file: "grpc-node/tools/release/kokoro.bat"
build_file: "grpc-node/tools/release/kokoro-nodejs.bat"
timeout_mins: 60
42 changes: 42 additions & 0 deletions tools/release/kokoro-electron.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
@rem Copyright 2018 gRPC authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem http://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.

@echo "Starting Windows build"

powershell -c "& { iwr https://raw.githubusercontent.com/grumpycoders/nvm-ps/master/nvm.ps1 | iex }"

SET PATH=%APPDATA%\nvm-ps;%APPDATA%\nvm-ps\nodejs;%PATH%
call nvm install 10
call nvm use 10

call npm install -g npm
@rem https://github.com/mapbox/node-pre-gyp/issues/362
call npm install -g node-gyp

cd /d %~dp0
cd ..\..

git submodule update --init
git submodule foreach --recursive git submodule update --init

set ARTIFACTS_OUT=artifacts
cd packages\grpc-native-core
call tools\run_tests\artifacts\build_artifact_electron.bat || goto :error
cd ..\..

move packages\grpc-native-core\artifacts .
goto :EOF

:error
exit /b 1
48 changes: 48 additions & 0 deletions tools/release/kokoro-electron.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/sh
# Copyright 2018 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.

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

nvm install 10
nvm use 10
npm install -g npm
# https://github.com/mapbox/node-pre-gyp/issues/362
npm install -g node-gyp

set -ex
cd $(dirname $0)/../..
base_dir=$(pwd)

# Install gRPC and its submodules.
git submodule update --init
git submodule foreach --recursive git submodule update --init

pip install mako
./packages/grpc-native-core/tools/buildgen/generate_projects.sh

OS=`uname`

case $OS in
Linux)
docker build -t kokoro-native-image tools/release/native
docker run -v /var/run/docker.sock:/var/run/docker.sock -v $base_dir:$base_dir kokoro-native-image $base_dir/packages/grpc-native-core/tools/run_tests/artifacts/build_all_linux_artifacts.sh --native-only --electron-only
cp -rv packages/grpc-native-core/artifacts .
;;
Darwin)
JOBS=8 ARTIFACTS_OUT=$base_dir/artifacts ./packages/grpc-native-core/tools/run_tests/artifacts/build_artifact_electron.sh
;;
esac
File renamed without changes.
4 changes: 2 additions & 2 deletions tools/release/kokoro.sh → tools/release/kokoro-nodejs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ case $OS in
Linux)
docker build -t kokoro-native-image tools/release/native
docker build -t kokoro-cross-image tools/release/cross
docker run -v /var/run/docker.sock:/var/run/docker.sock -v $base_dir:$base_dir kokoro-native-image $base_dir/packages/grpc-native-core/tools/run_tests/artifacts/build_all_linux_artifacts.sh --native-only
docker run -v /var/run/docker.sock:/var/run/docker.sock -v $base_dir:$base_dir kokoro-native-image $base_dir/packages/grpc-native-core/tools/run_tests/artifacts/build_all_linux_artifacts.sh --native-only --nodejs-only
cp -rv packages/grpc-native-core/artifacts .
docker run -v /var/run/docker.sock:/var/run/docker.sock -v $base_dir:$base_dir kokoro-cross-image $base_dir/packages/grpc-native-core/tools/run_tests/artifacts/build_all_linux_artifacts.sh --cross-only
docker run -v /var/run/docker.sock:/var/run/docker.sock -v $base_dir:$base_dir kokoro-cross-image $base_dir/packages/grpc-native-core/tools/run_tests/artifacts/build_all_linux_artifacts.sh --cross-only --nodejs-only
cp -rv packages/grpc-native-core/artifacts .
;;
Darwin)
Expand Down
10 changes: 0 additions & 10 deletions tools/release/kokoro/Dockerfile

This file was deleted.

25 changes: 25 additions & 0 deletions tools/release/kokoro/linux-electron.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2018 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.

# Config file for Kokoro (in protobuf text format)

# Location of the continuous shell script in repository.
build_file: "grpc-node/tools/release/kokoro-electron.sh"
timeout_mins: 180
action {
define_artifacts {
regex: "github/grpc-node/artifacts/**",
strip_prefix: "github/grpc-node/artifacts"
}
}
Loading

0 comments on commit 3593bb6

Please sign in to comment.