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" ]
|
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:
|
2022-02-08 15:42:05 +00:00
|
|
|
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:
|
2022-02-25 19:35:43 +00:00
|
|
|
os: [ubuntu-latest, windows-latest]
|
2023-12-13 15:50:50 +00:00
|
|
|
build_type: [Release, Debug]
|
|
|
|
c_compiler: [gcc, clang, cl]
|
|
|
|
include:
|
|
|
|
- os: windows-latest
|
|
|
|
c_compiler: cl
|
|
|
|
cpp_compiler: cl
|
|
|
|
- os: ubuntu-latest
|
|
|
|
c_compiler: gcc
|
|
|
|
cpp_compiler: g++
|
|
|
|
- os: ubuntu-latest
|
|
|
|
c_compiler: clang
|
|
|
|
cpp_compiler: clang++
|
|
|
|
exclude:
|
|
|
|
- os: windows-latest
|
|
|
|
c_compiler: gcc
|
|
|
|
- os: windows-latest
|
|
|
|
c_compiler: clang
|
|
|
|
- os: ubuntu-latest
|
|
|
|
c_compiler: cl
|
2020-11-02 03:05:46 +00:00
|
|
|
|
|
|
|
steps:
|
2022-08-31 17:00:20 +00:00
|
|
|
- uses: actions/checkout@v3
|
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: |
|
|
|
|
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
|
|
|
|
|
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 }}
|
|
|
|
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
|
|
|
|
-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 }}
|