Fix cmake options and yaml #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: Test xapi-cpp | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
build_type: [Release] | |
c_compiler: [gcc, clang] | |
include: | |
- c_compiler: gcc | |
cpp_compiler: g++ | |
- c_compiler: clang | |
cpp_compiler: clang++ | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set reusable strings | |
id: strings | |
shell: bash | |
run: | | |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo add-apt-repository ppa:mhier/libboost-latest -y | |
sudo apt install libboost-system1.83-dev | |
sudo apt install libboost-url1.83-dev | |
sudo apt install libboost-json1.83-dev | |
sudo apt install libjsoncpp-dev libssl-dev libgtest-dev | |
- name: Configure CMake | |
run: > | |
cmake -B ${{ steps.strings.outputs.build-output-dir }} \ | |
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} \ | |
-DBUILD_TESTS=ON \ | |
-S ${{ github.workspace }} | |
- name: Build unit tests | |
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} | |
- name: Run unit tests | |
run: | | |
cd ${{ steps.strings.outputs.build-output-dir }} | |
./test/tests | |
- name: Install Xapi library | |
run: sudo cmake --install ${{ steps.strings.outputs.build-output-dir }} | |
- name: Compile examples | |
run: | | |
cd ${{ github.workspace }}/examples | |
mkdir build | |
cmake -B ${{ github.workspace }}/examples/build \ | |
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} \ | |
-S ${{ github.workspace }}/examples | |
cmake --build ${{ github.workspace }}/examples/build | |