Skip to content

Added: CI mingw build #50

Added: CI mingw build

Added: CI mingw build #50

name: CMake on multiple platforms
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
build_type: [Release, Debug]
c_compiler: [gcc, clang, cl, x86_64-w64-mingw32-gcc]
# Defaults applied to all
defaults:
mingw: false

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

View workflow run for this annotation

GitHub Actions / CMake on multiple platforms

Invalid workflow file

The workflow is not valid. .github/workflows/cmake-multi-platform.yml (Line: 22, Col: 11): A mapping was not expected
exe_suffix: ""
include:
- os: windows-latest
c_compiler: cl
cpp_compiler: cl
exe_suffix: .exe
- os: ubuntu-latest
c_compiler: gcc
cpp_compiler: g++
- os: ubuntu-latest
c_compiler: clang
cpp_compiler: clang++
- os: ubuntu-latest
c_compiler: x86_64-w64-mingw32-gcc
cpp_compiler: x86_64-w64-mingw32-g++
mingw: true
exe_suffix: .exe
exclude:
- os: windows-latest
c_compiler: gcc
- os: windows-latest
c_compiler: clang
- os: windows-latest
c_compiler: x86_64-w64-mingw32-gcc
- os: ubuntu-latest
c_compiler: cl
steps:
- uses: actions/checkout@v3
- name: Install MinGW (only if mingw is true)
if: matrix.mingw == true
run: |
sudo apt-get update
sudo apt-get install -y mingw-w64
- name: Update submodules
run: git submodule update --init --recursive --depth 1
- name: Set build directory
id: vars
run: echo "dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
- name: Configure CMake
run: >
cmake -S . -B ${{ steps.vars.outputs.dir }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
${{ matrix.mingw && '-DCMAKE_TOOLCHAIN_FILE=mingw-w64-x86_64.cmake' || '' }}
- name: Build
run: cmake --build ${{ steps.vars.outputs.dir }} --config ${{ matrix.build_type }}
- name: Run tests
working-directory: >-
${{ steps.vars.outputs.dir }}/Example${{
matrix.os == 'windows-latest' && format('/{0}', matrix.build_type) || ''
}}
run: ./ImageLoaderExample${{ matrix.exe_suffix }}