From 4c6847fc9fde4a37526bada59fd4cc23b0e94edb Mon Sep 17 00:00:00 2001 From: Michael Lumish Date: Fri, 15 May 2020 10:38:54 -0700 Subject: [PATCH] Build Windows x86 and x64 separately using a matrix --- .github/workflows/grpc-tools-build.yml | 7 ++++- packages/grpc-tools/build_binaries.ps1 | 40 ++++++++++++-------------- 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/.github/workflows/grpc-tools-build.yml b/.github/workflows/grpc-tools-build.yml index b419744c..4f84143a 100644 --- a/.github/workflows/grpc-tools-build.yml +++ b/.github/workflows/grpc-tools-build.yml @@ -40,6 +40,11 @@ jobs: 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: @@ -49,7 +54,7 @@ jobs: shell: cmd - uses: actions/upload-artifact@v1 with: - name: grpc-tools_windows + name: grpc-tools_windows_${{matrix.arch}} path: artifacts/ combine_artifacts: name: Combine grpc-tools artifacts diff --git a/packages/grpc-tools/build_binaries.ps1 b/packages/grpc-tools/build_binaries.ps1 index bec4f1ac..629aea26 100644 --- a/packages/grpc-tools/build_binaries.ps1 +++ b/packages/grpc-tools/build_binaries.ps1 @@ -49,29 +49,27 @@ cd $Base Set-PSDebug -trace 2 -$ArchList = "ia32","x64" +$Arch = $Env:ARCH -foreach ($Arch in $ArchList) { - if ($Arch -eq "x64") { - $ArchName = "x64" - } else { - $ArchName = "Win32" - } +if ($Arch -eq "x64") { + $ArchName = "x64" +} else { + $ArchName = "Win32" +} - & cmake.exe . -A $ArchName - if ($LASTEXITCODE -ne 0) { - throw "cmake failed" - } - & cmake.exe --build . - if ($LASTEXITCODE -ne 0) { - throw "cmake build failed" - } +& cmake.exe . -A $ArchName +if ($LASTEXITCODE -ne 0) { + throw "cmake failed" +} +& cmake.exe --build . +if ($LASTEXITCODE -ne 0) { + throw "cmake build failed" +} - 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") +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") +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 +& git clean -xdf . \ No newline at end of file