ci.yml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. name: ci
  2. on: [push, pull_request]
  3. jobs:
  4. build_linux:
  5. runs-on: ubuntu-latest
  6. defaults:
  7. run:
  8. shell: bash
  9. strategy:
  10. fail-fast: false
  11. matrix:
  12. config:
  13. - { compiler: gcc, version: 7, build_type: Release, cppstd: 11 }
  14. - { compiler: gcc, version: 9, build_type: Release, cppstd: 17 }
  15. - { compiler: gcc, version: 11, build_type: Debug, cppstd: 20 }
  16. - { compiler: gcc, version: 12, build_type: Release, cppstd: 20 }
  17. - { compiler: clang, version: 12, build_type: Debug, cppstd: 17, asan: OFF }
  18. - { compiler: clang, version: 15, build_type: Release, cppstd: 20, asan: OFF }
  19. container:
  20. image: ${{ matrix.config.compiler == 'clang' && 'teeks99/clang-ubuntu' || matrix.config.compiler }}:${{ matrix.config.version }}
  21. name: "${{ matrix.config.compiler}} ${{ matrix.config.version }} (C++${{ matrix.config.cppstd }}, ${{ matrix.config.build_type }})"
  22. steps:
  23. - uses: actions/checkout@main
  24. - name: Setup
  25. run: |
  26. apt-get update && apt-get install -y curl git pkg-config libsystemd-dev
  27. CMAKE_VERSION="3.24.2"
  28. curl -sSL https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.sh -o install-cmake.sh
  29. chmod +x install-cmake.sh
  30. ./install-cmake.sh --prefix=/usr/local --skip-license
  31. - name: Setup Compiler
  32. if: matrix.config.compiler == 'clang'
  33. run: |
  34. if [[ "${{ matrix.config.version }}" -ge 4 ]]; then
  35. scripts/ci_setup_clang.sh "${{ matrix.config.version }}"
  36. echo "CXXFLAGS=-stdlib=libc++" >> $GITHUB_ENV
  37. fi
  38. echo "CC=clang-${{ matrix.config.version }}" >> $GITHUB_ENV
  39. echo "CXX=clang++-${{ matrix.config.version }}" >> $GITHUB_ENV
  40. - name: Build
  41. run: |
  42. mkdir -p build && cd build
  43. cmake .. \
  44. -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \
  45. -DCMAKE_CXX_STANDARD=${{ matrix.config.cppstd }} \
  46. -DSPDLOG_BUILD_EXAMPLE=${{ matrix.config.examples || 'ON' }} \
  47. -DSPDLOG_BUILD_EXAMPLE_HO=${{ matrix.config.examples || 'ON' }} \
  48. -DSPDLOG_BUILD_WARNINGS=ON \
  49. -DSPDLOG_BUILD_BENCH=OFF \
  50. -DSPDLOG_BUILD_TESTS=ON \
  51. -DSPDLOG_BUILD_TESTS_HO=OFF \
  52. -DSPDLOG_SANITIZE_ADDRESS=${{ matrix.config.asan || 'ON' }}
  53. make -j2
  54. ctest -j2 --output-on-failure
  55. build_osx:
  56. runs-on: macOS-latest
  57. name: "OS X Clang (C++11, Release)"
  58. steps:
  59. - uses: actions/checkout@main
  60. - name: Build
  61. run: |
  62. mkdir -p build && cd build
  63. cmake .. \
  64. -DCMAKE_BUILD_TYPE=Release \
  65. -DCMAKE_CXX_STANDARD=11 \
  66. -DSPDLOG_BUILD_EXAMPLE=ON \
  67. -DSPDLOG_BUILD_EXAMPLE_HO=ON \
  68. -DSPDLOG_BUILD_WARNINGS=ON \
  69. -DSPDLOG_BUILD_BENCH=OFF \
  70. -DSPDLOG_BUILD_TESTS=ON \
  71. -DSPDLOG_BUILD_TESTS_HO=OFF \
  72. -DSPDLOG_SANITIZE_ADDRESS=OFF
  73. make -j2
  74. ctest -j2 --output-on-failure