cmake.yml (1836B)
1 # Copyright (c) 2021 Luca Cappa 2 # Released under the term specified in file LICENSE.txt 3 # SPDX short identifier: MIT 4 # 5 # The peculiarity of this workflow is that assumes vcpkg stored as a submodule of this repository. 6 # This workflow does the following: 7 # - Restores vcpkg artifacts from cache. 8 # - Sets up vcpkg if needed, then run CMake with CMakePreset.json using a configuration 9 # that leverages the vcpkg's toolchain file. This will automatically run vcpkg to install dependencies 10 # described by the vcpkg.json manifest file. It will be a no-op if those are restored from cache. 11 # - Finally builds the sources with Ninja. 12 name: build 13 on: [push, pull_request, workflow_dispatch] 14 15 jobs: 16 VCPKG: 17 name: ${{ matrix.os }}-${{ github.workflow }} 18 runs-on: ${{ matrix.os }} 19 strategy: 20 fail-fast: false 21 matrix: 22 os: [ubuntu-latest, macos-latest, windows-latest] 23 24 steps: 25 - uses: actions/checkout@v3 26 with: 27 submodules: true 28 29 - uses: lukka/get-cmake@latest 30 if: startsWith(matrix.os, 'win') 31 32 - name: Setup MacOS 33 if: startsWith(matrix.os, 'macOS') 34 run: brew install automake autoconf ninja cmake 35 36 - name: Setup Ubuntu 37 if: startsWith(matrix.os, 'ubuntu') 38 run: sudo apt install ninja-build cmake 39 40 - name: Run CMake+Ninja+CTest to generate/build/test. 41 uses: lukka/run-cmake@v10 42 id: runcmake-ninja 43 with: 44 configurePreset: 'ninja' 45 buildPreset: 'ninja-release' 46 testPreset: 'ninja-release' 47 48 - name: Run CMake+MSVC+CTest to generate/build/test. 49 uses: lukka/run-cmake@v10 50 if: startsWith(matrix.os, 'win') 51 id: runcmake-msvc 52 with: 53 configurePreset: 'msvc' 54 buildPreset: 'msvc-release' 55 testPreset: 'msvc-release'