Merge pull request #1426 from murgatroid99/grpc-tools_github_actions_build

Add grpc-tools build GitHub Workflow
This commit is contained in:
Michael Lumish 2020-05-21 11:10:19 -07:00 committed by GitHub
commit ea77768989
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 103 additions and 265 deletions

72
.github/workflows/grpc-tools-build.yml vendored Normal file
View File

@ -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/

View File

@ -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")
}
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 .

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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"
}
}

View File

@ -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"
}
}

View File

@ -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"
}
}