Skip to content
# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform.
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
name: CMake on multiple platforms
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
env:
CONAN_HOME: "${{ github.workspace }}/.conan2"
runs-on: ${{ matrix.os }}
strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
compiler: [gcc, clang, msvc]
build_type: [Release]
exclude:
- os: windows-latest
compiler: gcc
- os: windows-latest
compiler: clang
- os: ubuntu-latest
compiler: msvc
steps:
- uses: actions/checkout@v4
- name: Set reusable strings
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
- if: ${{ runner.os == 'Linux' }}
run: > sudo apt-get update && sudo apt-get install -y

Check failure on line 45 in .github/workflows/cmake-multi-platform.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/cmake-multi-platform.yml

Invalid workflow file

You have an error in your yaml syntax on line 45
libgl-dev libgl1-mesa-dev libx11-dev libx11-xcb-dev libfontenc-dev libice-dev libsm-dev libxau-dev libxaw7-dev
libxcomposite-dev libxcursor-dev libxdamage-dev libxfixes-dev libxi-dev libxinerama-dev libxmuu-dev libxrandr-dev
libxres-dev libxss-dev libxtst-dev libxv-dev libxxf86vm-dev libxcb-glx0-dev libxcb-render-util0-dev libxcb-xkb-dev
libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-randr0-dev libxcb-shape0-dev libxcb-sync-dev
libxcb-xfixes0-dev libxcb-xinerama0-dev libxcb-dri3-dev libxcb-cursor-dev libxcb-dri2-0-dev libxcb-dri3-dev
libxcb-present-dev libxcb-composite0-dev libxcb-ewmh-dev libxcb-res0-dev
- name: Install Conan
id: conan
uses: turtlebrowser/get-conan@main
- name: Conan version
run: echo "${{ steps.conan.outputs.version }}"
- name: Cache Conan Dependencies
id: cache-conan
uses: actions/cache@v4
with:
path: ${{ env.CONAN_HOME }}
key: conan-cache-${{ runner.os }}-${{ hashFiles('conanfile.py') }}
restore-keys: conan-cache-${{ runner.os }}-
- uses: DamianReeves/write-file-action@master
if: ${{ matrix.compiler == 'clang' }}
with:
path: ${{ env.CONAN_HOME }}/profiles/default
contents: |
[settings]
arch=x86_64
build_type=Release
compiler=clang
compiler.cppstd=gnu20
compiler.libcxx=libc++
compiler.version=14
os=Linux
write-mode: overwrite
- uses: DamianReeves/write-file-action@master
if: ${{ matrix.compiler == 'gcc' }}
with:
path: ${{ env.CONAN_HOME }}/profiles/default
contents: |
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.cppstd=gnu20
compiler.libcxx=libstdc++11
compiler.version=11
os=Linux
write-mode: overwrite
- uses: DamianReeves/write-file-action@master
if: ${{ matrix.compiler == 'msvc' }}
with:
path: ${{ env.CONAN_HOME }}/profiles/default
contents: |
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=20
compiler.runtime=dynamic
compiler.version=194
os=Windows
write-mode: overwrite
- name: PrintProfile
run: cat ${{ env.CONAN_HOME }}/profiles/default
- name: Build
run: conan create . --build=missing
- name: Test
working-directory: ${{ steps.strings.outputs.build-output-dir }}
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest --build-config ${{ matrix.build_type }}