fix(ci): install spdlog and fmt dependencies for log module #3
This file contains hidden or 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: Log Strict CI | |
| on: | |
| push: | |
| branches: [main, master, dev] | |
| paths: | |
| - ".github/workflows/log-strict-ci.yml" | |
| - "CMakeLists.txt" | |
| - "cmake/**" | |
| - "include/**" | |
| - "src/**" | |
| - "test/**" | |
| - "README.md" | |
| - "CHANGELOG.md" | |
| - "vix.json" | |
| pull_request: | |
| branches: [main, master, dev] | |
| paths: | |
| - ".github/workflows/log-strict-ci.yml" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| env: | |
| DEPS: > | |
| build-essential | |
| cmake | |
| ninja-build | |
| clang | |
| llvm | |
| lld | |
| g++ | |
| cppcheck | |
| clang-tidy | |
| valgrind | |
| pkg-config | |
| git | |
| libspdlog-dev | |
| libfmt-dev | |
| BUILD_JOBS: 2 | |
| VIX_GIT_BRANCH: dev | |
| jobs: | |
| build-test-sanitized: | |
| name: Sanitized Build and Tests (${{ matrix.compiler }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| compiler: [clang, gcc] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Fetch dependency | |
| run: | | |
| rm -rf ../utils | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/utils.git ../utils | |
| - name: Verify dependency | |
| run: | | |
| test -f ../utils/CMakeLists.txt || exit 1 | |
| - name: Install deps | |
| run: | | |
| sudo apt-get update -y | |
| sudo apt-get install -y $DEPS | |
| - name: Select compiler | |
| run: | | |
| if [ "${{ matrix.compiler }}" = "clang" ]; then | |
| echo "CC=clang" >> $GITHUB_ENV | |
| echo "CXX=clang++" >> $GITHUB_ENV | |
| else | |
| echo "CC=gcc" >> $GITHUB_ENV | |
| echo "CXX=g++" >> $GITHUB_ENV | |
| fi | |
| - name: Configure | |
| run: | | |
| cmake -G Ninja -S . -B build \ | |
| -DCMAKE_BUILD_TYPE=Debug \ | |
| -DVIX_LOG_BUILD_TESTS=ON \ | |
| -DVIX_ENABLE_SANITIZERS=ON \ | |
| -DVIX_LOG_FETCH_UTILS=OFF | |
| - name: Build | |
| run: cmake --build build -j${BUILD_JOBS} | |
| - name: Run tests | |
| run: ctest --test-dir build --output-on-failure | |
| static-analysis: | |
| name: Static Analysis | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Fetch dependency | |
| run: | | |
| rm -rf ../utils | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/utils.git ../utils | |
| - name: Install deps | |
| run: | | |
| sudo apt-get update -y | |
| sudo apt-get install -y $DEPS | |
| - name: Configure | |
| run: | | |
| cmake -G Ninja -S . -B build \ | |
| -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ | |
| -DVIX_LOG_BUILD_TESTS=ON \ | |
| -DVIX_LOG_FETCH_UTILS=OFF | |
| - name: clang-tidy | |
| run: | | |
| find src test -name '*.cpp' | xargs -r clang-tidy -p build || true | |
| - name: cppcheck | |
| run: | | |
| cppcheck --enable=all --std=c++20 include src test || true | |
| valgrind: | |
| name: Valgrind | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Fetch dependency | |
| run: | | |
| rm -rf ../utils | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/utils.git ../utils | |
| - name: Install deps | |
| run: | | |
| sudo apt-get update -y | |
| sudo apt-get install -y $DEPS | |
| - name: Configure | |
| run: | | |
| cmake -G Ninja -S . -B build \ | |
| -DVIX_LOG_BUILD_TESTS=ON \ | |
| -DVIX_LOG_FETCH_UTILS=OFF | |
| - name: Build | |
| run: cmake --build build -j${BUILD_JOBS} | |
| - name: Run valgrind | |
| run: | | |
| for exe in $(find build/test -type f -executable); do | |
| valgrind --leak-check=full "$exe" || true | |
| done | |
| package-smoke: | |
| name: Package Smoke | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Fetch dependency | |
| run: | | |
| rm -rf ../utils | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/utils.git ../utils | |
| - name: Install deps | |
| run: | | |
| sudo apt-get update -y | |
| sudo apt-get install -y $DEPS | |
| - name: Install utils | |
| run: | | |
| cmake -S ../utils -B ../utils/build \ | |
| -DCMAKE_INSTALL_PREFIX=$PWD/stage | |
| cmake --build ../utils/build | |
| cmake --install ../utils/build | |
| - name: Install log | |
| run: | | |
| cmake -S . -B build \ | |
| -DCMAKE_PREFIX_PATH=$PWD/stage \ | |
| -DCMAKE_INSTALL_PREFIX=$PWD/stage \ | |
| -DVIX_LOG_FETCH_UTILS=OFF | |
| cmake --build build | |
| cmake --install build | |
| - name: Smoke test | |
| run: | | |
| mkdir smoke | |
| cat > smoke/CMakeLists.txt <<EOF | |
| cmake_minimum_required(VERSION 3.20) | |
| project(log_smoke) | |
| find_package(vix_log CONFIG REQUIRED) | |
| add_executable(main main.cpp) | |
| target_link_libraries(main vix::log) | |
| EOF | |
| echo '#include <iostream> | |
| int main(){std::cout<<"ok";}' > smoke/main.cpp | |
| cmake -S smoke -B smoke/build -DCMAKE_PREFIX_PATH=$PWD/stage | |
| cmake --build smoke/build | |
| summary: | |
| name: Summary | |
| needs: [build-test-sanitized, static-analysis, valgrind, package-smoke] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - run: echo "Log strict CI passed" |