Skip to content

fix: macOS build

fix: macOS build #299

Workflow file for this run

name: CI
on:
push:
paths:
- .github/workflows/CI.yml
- CMakeLists.txt
- include/*
- tests/*
- src/*
pull_request:
paths:
- .github/workflows/CI.yml
- CMakeLists.txt
- include/*
- tests/*
- src/*
defaults:
run:
shell: bash
jobs:
unit_tests:
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
cxx-std: [11, 14, 17, 20]
include:
- os: windows-latest
generator: Visual Studio 17
- os: macos-latest
generator: Unix Makefiles
- os: ubuntu-latest
generator: Unix Makefiles
name: ${{ matrix.os }} (C++${{ matrix.cxx-std }} - ${{ matrix.generator }})
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Install libelf
if: ${{ matrix.os == 'ubuntu-latest' }}
run: sudo apt install -y libelf-dev
- name: Generate project files
run: cmake . -B build -G "${{ matrix.generator }}" -DCMAKE_CXX_STANDARD=${{ matrix.cxx-std }} -DDYLIB_BUILD_TESTS=ON -DDYLIB_WARNING_AS_ERRORS=ON
- name: Build dynamic library and unit tests
run: cmake --build build
- name: Run unit tests
working-directory: build
run: ctest --verbose
- name: Generate code coverage
if: ${{ matrix.os == 'ubuntu-latest' && matrix.cxx-std == 20 }}
run: gcov -abcfu build/CMakeFiles/unit_tests.dir/tests/tests.cpp.gcda
- name: Send coverage to codecov.io
if: ${{ matrix.os == 'ubuntu-latest' && matrix.cxx-std == 20 }}
uses: codecov/codecov-action@v3
with:
files: dylib.hpp.gcov
memory_check:
name: memory check
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- name: Update packages
run: sudo apt update
- name: Install valgrind
run: sudo apt install -y valgrind libelf-dev
- name: Generate tests build file
run: cmake . -B build -DCMAKE_CXX_STANDARD=20 -DDYLIB_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Debug
- name: Build unit tests
run: cmake --build build
- name: Run unit tests with valgrind
working-directory: build
run: valgrind --leak-check=full --show-leak-kinds=all --error-exitcode=1 ./unit_tests
linter:
name: linter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install cpplint
run: pip install cpplint
- name: Run cpplint
run: cpplint --linelength=140 --filter=-whitespace/indent,-whitespace/parens,-build/include_subdir,-runtime/references,-readability/casting src/* include/*