diff --git a/.github/workflows/grpc-tools-build.yml b/.github/workflows/grpc-tools-build.yml new file mode 100644 index 00000000..f32a688c --- /dev/null +++ b/.github/workflows/grpc-tools-build.yml @@ -0,0 +1,72 @@ +name: grpc-tools Build + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + linux_build: + name: Linux grpc-tools Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - name: Build + run: | + docker build -t kokoro-native-image tools/release/native + docker run -v /var/run/docker.sock:/var/run/docker.sock -v $GITHUB_WORKSPACE:$GITHUB_WORKSPACE kokoro-native-image $GITHUB_WORKSPACE/packages/grpc-tools/build_binaries.sh + - uses: actions/upload-artifact@v2 + with: + name: grpc-tools_linux + path: artifacts/ + macos_build: + name: Macos grpc-tools Build + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - name: Build + run: packages/grpc-tools/build_binaries.sh + - uses: actions/upload-artifact@v2 + with: + name: grpc-tools_macos + path: artifacts/ + windows_build: + name: Windows grpc-tools Build + runs-on: windows-latest + strategy: + matrix: + arch: [ia32, x64] + env: + ARCH: ${{matrix.arch}} + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - name: Build + run: powershell -File ./packages/grpc-tools/build_binaries.ps1 + shell: cmd + - uses: actions/upload-artifact@v1 + with: + name: grpc-tools_windows_${{matrix.arch}} + path: artifacts/ + combine_artifacts: + name: Combine grpc-tools artifacts + runs-on: ubuntu-latest + needs: [linux_build, macos_build, windows_build] + steps: + - uses: actions/download-artifact@v2 + - name: Copy + run: | + mkdir artifacts + cp -r ./**/* artifacts/ + - uses: actions/upload-artifact@v2 + with: + name: combined-artifacts + path: artifacts/ diff --git a/packages/grpc-tools/build_binaries.ps1 b/packages/grpc-tools/build_binaries.ps1 index 8c249642..629aea26 100644 --- a/packages/grpc-tools/build_binaries.ps1 +++ b/packages/grpc-tools/build_binaries.ps1 @@ -16,6 +16,10 @@ $ErrorActionPreference = "Stop" +<# https://stackoverflow.com/questions/16657778/install-nuget-via-powershell-script/26421187#comment107976901_48216538 #> + +[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]'Tls11,Tls12' + Install-PackageProvider -Name NuGet -RequiredVersion 2.8.5.201 -Force Import-PackageProvider -Name NuGet -RequiredVersion 2.8.5.201 Install-Module -Force -Name 7Zip4Powershell @@ -37,34 +41,35 @@ MkDir-p ($Base + "/build/bin") $PackageFile = $Base + "/package.json" $ToolsVersion = ((Get-Content $PackageFile) -join "`n" | ConvertFrom-Json).version -$OutDir = $Env:ARTIFACTS_OUT + "/grpc-tools/v" + $ToolsVersion +cd ../.. +$OutDir = $pwd.Path + "/artifacts/grpc-tools/v" + $ToolsVersion Mkdir-p $OutDir -$ArchList = "ia32","x64" +cd $Base -foreach ($Arch in $ArchList) { - if ($Arch -eq "x64") { - $Generator = "Visual Studio 14 2015 Win64" - } else { - $Generator = "Visual Studio 14 2015" - } +Set-PSDebug -trace 2 - & cmake.exe . - if ($LASTEXITCODE -ne 0) { - throw "cmake failed" - } - & cmake.exe --build . - if ($LASTEXITCODE -ne 0) { - throw "cmake build failed" - } +$Arch = $Env:ARCH - Copy-Item ($ProtobufBase + "/Debug/protoc.exe") -Destination ($Base + "/build/bin/protoc.exe") - Copy-Item ($Base + "/Debug/grpc_node_plugin.exe") -Destination ($Base + "/build/bin/grpc_node_plugin.exe") +if ($Arch -eq "x64") { + $ArchName = "x64" +} else { + $ArchName = "Win32" +} - Compress-7Zip -Path ($Base + "/build") -Format Tar -ArchiveFileName ($Base + "/Archive.tar") - Compress-7Zip -Path ($Base + "/Archive.tar") -Format GZip -ArchiveFileName ($OutDir + "/win32-" + $Arch + ".tar.gz") +& cmake.exe . -A $ArchName +if ($LASTEXITCODE -ne 0) { + throw "cmake failed" +} +& cmake.exe --build . +if ($LASTEXITCODE -ne 0) { + throw "cmake build failed" +} - Remove-Item ($Base + "/build/bin/protoc.exe") - Remove-Item ($Base + "/build/bin/grpc_node_plugin.exe") - Remove-Item ($Base + "/CMakeCache.txt") -} \ No newline at end of file +Copy-Item ($ProtobufBase + "/Debug/protoc.exe") -Destination ($Base + "/build/bin/protoc.exe") +Copy-Item ($Base + "/Debug/grpc_node_plugin.exe") -Destination ($Base + "/build/bin/grpc_node_plugin.exe") + +Compress-7Zip -Path ($Base + "/build") -Format Tar -ArchiveFileName ($Base + "/Archive.tar") +Compress-7Zip -Path ($Base + "/Archive.tar") -Format GZip -ArchiveFileName ($OutDir + "/win32-" + $Arch + ".tar.gz") + +& git clean -xdf . \ No newline at end of file diff --git a/packages/grpc-tools/build_binaries.sh b/packages/grpc-tools/build_binaries.sh index 2a442183..b26946af 100755 --- a/packages/grpc-tools/build_binaries.sh +++ b/packages/grpc-tools/build_binaries.sh @@ -23,8 +23,8 @@ protobuf_base=$base/deps/protobuf tools_version=$(jq '.version' < package.json | tr -d '"') -# Note: $ARTIFACTS_OUT should not be in this directory -out_dir=$ARTIFACTS_OUT/grpc-tools/v$tools_version +# Note: artifacts should not be output in the package directory +out_dir=$base/../../artifacts/grpc-tools/v$tools_version mkdir -p "$out_dir" case $(uname -s) in diff --git a/test/kokoro-nodejs-build-test.bat b/test/kokoro-nodejs-build-test.bat deleted file mode 100644 index ea45c3f8..00000000 --- a/test/kokoro-nodejs-build-test.bat +++ /dev/null @@ -1,23 +0,0 @@ -@rem Copyright 2019 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. - -cd /d %~dp0 -cd .. - -call ./tools/release/kokoro-grpc-tools.bat || goto :error - -goto :EOF - -:error -exit /b 1 \ No newline at end of file diff --git a/test/kokoro-nodejs-build-test.sh b/test/kokoro-nodejs-build-test.sh deleted file mode 100755 index d3b2a546..00000000 --- a/test/kokoro-nodejs-build-test.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# Copyright 2019 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 -e -cd $(dirname $0)/.. -base_dir=$(pwd) - -./tools/release/kokoro-grpc-tools.sh \ No newline at end of file diff --git a/test/kokoro/linux-build-nodejs.cfg b/test/kokoro/linux-build-nodejs.cfg deleted file mode 100644 index ba2f49f2..00000000 --- a/test/kokoro/linux-build-nodejs.cfg +++ /dev/null @@ -1,19 +0,0 @@ -# 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/test/kokoro-nodejs-build-test.sh" -timeout_mins: 60 diff --git a/test/kokoro/macos-build-nodejs.cfg b/test/kokoro/macos-build-nodejs.cfg deleted file mode 100644 index ba2f49f2..00000000 --- a/test/kokoro/macos-build-nodejs.cfg +++ /dev/null @@ -1,19 +0,0 @@ -# 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/test/kokoro-nodejs-build-test.sh" -timeout_mins: 60 diff --git a/test/kokoro/windows-build-nodejs.cfg b/test/kokoro/windows-build-nodejs.cfg deleted file mode 100644 index 87f44370..00000000 --- a/test/kokoro/windows-build-nodejs.cfg +++ /dev/null @@ -1,19 +0,0 @@ -# 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/test/kokoro-nodejs-build-test.bat" -timeout_mins: 60 diff --git a/tools/release/kokoro-grpc-tools.bat b/tools/release/kokoro-grpc-tools.bat deleted file mode 100644 index 6b1e2fb4..00000000 --- a/tools/release/kokoro-grpc-tools.bat +++ /dev/null @@ -1,27 +0,0 @@ -@rem Copyright 2019 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. - -cd /d %~dp0 -cd ../.. - -git submodule update --init --recursive - -@rem make sure msys binaries are preferred over cygwin binaries -set PATH=C:\tools\msys64\usr\bin;%PATH% -set ARTIFACTS_OUT=%cd%/artifacts -powershell -File ./packages/grpc-tools/build_binaries.ps1 || goto :error -goto :EOF - -:error -exit /b 1 \ No newline at end of file diff --git a/tools/release/kokoro-grpc-tools.sh b/tools/release/kokoro-grpc-tools.sh deleted file mode 100755 index 267d6cc2..00000000 --- a/tools/release/kokoro-grpc-tools.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -# Copyright 2019 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. - -# Deleting Ruby. -rm -rf ~/.rvm - -set -e -cd $(dirname $0)/../.. -base_dir=$(pwd) - -OS=$(uname) - -git submodule update --init --recursive - -uname -a - -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 -e ARTIFACTS_OUT=$base_dir/artifacts kokoro-native-image $base_dir/packages/grpc-tools/build_binaries.sh - ;; -Darwin) - ARTIFACTS_OUT=$base_dir/artifacts ./packages/grpc-tools/build_binaries.sh - ;; -esac \ No newline at end of file diff --git a/tools/release/kokoro/linux-grpc-tools.cfg b/tools/release/kokoro/linux-grpc-tools.cfg deleted file mode 100644 index 0925db77..00000000 --- a/tools/release/kokoro/linux-grpc-tools.cfg +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright 2019 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-grpc-tools.sh" -timeout_mins: 60 -action { - define_artifacts { - regex: "github/grpc-node/artifacts/**", - strip_prefix: "github/grpc-node/artifacts" - } -} diff --git a/tools/release/kokoro/macos-grpc-tools.cfg b/tools/release/kokoro/macos-grpc-tools.cfg deleted file mode 100644 index 0925db77..00000000 --- a/tools/release/kokoro/macos-grpc-tools.cfg +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright 2019 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-grpc-tools.sh" -timeout_mins: 60 -action { - define_artifacts { - regex: "github/grpc-node/artifacts/**", - strip_prefix: "github/grpc-node/artifacts" - } -} diff --git a/tools/release/kokoro/windows-grpc-tools.cfg b/tools/release/kokoro/windows-grpc-tools.cfg deleted file mode 100644 index db649afc..00000000 --- a/tools/release/kokoro/windows-grpc-tools.cfg +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright 2019 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-grpc-tools.bat" -timeout_mins: 60 -action { - define_artifacts { - regex: "github/grpc-node/artifacts/**", - strip_prefix: "github/grpc-node/artifacts" - } -}