Update c-cpp.yml

This commit is contained in:
Serge Lamikhov-Center 2023-12-13 17:50:50 +02:00 committed by GitHub
parent 4bc17b6b81
commit 418e97d258
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,32 +2,60 @@ name: C/C++ CI
on: on:
push: push:
branches: [ main ] branches: [ "main" ]
pull_request: pull_request:
branches: [ main ] branches: [ "main" ]
env:
BUILD_TYPE: Release
jobs: jobs:
build_cmake: build:
name: CMake Build & Test name: CMake Build & Test
runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
os: [ubuntu-latest, windows-latest] os: [ubuntu-latest, windows-latest]
build_type: [Release] build_type: [Release, Debug]
c_compiler: [gcc, clang, cl]
runs-on: ${{ matrix.os }} 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
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Configure CMake
run: cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DELFIO_BUILD_EXAMPLES=YES -DELFIO_BUILD_TESTS=YES - name: Set reusable strings
- name: Build # Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
run: cmake --build build --config ${{ matrix.build_type }} id: strings
- name: Test shell: bash
run: | run: |
cd build echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
ctest -C ${{ matrix.build_type }}
cd .. - name: Configure CMake
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 }}
- name: Build
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
- name: Test
working-directory: ${{ steps.strings.outputs.build-output-dir }}
run: ctest --build-config ${{ matrix.build_type }}