Skip to content

Commit

Permalink
🔨 Reduce number of generated matrix jobs
Browse files Browse the repository at this point in the history
The workflows were modified recently to extract the `build_type` out
as a matrix input. This works well, however it generates twice as many
jobs -- many of which will not run concurrently on the default free
Github Actions runners.

This is resulting in longer execution times due in part to the
duplicate setup times. In reality, the debug/release build_type can
be better folded into the same action run, which reduces the number of
builds *by half* at the cost of minimal duplication of the config,
build, and test steps. This would allow the initial installation and
setup time to be saved, resulting only in the configuration/build/test
time.

This change has been made in an effort to reduce the CI times.
  • Loading branch information
bitwizeshift committed Dec 17, 2020
1 parent f74087d commit aec39a9
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 36 deletions.
34 changes: 27 additions & 7 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [push, pull_request]

jobs:
test:
name: Xcode ${{matrix.compiler.version}} ${{matrix.build_type}}
name: Xcode ${{matrix.compiler.version}}
runs-on: macos-latest

env:
Expand All @@ -20,8 +20,6 @@ jobs:
- { name: "xcode", version: "11.3" }
- { name: "xcode", version: "12.3" }

build_type: [Debug, Release]

steps:
- name: Clone
uses: actions/checkout@v2
Expand All @@ -39,15 +37,15 @@ jobs:
python -m pip install --upgrade pip
pip install conan
cmake -E make_directory ${{env.build-directory}}
cmake -E chdir ${{env.build-directory}} conan install ..
- name: Configure
- name: Configure (Debug)
working-directory: ${{env.build-directory}}
env:
CC: clang
CXX: clang++
run: |
conan install ..
cmake .. -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DRESULT_COMPILE_UNIT_TESTS=On
cmake .. -DCMAKE_BUILD_TYPE=Debug -DRESULT_COMPILE_UNIT_TESTS=On
- name: Build
working-directory: ${{env.build-directory}}
Expand All @@ -56,8 +54,30 @@ jobs:
- name: Test
working-directory: ${{env.build-directory}}
env:
CTEST_OUTPUT_ON_FAILURE: "1"
run: |
ctest --output-on-failure
cmake --build . --target test
- name: Configure (Release)
working-directory: ${{env.build-directory}}
env:
CC: clang
CXX: clang++
run: |
cmake .. -DCMAKE_BUILD_TYPE=Release -DRESULT_COMPILE_UNIT_TESTS=On
- name: Build
working-directory: ${{env.build-directory}}
run: |
cmake --build .
- name: Test
working-directory: ${{env.build-directory}}
env:
CTEST_OUTPUT_ON_FAILURE: "1"
run: |
cmake --build . --target test
sanitize:
name: Xcode ${{matrix.compiler.version}} '${{matrix.sanitizer}}' sanitizer
Expand Down
38 changes: 30 additions & 8 deletions .github/workflows/build-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [push, pull_request]

jobs:
test:
name: ${{matrix.compiler.cc}} ${{matrix.build_type}}
name: ${{matrix.compiler.cc}}
runs-on: ubuntu-20.04

env:
Expand Down Expand Up @@ -36,8 +36,6 @@ jobs:
- { cc: clang-9, cxx: clang++-9 }
- { cc: clang-10, cxx: clang++-10 }

build_type: [Debug, Release]

steps:
- name: Clone
uses: actions/checkout@v2
Expand Down Expand Up @@ -65,14 +63,14 @@ jobs:
pip install conan
cmake -E make_directory ${{env.build-directory}}
- name: Configure
- name: Configure (Debug)
working-directory: ${{env.build-directory}}
env:
CC: ${{matrix.compiler.cc}}
CXX: ${{matrix.compiler.cxx}}
run: |
conan install ..
cmake .. -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DRESULT_COMPILE_UNIT_TESTS=On
cmake .. -DCMAKE_BUILD_TYPE=Debug -DRESULT_COMPILE_UNIT_TESTS=On
- name: Build
working-directory: ${{env.build-directory}}
Expand All @@ -81,12 +79,34 @@ jobs:
- name: Test
working-directory: ${{env.build-directory}}
env:
CTEST_OUTPUT_ON_FAILURE: "1"
run: |
ctest --output-on-failure
cmake --build . --target test
- name: Configure (Release)
working-directory: ${{env.build-directory}}
env:
CC: ${{matrix.compiler.cc}}
CXX: ${{matrix.compiler.cxx}}
run: |
cmake .. -DCMAKE_BUILD_TYPE=Release
- name: Build
working-directory: ${{env.build-directory}}
run: |
cmake --build .
- name: Test
working-directory: ${{env.build-directory}}
env:
CTEST_OUTPUT_ON_FAILURE: "1"
run: |
cmake --build . --target test
sanitize:
name: ${{matrix.compiler.cc}} '${{matrix.sanitizer}}' sanitizer
runs-on: ubuntu-latest
runs-on: ubuntu-20.04

