Skip to content

Commit

Permalink
Split build and test jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
ToppDev committed Aug 10, 2024
1 parent a19cca3 commit eb8fab8
Showing 1 changed file with 86 additions and 4 deletions.
90 changes: 86 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,84 @@ jobs:
run: |
cmake --build ./build --target doc --config Release
Build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-22.04
- macos-13
- windows-2022
compiler:
# you can specify the version after `-` like "llvm-13.0.0".
- llvm
- gcc-11
- msvc-2022
build_type:
- Debug
log-level:
- "DEBUG"
exclude:
- os: ubuntu-22.04
compiler: msvc-2022
- os: macos-13
compiler: gcc-11
- os: macos-13
compiler: msvc-2022
- os: windows-2022
compiler: gcc-11
- os: windows-2022
compiler: llvm
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Cache
uses: ./.github/actions/setup_cache
with:
compiler: ${{ matrix.compiler }}
build_type: ${{ matrix.build_type }}
- name: Setup Cpp
uses: aminya/setup-cpp@v1
with:
compiler: ${{ matrix.compiler }}
vcvarsall: ${{ contains(matrix.os, 'windows' )}}
cmake: true
brew: true
conan: "2.6.0"
- name: Setup MacOS
if: ${{ runner.os == 'macOS' }}
run: |
brew install glfw
- name: Setup Linux
if: ${{ runner.os == 'Linux' }}
run: |
sudo apt install -y libglfw3-dev libglfw3
- name: Create default conan profile
run: |
conan profile detect --force
- name: Check tool versions
uses: ./.github/actions/check_tool_versions
with:
coverage: true
compiler: ${{ matrix.compiler }}
- name: Installing conan dependencies
run: |
conan install . --build=missing -s build_type=${{matrix.build_type}} -s compiler.cppstd=17
- name: Configure CMake
if: ${{ runner.os != 'Windows' }}
run: |
cmake -S . -B ./build -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} -DCMAKE_TOOLCHAIN_FILE="build/${{matrix.build_type}}/generators/conan_toolchain.cmake" -DENABLE_MAIN=TRUE -DENABLE_TESTING=TRUE -DENABLE_COVERAGE:BOOL=${{ runner.os == 'Linux' && matrix.build_type == 'Debug' && startsWith(matrix.compiler, 'gcc') }} -DENABLE_DOXYGEN=OFF -DLOG_LEVEL:STRING=${{matrix.log-level}} -DWARNINGS_AS_ERRORS:BOOL=${{ !contains(matrix.os, 'windows' )}} -DENABLE_CPPCHECK=OFF -DENABLE_CLANG_TIDY=OFF -DENABLE_INCLUDE_WHAT_YOU_USE=OFF
- name: Configure CMake
if: ${{ runner.os == 'Windows' }}
run: |
cmake -S . -B ./build -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} -DCMAKE_TOOLCHAIN_FILE="build/generators/conan_toolchain.cmake" -DENABLE_MAIN=TRUE -DENABLE_TESTING=TRUE -DENABLE_COVERAGE:BOOL=OFF -DENABLE_DOXYGEN=OFF -DLOG_LEVEL:STRING=${{matrix.log-level}} -DWARNINGS_AS_ERRORS:BOOL=${{ !contains(matrix.os, 'windows' )}} -DENABLE_CPPCHECK=OFF -DENABLE_CLANG_TIDY=OFF -DENABLE_INCLUDE_WHAT_YOU_USE=OFF
- name: Build
run: |
cmake --build ./build --config ${{matrix.build_type}}
Test:
runs-on: ${{ matrix.os }}
strategy:
Expand All @@ -119,7 +197,6 @@ jobs:
- msvc-2022
build_type:
- Release
- Debug
log-level:
- "DEBUG"
exclude:
Expand All @@ -138,6 +215,10 @@ jobs:
compiler: gcc-11
build_type: Release
log-level: "OFF"
- os: ubuntu-22.04
compiler: gcc-11
build_type: Debug
log-level: "DEBUG"
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -179,18 +260,19 @@ jobs:
- name: Configure CMake
if: ${{ runner.os != 'Windows' }}
run: |
cmake -S . -B ./build -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} -DCMAKE_TOOLCHAIN_FILE="build/${{matrix.build_type}}/generators/conan_toolchain.cmake" -DENABLE_MAIN=TRUE -DENABLE_TESTING=TRUE -DENABLE_COVERAGE:BOOL=OFF -DENABLE_DOXYGEN=OFF -DLOG_LEVEL:STRING=${{matrix.log-level}} -DWARNINGS_AS_ERRORS:BOOL=${{ !contains(matrix.os, 'windows' )}} -DENABLE_CPPCHECK=OFF -DENABLE_CLANG_TIDY=OFF -DENABLE_INCLUDE_WHAT_YOU_USE=OFF
cmake -S . -B ./build -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} -DCMAKE_TOOLCHAIN_FILE="build/${{matrix.build_type}}/generators/conan_toolchain.cmake" -DENABLE_MAIN=TRUE -DENABLE_TESTING=TRUE -DENABLE_COVERAGE:BOOL=${{ runner.os == 'Linux' && matrix.build_type == 'Debug' && startsWith(matrix.compiler, 'gcc') }} -DENABLE_DOXYGEN=OFF -DLOG_LEVEL:STRING=${{matrix.log-level}} -DWARNINGS_AS_ERRORS:BOOL=${{ !contains(matrix.os, 'windows' )}} -DENABLE_CPPCHECK=OFF -DENABLE_CLANG_TIDY=OFF -DENABLE_INCLUDE_WHAT_YOU_USE=OFF
- name: Configure CMake
if: ${{ runner.os == 'Windows' }}
run: |
cmake -S . -B ./build -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} -DCMAKE_TOOLCHAIN_FILE="build/generators/conan_toolchain.cmake" -DENABLE_MAIN=TRUE -DENABLE_TESTING=TRUE -DENABLE_COVERAGE:BOOL=${{ runner.os == 'Linux' && matrix.build_type == 'Debug' && startsWith(matrix.compiler, 'gcc') }} -DENABLE_DOXYGEN=OFF -DLOG_LEVEL:STRING=${{matrix.log-level}} -DWARNINGS_AS_ERRORS:BOOL=${{ !contains(matrix.os, 'windows' )}} -DENABLE_CPPCHECK=OFF -DENABLE_CLANG_TIDY=OFF -DENABLE_INCLUDE_WHAT_YOU_USE=OFF
cmake -S . -B ./build -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} -DCMAKE_TOOLCHAIN_FILE="build/generators/conan_toolchain.cmake" -DENABLE_MAIN=TRUE -DENABLE_TESTING=TRUE -DENABLE_COVERAGE:BOOL=OFF -DENABLE_DOXYGEN=OFF -DLOG_LEVEL:STRING=${{matrix.log-level}} -DWARNINGS_AS_ERRORS:BOOL=${{ !contains(matrix.os, 'windows' )}} -DENABLE_CPPCHECK=OFF -DENABLE_CLANG_TIDY=OFF -DENABLE_INCLUDE_WHAT_YOU_USE=OFF
- name: Build
run: |
cmake --build ./build --config ${{matrix.build_type}}
- name: Test
if: ${{ matrix.build_type == 'Release' || startsWith(matrix.compiler, 'gcc') }}
working-directory: ./build
run: |
ctest -C ${{matrix.build_type}} --output-on-failure --timeout 300
ctest -C ${{matrix.build_type}} --output-on-failure --timeout 600
- name: Upload test results on failure
if: failure()
uses: actions/upload-artifact@v4
Expand Down

0 comments on commit eb8fab8

Please sign in to comment.