Skip to content

Feature/setup ci

Feature/setup ci #45

Workflow file for this run

---
name: CMake
on:
pull_request:
merge_group:
push:
branches:
- 'master'
- 'releases/**'
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
# XXX BUILD_TYPE: Debug
CTEST_OUTPUT_ON_FAILURE: 1
CMAKE_EXPORT_COMPILE_COMMANDS: 1
CCACHE_DIR: ${{ github.workspace }}/.ccache
CPM_SOURCE_CACHE: ${{ github.workspace }}/cpm_modules
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [macos, ubuntu]
BUILD_TYPE: [Debug, Release]
runs-on: ${{ matrix.os }}-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
"**/.ccache"
"**/cpm_modules"
key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}
- uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip' # caching pip dependencies
- run: |
sudo python -m pip install --upgrade pip
sudo pip install -U -r requirements.txt
- name: Setup Cpp
if: startsWith(matrix.os, 'ubuntu')
uses: aminya/setup-cpp@v1
with:
clangtidy: true
clangformat: true
- name: Install boost libs and ccache on macos
if: startsWith(matrix.os, 'macos')
shell: bash
run: |
brew install boost ccache
- name: Install boost filesystem libs on ubuntu
if: startsWith(matrix.os, 'ubuntu')
shell: bash
run: |
sudo apt-get install libboost-filesystem-dev
- name: Configure CMake
run: cmake -G Ninja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.BUILD_TYPE}}
- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{matrix.BUILD_TYPE}}
- name: Test
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
run: sudo ctest -C ${{matrix.BUILD_TYPE}}
- name: TestCoverage
if: startsWith(matrix.BUILD_TYPE, 'Debug')
run: gcovr -e option_test.cpp -e tftpd_test.cpp .
- name: Install
if: startsWith(matrix.BUILD_TYPE, 'Rel')
working-directory: ${{github.workspace}}/build
run: cpack -C ${{matrix.BUILD_TYPE}}