needs: test

Expand Down Expand Up @@ -131,5 +151,7 @@ jobs:
- name: Test (Sanitize)
working-directory: ${{env.build-directory}}
env:
CTEST_OUTPUT_ON_FAILURE: "1"
run: |
ctest --output-on-failure
cmake --build . --target test
54 changes: 33 additions & 21 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [push, pull_request]

jobs:
test:
name: Windows ${{matrix.compiler.name}} ${{matrix.compiler.version}} ${{matrix.build_type}}
name: Windows ${{matrix.compiler.name}} ${{matrix.compiler.version}}
runs-on: windows-latest

env:
Expand All @@ -22,8 +22,6 @@ jobs:
# - { name: "cl", version: "14.16", cc: cl, cxx: cl }
- { name: "cl", version: "latest", cc: cl, cxx: cl }

build_type: [Debug, Release]

steps:
- name: Clone
uses: actions/checkout@v2
Expand All @@ -40,54 +38,68 @@ jobs:
python -m pip install --upgrade pip
pip install conan
cmake -E make_directory ${{env.build-directory}}
cmake -E chdir ${{env.build-directory}} conan install ..
- name: Configure (gcc)
working-directory: ${{env.build-directory}}
shell: powershell
if: ${{matrix.compiler.name == 'gcc'}}
env:
CC: gcc
CXX: g++
run: |
conan install ..
cmake .. -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DRESULT_COMPILE_UNIT_TESTS=On -G"MinGW Makefiles"
cmake .. -DRESULT_COMPILE_UNIT_TESTS=On -G"MinGW Makefiles"
- name: Configure (clang)
working-directory: ${{env.build-directory}}
shell: powershell
if: ${{matrix.compiler.name == 'clang'}}
run: |
conan install ..
cmake .. -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DRESULT_COMPILE_UNIT_TESTS=On -G"MinGW Makefiles" -DCMAKE_CXX_COMPILER="C:/Program Files/LLVM/bin/clang++.exe"
cmake .. -DRESULT_COMPILE_UNIT_TESTS=On -G"MinGW Makefiles" -DCMAKE_CXX_COMPILER="C:/Program Files/LLVM/bin/clang++.exe"
- name: Configure (clang-cl)
working-directory: ${{env.build-directory}}
shell: powershell
if: ${{matrix.compiler.name == 'clang-cl'}}
run: |
conan install ..
cmake .. -DRESULT_COMPILE_UNIT_TESTS=On -G "Visual Studio 16 2019" -A x64 -T ClangCL
- name: Configure (MSVC)
working-directory: ${{env.build-directory}}
shell: powershell
if: ${{matrix.compiler.name == 'cl'}}
run: |
$visual_studio_path = & "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere" -latest -property installationPath
if ("${{matrix.compiler.version}}" -ne "latest") {
& "$visual_studio_path\Common7\Tools\vsdevcmd.bat" -arch=x64 -host_arch=x64 -vcvars_ver="${{matrix.compiler.version}}"
}
conan install ..
cmake .. -DRESULT_COMPILE_UNIT_TESTS=On -G "Visual Studio 16 2019"
- name: Configure (Debug)
working-directory: ${{env.build-directory}}
if: ${{matrix.compiler.name == 'clang' || matrix.compiler.name == 'gcc'}}
run: |
cmake . -DCMAKE_BUILD_TYPE=Debug
- name: Build
working-directory: ${{env.build-directory}}
run: |
cmake --build . --config Debug
- name: Test
working-directory: ${{env.build-directory}}
env:
CTEST_OUTPUT_ON_FAILURE: "1"
run: |
ctest -C Debug
- name: Configure (Release)
working-directory: ${{env.build-directory}}
if: ${{matrix.compiler.name == 'clang' || matrix.compiler.name == 'gcc'}}
run: |
cmake . -DCMAKE_BUILD_TYPE=Release
- name: Build
working-directory: ${{env.build-directory}}
shell: powershell
run: |
cmake --build . --config ${{matrix.build_type}}
cmake --build . --config Release
- name: Test
working-directory: ${{env.build-directory}}
shell: powershell
env:
CTEST_OUTPUT_ON_FAILURE: "1"
run: |
ctest --output-on-failure
ctest -C Release

0 comments on commit aec39a9

Please sign in to comment.