diff mbox series

[RFC,3/3] .github/workflows: Use matrix strategy to parallelize builds

Message ID 20200804084843.31075-4-f4bug@amsat.org
State New
Headers show
Series .github/workflows: Add GitHub action for Windows WHPX build | expand

Commit Message

Philippe Mathieu-Daudé Aug. 4, 2020, 8:48 a.m. UTC
Using sequencial builds, both jobs take almost 2h to build.
By using the matrix strategy we can build the jobs in parallel,
reducing the total build time to 1h12m (as of v5.1.0-rc2).

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 .github/workflows/build.sh |  8 ++++----
 .github/workflows/win.yml  | 23 +++++++----------------
 2 files changed, 11 insertions(+), 20 deletions(-)

Comments

Stefan Weil Aug. 4, 2020, 9:04 a.m. UTC | #1
Hi Philippe,

just a side note: GitHub action runs parallel jobs by default. I use two
jobs (32 and 64 bit builds), so both are built at the same time, see
https://github.com/stweil/qemu/actions.

Regards,

Stefan

Am 04.08.20 um 10:48 schrieb Philippe Mathieu-Daudé:
> Using sequencial builds, both jobs take almost 2h to build.
> By using the matrix strategy we can build the jobs in parallel,
> reducing the total build time to 1h12m (as of v5.1.0-rc2).
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  .github/workflows/build.sh |  8 ++++----
>  .github/workflows/win.yml  | 23 +++++++----------------
>  2 files changed, 11 insertions(+), 20 deletions(-)
>
> diff --git a/.github/workflows/build.sh b/.github/workflows/build.sh
> index c430a367be..4f2c6b56f3 100755
> --- a/.github/workflows/build.sh
> +++ b/.github/workflows/build.sh
> @@ -7,10 +7,10 @@
>  #~ set -e
>  set -x
>  
> -ARCH=$1
> -DLLS="libgcc_s_sjlj-1.dll libgomp-1.dll libstdc++-6.dll"
> -
> -if test "$ARCH" != "i686"; then
> +if test "$1" == "32"; then
> +  ARCH=i686
> +  DLLS="libgcc_s_sjlj-1.dll libgomp-1.dll libstdc++-6.dll"
> +else
>    ARCH=x86_64
>    DLLS="libgcc_s_seh-1.dll libgomp-1.dll libstdc++-6.dll"
>  fi
> diff --git a/.github/workflows/win.yml b/.github/workflows/win.yml
> index 81cf48530f..afd827db8e 100644
> --- a/.github/workflows/win.yml
> +++ b/.github/workflows/win.yml
> @@ -9,26 +9,17 @@ name: Cross build for Windows
>  on: [push]
>  
>  jobs:
> -  build32:
> +  build:
> +    strategy:
> +      matrix:
> +        arch: [32, 64]
>      if: github.repository == 'qemu/qemu'
>      runs-on: [ubuntu-20.04]
>      steps:
>      - uses: actions/checkout@v2
> -    - name: Build QEMU installer (32 bit)
> -      run: .github/workflows/build.sh i686
> +    - name: Build QEMU installer (${{ matrix.arch }} bit)
> +      run: .github/workflows/build.sh ${{ matrix.arch }}
>      - uses: actions/upload-artifact@v1
>        with:
> -        name: QEMU Installer Windows 32 bit
> -        path: dist
> -
> -  build64:
> -    if: github.repository == 'qemu/qemu'
> -    runs-on: [ubuntu-20.04]
> -    steps:
> -    - uses: actions/checkout@v2
> -    - name: Build QEMU installer (64 bit)
> -      run: .github/workflows/build.sh x86_64
> -    - uses: actions/upload-artifact@v1
> -      with:
> -        name: QEMU Installer Windows 64 bit
> +        name: QEMU Installer Windows ${{ matrix.arch }} bit
>          path: dist
Philippe Mathieu-Daudé Aug. 4, 2020, 9:11 a.m. UTC | #2
On 8/4/20 11:04 AM, Stefan Weil wrote:
> Hi Philippe,
> 
> just a side note: GitHub action runs parallel jobs by default. I use two
> jobs (32 and 64 bit builds), so both are built at the same time, see
> https://github.com/stweil/qemu/actions.

Indeed... Not sure why my tests ran serialized, maybe I had too many
jobs scheduled.

