Feature/setup ci #28
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
--- | |
name: CMake | |
on: | |
pull_request: | |
merge_group: | |
push: | |
branches: | |
- 'master' | |
- 'releases/**' | |
env: | |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
BUILD_TYPE: Debug | |
CTEST_OUTPUT_ON_FAILURE: 1 | |
CPM_SOURCE_CACHE: ${{ github.workspace }}/cpm_modules | |
CCACHE_DIR: ${{ github.workspace }}/.ccache | |
jobs: | |
build: | |
strategy: | |
fail-fast: true | |
matrix: | |
os: [macos, ubuntu] | |
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 -r requirements.txt | |
- name: Setup Cpp | |
if: startsWith(matrix.os, 'ubuntu') | |
uses: aminya/setup-cpp@v1 | |
with: | |
llvm: true | |
ccache: true | |
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=${{env.BUILD_TYPE}} | |
- name: Build | |
# Build your program with the given configuration | |
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} | |
- name: Test | |
working-directory: ${{github.workspace}}/build | |
# Execute tests defined by the CMake configuration. | |
run: sudo ctest -C ${{env.BUILD_TYPE}} --verbose | |
- name: TestCoverage | |
run: gcovr -e option_test.cpp -e tftpd_test.cpp . |