ELFIO/.github/workflows/c-cpp.yml

101 lines
2.9 KiB
YAML
Raw Normal View History

2020-08-24 19:03:23 +00:00
name: C/C++ CI
on:
push:
2023-12-13 15:50:50 +00:00
branches: [ "main" ]
2020-08-24 19:03:23 +00:00
pull_request:
2023-12-13 15:50:50 +00:00
branches: [ "main" ]
2023-12-14 15:45:14 +00:00
workflow_call:
2023-12-14 16:41:07 +00:00
workflow_dispatch:
2022-08-31 17:00:20 +00:00
2020-08-24 19:03:23 +00:00
jobs:
2023-12-13 15:50:50 +00:00
build:
name: CMake Build & Test
2023-12-13 15:50:50 +00:00
runs-on: ${{ matrix.os }}
2020-11-02 03:05:46 +00:00
strategy:
matrix:
2023-12-13 17:42:38 +00:00
os: [ubuntu-latest, ubuntu-20.04, windows-latest, windows-2019, macos-11, macos-13]
2023-12-13 15:50:50 +00:00
build_type: [Release, Debug]
2023-12-13 16:17:50 +00:00
cpp_compiler: [g++, clang++, cl]
2023-12-13 17:12:23 +00:00
include:
- os: windows-latest
cpp_compiler: cl
c_compiler: cl
2023-12-13 17:42:38 +00:00
- os: windows-2019
cpp_compiler: cl
c_compiler: cl
2023-12-13 17:12:23 +00:00
- os: ubuntu-latest
cpp_compiler: g++
c_compiler: gcc
- os: ubuntu-latest
cpp_compiler: clang++
c_compiler: clang
- os: ubuntu-20.04
cpp_compiler: g++
c_compiler: gcc
- os: ubuntu-20.04
cpp_compiler: clang++
c_compiler: clang
2023-12-13 17:27:35 +00:00
- os: macos-11
2023-12-13 17:20:31 +00:00
cpp_compiler: g++
c_compiler: gcc
2023-12-13 17:27:35 +00:00
- os: macos-11
cpp_compiler: clang++
c_compiler: clang
- os: macos-13
cpp_compiler: g++
c_compiler: gcc
- os: macos-13
2023-12-13 17:20:31 +00:00
cpp_compiler: clang++
c_compiler: clang
2023-12-13 15:50:50 +00:00
exclude:
- os: windows-latest
2023-12-13 16:17:50 +00:00
cpp_compiler: g++
2023-12-13 15:50:50 +00:00
- os: windows-latest
2023-12-13 16:17:50 +00:00
cpp_compiler: clang++
2023-12-13 17:42:38 +00:00
- os: windows-2019
cpp_compiler: g++
- os: windows-2019
cpp_compiler: clang++
2023-12-13 15:50:50 +00:00
- os: ubuntu-latest
2023-12-13 16:17:50 +00:00
cpp_compiler: cl
2023-12-13 16:09:23 +00:00
- os: ubuntu-20.04
2023-12-13 16:17:50 +00:00
cpp_compiler: cl
2023-12-13 17:27:35 +00:00
- os: macos-11
cpp_compiler: cl
- os: macos-11
cpp_compiler: cl
- os: macos-13
cpp_compiler: cl
- os: macos-13
2023-12-13 17:20:31 +00:00
cpp_compiler: cl
2020-11-02 03:05:46 +00:00
steps:
2023-12-14 15:20:31 +00:00
- uses: actions/checkout@v4
with:
repository: 'Serge1/ELFIO'
2023-12-13 15:50:50 +00:00
- 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: |
2023-12-13 16:17:50 +00:00
echo "build-output-dir=${{ github.workspace }}/build/${{ matrix.build_type }}/${{ matrix.cpp_compiler }}" >> "$GITHUB_OUTPUT"
2023-12-13 15:50:50 +00:00
2020-11-02 03:05:46 +00:00
- name: Configure CMake
2023-12-13 15:50:50 +00:00
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
2023-12-13 17:12:23 +00:00
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
2023-12-13 15:50:50 +00:00
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DELFIO_BUILD_EXAMPLES=YES -DELFIO_BUILD_TESTS=YES
-S ${{ github.workspace }}
2020-11-02 03:05:46 +00:00
- name: Build
2023-12-13 15:50:50 +00:00
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
2022-02-08 16:05:08 +00:00
- name: Test
2023-12-13 15:50:50 +00:00
working-directory: ${{ steps.strings.outputs.build-output-dir }}
run: ctest --build-config ${{ matrix.build_type }}