From 7692d5f9ecc0c051ea7c0201572f8c4c71955c0c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 30 Sep 2021 17:17:10 +0200 Subject: [PATCH] Set SWIGJOBS environment variable automatically Use the number of available CPUs + 1 which seems to work best with the number of actually available CPUs in the GitHub Actions environment. --- .github/workflows/ci.yml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 943d6745f..df9746c61 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,6 @@ jobs: strategy: matrix: - #SWIGJOBS: ["-j2"] # other variables to optionally set # CC, GCC (used as suffix) # CPP11, CPP14, CPP17 @@ -47,7 +46,6 @@ jobs: env: SWIGLANG: ${{ matrix.SWIGLANG }} - SWIGJOBS: ${{ matrix.SWIGJOBS }} SWIG_FEATURES: ${{ matrix.SWIG_FEATURES }} CONFIGOPTS: ${{ matrix.CONFIGOPTS }} CC: ${{ matrix.CC }} @@ -77,6 +75,22 @@ jobs: echo "${CONFIGOPTS[@]}" ./autogen.sh && mkdir -p build/build && cd build/build && ../../configure "${CONFIGOPTS[@]}" + case $(uname) in + Linux) + cpu_count=$(nproc) + ;; + + Darwin) + cpu_count=$(sysctl -n hw.ncpu) + ;; + + *) + cpu_count=0 + ;; + esac + ((cpu_count++)) + echo SWIGJOBS=-j$cpu_count >> $GITHUB_ENV + - name: build shell: bash run: |