From 5e1af6bb691c7f9c5bb1e3d82bb706e049af30f2 Mon Sep 17 00:00:00 2001
From: ArthurSonzogni <sonzogniarthur@gmail.com>
Date: Fri, 19 May 2023 12:11:12 +0200
Subject: [PATCH] Parallelize github build workflow

---
 .github/workflows/build.yaml | 13 ++++++++++++-
 CMakeLists.txt               |  2 +-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index c63a94a1..0e4824bb 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -39,6 +39,10 @@ jobs:
 
     runs-on: ${{ matrix.os }}
     steps:
+      - name: Get number of CPU cores
+        uses: SimenB/github-actions-cpu-cores@v1
+        id: cpu-cores
+
       - name: "Checkout repository"
         uses: actions/checkout@v2
 
@@ -49,7 +53,7 @@ jobs:
           vcvarsall: ${{ contains(matrix.os, 'windows' )}}
           cmake: true
           ninja: true
-          clangtidy: true
+          clangtidy: false
           cppcheck: false
           gcovr: "5.0"
           opencppcoverage: true
@@ -61,6 +65,7 @@ jobs:
           cmake -S .
           -B ./build
           -DCMAKE_BUILD_TYPE:STRING=Debug
+          -DCMAKE_BUILD_PARALLEL_LEVEL=${{ steps.cpu-cores.outputs.count }}
           -DFTXUI_ENABLE_COVERAGE:BOOL=ON
           -DFTXUI_BUILD_DOCS:BOOL=OFF
           -DFTXUI_BUILD_EXAMPLES:BOOL=ON
@@ -144,6 +149,10 @@ jobs:
             asset_path: build/ftxui*Win64*
     runs-on: ${{ matrix.os }}
     steps:
+      - name: Get number of CPU cores
+        uses: SimenB/github-actions-cpu-cores@v1
+        id: cpu-cores
+
       - name: "Checkout repository"
         uses: actions/checkout@v2
 
@@ -156,12 +165,14 @@ jobs:
           cd build;
           cmake ..
           -DCMAKE_BUILD_TYPE=Release
+          -DCMAKE_BUILD_PARALLEL_LEVEL=${{ steps.cpu-cores.outputs.count }}
           -DFTXUI_BUILD_DOCS=OFF
           -DFTXUI_BUILD_EXAMPLES=OFF
           -DFTXUI_BUILD_TESTS=OFF
           -DFTXUI_BUILD_TESTS_FUZZER=OFF
           -DFTXUI_ENABLE_INSTALL=ON;
           cmake --build . --target package;
+
       - uses: shogo82148/actions-upload-release-asset@v1
         with:
           upload_url: ${{ needs.release.outputs.upload_url }}
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c0794c9e..29dfdbf8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.11)
+cmake_minimum_required(VERSION 3.12)
 
 project(ftxui
   LANGUAGES CXX
-- 
GitLab