> 
> Regards,
> 
> Stefan
> 
> Am 04.08.20 um 10:48 schrieb Philippe Mathieu-Daudé:
>> Using sequencial builds, both jobs take almost 2h to build.
>> By using the matrix strategy we can build the jobs in parallel,
>> reducing the total build time to 1h12m (as of v5.1.0-rc2).
>>
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>>  .github/workflows/build.sh |  8 ++++----
>>  .github/workflows/win.yml  | 23 +++++++----------------
>>  2 files changed, 11 insertions(+), 20 deletions(-)
>>
>> diff --git a/.github/workflows/build.sh b/.github/workflows/build.sh
>> index c430a367be..4f2c6b56f3 100755
>> --- a/.github/workflows/build.sh
>> +++ b/.github/workflows/build.sh
>> @@ -7,10 +7,10 @@
>>  #~ set -e
>>  set -x
>>  
>> -ARCH=$1
>> -DLLS="libgcc_s_sjlj-1.dll libgomp-1.dll libstdc++-6.dll"
>> -
>> -if test "$ARCH" != "i686"; then
>> +if test "$1" == "32"; then
>> +  ARCH=i686
>> +  DLLS="libgcc_s_sjlj-1.dll libgomp-1.dll libstdc++-6.dll"
>> +else
>>    ARCH=x86_64
>>    DLLS="libgcc_s_seh-1.dll libgomp-1.dll libstdc++-6.dll"
>>  fi
>> diff --git a/.github/workflows/win.yml b/.github/workflows/win.yml
>> index 81cf48530f..afd827db8e 100644
>> --- a/.github/workflows/win.yml
>> +++ b/.github/workflows/win.yml
>> @@ -9,26 +9,17 @@ name: Cross build for Windows
>>  on: [push]
>>  
>>  jobs:
>> -  build32:
>> +  build:
>> +    strategy:
>> +      matrix:
>> +        arch: [32, 64]
>>      if: github.repository == 'qemu/qemu'
>>      runs-on: [ubuntu-20.04]
>>      steps:
>>      - uses: actions/checkout@v2
>> -    - name: Build QEMU installer (32 bit)
>> -      run: .github/workflows/build.sh i686
>> +    - name: Build QEMU installer (${{ matrix.arch }} bit)
>> +      run: .github/workflows/build.sh ${{ matrix.arch }}
>>      - uses: actions/upload-artifact@v1
>>        with:
>> -        name: QEMU Installer Windows 32 bit
>> -        path: dist
>> -
>> -  build64:
>> -    if: github.repository == 'qemu/qemu'
>> -    runs-on: [ubuntu-20.04]
>> -    steps:
>> -    - uses: actions/checkout@v2
>> -    - name: Build QEMU installer (64 bit)
>> -      run: .github/workflows/build.sh x86_64
>> -    - uses: actions/upload-artifact@v1
>> -      with:
>> -        name: QEMU Installer Windows 64 bit
>> +        name: QEMU Installer Windows ${{ matrix.arch }} bit
>>          path: dist
> 
>
diff mbox series

Patch

diff --git a/.github/workflows/build.sh b/.github/workflows/build.sh
index c430a367be..4f2c6b56f3 100755
--- a/.github/workflows/build.sh
+++ b/.github/workflows/build.sh
@@ -7,10 +7,10 @@ 
 #~ set -e
 set -x
 
-ARCH=$1
-DLLS="libgcc_s_sjlj-1.dll libgomp-1.dll libstdc++-6.dll"
-
-if test "$ARCH" != "i686"; then
+if test "$1" == "32"; then
+  ARCH=i686
+  DLLS="libgcc_s_sjlj-1.dll libgomp-1.dll libstdc++-6.dll"
+else
   ARCH=x86_64
   DLLS="libgcc_s_seh-1.dll libgomp-1.dll libstdc++-6.dll"
 fi
diff --git a/.github/workflows/win.yml b/.github/workflows/win.yml
index 81cf48530f..afd827db8e 100644
--- a/.github/workflows/win.yml
+++ b/.github/workflows/win.yml
@@ -9,26 +9,17 @@  name: Cross build for Windows
 on: [push]
 
 jobs:
-  build32:
+  build:
+    strategy:
+      matrix:
+        arch: [32, 64]
     if: github.repository == 'qemu/qemu'
     runs-on: [ubuntu-20.04]
     steps:
     - uses: actions/checkout@v2
-    - name: Build QEMU installer (32 bit)
-      run: .github/workflows/build.sh i686
+    - name: Build QEMU installer (${{ matrix.arch }} bit)
+      run: .github/workflows/build.sh ${{ matrix.arch }}
     - uses: actions/upload-artifact@v1
       with:
-        name: QEMU Installer Windows 32 bit
-        path: dist
-
-  build64:
-    if: github.repository == 'qemu/qemu'
-    runs-on: [ubuntu-20.04]
-    steps:
-    - uses: actions/checkout@v2
-    - name: Build QEMU installer (64 bit)
-      run: .github/workflows/build.sh x86_64
-    - uses: actions/upload-artifact@v1
-      with:
-        name: QEMU Installer Windows 64 bit
+        name: QEMU Installer Windows ${{ matrix.arch }} bit
         path: dist