diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a47baa9..be439b6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,67 +2,36 @@ name: Build and run tests on: [push, pull_request] +env: + CMAKE_COLOR_DIAGNOSTICS: ON + OMP_NUM_THREADS: 1 + jobs: build: - name: ${{ matrix.config.name }} - runs-on: ${{ matrix.config.os }} + name: ${{ matrix.os }} ${{ matrix.shared_libs && 'shared' || 'static' }} + runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: - config: - - { - name: "Windows static", - os: windows-latest, - build_type: "Release", - shared_libs: false, - generators: "Visual Studio 17 2022" - } - - { - name: "Ubuntu Linux static", - os: ubuntu-latest, - build_type: "Release", - shared_libs: false, - generators: "Ninja" - } - - { - name: "macOS static", - os: macos-latest, - build_type: "Release", - shared_libs: false, - generators: "Ninja" - } - - { - name: "Windows shared", - os: windows-latest, - build_type: "Release", - shared_libs: true, - generators: "Visual Studio 17 2022" - } - - { - name: "Ubuntu Linux shared", - os: ubuntu-latest, - build_type: "Release", - shared_libs: true, - generators: "Ninja" - } - - { - name: "macOS shared", - os: macos-latest, - build_type: "Release", - shared_libs: true, - generators: "Ninja" - } + os: [windows-latest, ubuntu-latest, macos-latest] + build_type: ["Release"] + shared_libs: [false, true] + exclude: + - os: windows-latest + generators: "Ninja" # Windows doesn't use Ninja + generators: + - windows-latest: "Visual Studio 17 2022" steps: - uses: actions/checkout@v4 - name: Install dependencies on Windows - if: startsWith(matrix.config.os, 'windows') + if: startsWith(matrix.os, 'windows') run: choco install -y --no-progress cmake ninja - name: Install dependencies on Linux - if: startsWith(matrix.config.os, 'ubuntu') + if: startsWith(matrix.os, 'ubuntu') run: | wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ focal main' | sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null @@ -70,7 +39,7 @@ jobs: sudo apt-get install ninja-build cmake - name: Install dependencies on macOS - if: startsWith(matrix.config.os, 'macos') + if: startsWith(matrix.os, 'macos') run: brew install cmake ninja - name: Prepare build folder @@ -80,14 +49,14 @@ jobs: cmake \ -S . \ -B build \ - -DBUILD_SHARED_LIBS=${{ matrix.config.shared_libs }} \ - -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \ - -G "${{ matrix.config.generators }}" \ + -DBUILD_SHARED_LIBS=${{ matrix.shared_libs }} \ + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ + -G "${{ matrix.generators }}" \ -DCMAKE_INSTALL_PREFIX:PATH=instdir - name: Build project shell: bash - run: cmake --build build --config ${{ matrix.config.build_type }} + run: cmake --build build --config ${{ matrix.build_type }} - name: Run tests shell: bash @@ -101,9 +70,9 @@ jobs: uses: actions/upload-artifact@v4 if: always() with: - name: unit-test-results-${{ matrix.config.os }}-${{ matrix.config.shared_libs }} + name: unit-test-results-${{ matrix.os }}-${{ matrix.shared_libs }} path: build/report.xml - name: Install and strip shell: bash - run: cmake --install build --config ${{ matrix.config.build_type }} --strip + run: cmake --install build --config ${{ matrix.build_type }} --strip