CI.yml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. name: CI
  2. on:
  3. push:
  4. branches: [ master ]
  5. paths-ignore:
  6. - '**.md'
  7. - 'LICENSE'
  8. pull_request:
  9. types: [opened, synchronize]
  10. paths-ignore:
  11. - '**.md'
  12. - 'LICENSE'
  13. jobs:
  14. linux:
  15. runs-on: ubuntu-latest
  16. if: "!contains(github.event.head_commit.message, 'ci skip')"
  17. strategy:
  18. fail-fast: false
  19. matrix:
  20. mem_check:
  21. - ENABLE_VALGRIND
  22. - ENABLE_SANITIZERS
  23. - NONE_MEM_CHECK
  24. compiler:
  25. - GCC
  26. - CLANG
  27. steps:
  28. - uses: actions/checkout@v2
  29. - name: install build dependencies
  30. run: |
  31. sudo apt-get update
  32. sudo apt-get install clang-8 valgrind
  33. - name: build and test
  34. shell: bash
  35. run: |
  36. if [ "${{ matrix.mem_check }}" == "ENABLE_VALGRIND" ]; then
  37. EVENT_CMAKE_OPTIONS="-DENABLE_CJSON_UTILS=ON -DENABLE_VALGRIND=ON -DENABLE_SAFE_STACK=ON -DENABLE_SANITIZERS=OFF"
  38. elif [ "${{ matrix.mem_check }}" == "ENABLE_SANITIZERS" ]; then
  39. EVENT_CMAKE_OPTIONS="-DENABLE_CJSON_UTILS=ON -DENABLE_VALGRIND=OFF -DENABLE_SAFE_STACK=OFF -DENABLE_SANITIZERS=ON"
  40. else
  41. EVENT_CMAKE_OPTIONS="-DENABLE_CJSON_UTILS=ON -DENABLE_VALGRIND=OFF -DENABLE_SAFE_STACK=OFF -DENABLE_SANITIZERS=OFF"
  42. fi
  43. if [ "${{ matrix.compiler }}" == "GCC" ]; then
  44. export CC=gcc
  45. else
  46. export CC=clang
  47. fi
  48. #run build and test
  49. JOBS=20
  50. export CTEST_PARALLEL_LEVEL=$JOBS
  51. export CTEST_OUTPUT_ON_FAILURE=1
  52. mkdir -p build
  53. cd build
  54. echo [cmake]: cmake .. $EVENT_CMAKE_OPTIONS
  55. cmake .. $EVENT_CMAKE_OPTIONS || (rm -rf * && cmake .. $EVENT_CMAKE_OPTIONS)
  56. cmake --build .
  57. make
  58. make test
  59. macos:
  60. runs-on: macos-latest
  61. if: "!contains(github.event.head_commit.message, 'ci skip')"
  62. strategy:
  63. fail-fast: false
  64. matrix:
  65. mem_check:
  66. - ENABLE_VALGRIND
  67. - ENABLE_SANITIZERS
  68. - NONE_MEM_CHECK
  69. compiler:
  70. - GCC
  71. - CLANG
  72. steps:
  73. - uses: actions/checkout@v2
  74. - name: build and test
  75. shell: bash
  76. run: |
  77. if [ "${{ matrix.mem_check }}" == "ENABLE_VALGRIND" ]; then
  78. EVENT_CMAKE_OPTIONS="-DENABLE_CJSON_UTILS=ON -DENABLE_VALGRIND=ON -DENABLE_SAFE_STACK=ON -DENABLE_SANITIZERS=OFF"
  79. elif [ "${{ matrix.mem_check }}" == "ENABLE_SANITIZERS" ]; then
  80. EVENT_CMAKE_OPTIONS="-DENABLE_CJSON_UTILS=ON -DENABLE_VALGRIND=OFF -DENABLE_SAFE_STACK=OFF -DENABLE_SANITIZERS=ON"
  81. else
  82. EVENT_CMAKE_OPTIONS="-DENABLE_CJSON_UTILS=ON -DENABLE_VALGRIND=OFF -DENABLE_SAFE_STACK=OFF -DENABLE_SANITIZERS=OFF"
  83. fi
  84. if [ "${{ matrix.compiler }}" == "GCC" ]; then
  85. export CC=gcc
  86. else
  87. export CC=clang
  88. fi
  89. #run build and test
  90. JOBS=20
  91. export CTEST_PARALLEL_LEVEL=$JOBS
  92. export CTEST_OUTPUT_ON_FAILURE=1
  93. mkdir -p build
  94. cd build
  95. echo [cmake]: cmake .. $EVENT_CMAKE_OPTIONS
  96. cmake .. $EVENT_CMAKE_OPTIONS || (rm -rf * && cmake .. $EVENT_CMAKE_OPTIONS)
  97. cmake --build .
  98. make
  99. make test