tests.yml 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. ---
  2. # Runs Tests on Pushes to `master` and Pull Requests
  3. name: Tests
  4. on:
  5. push:
  6. branches:
  7. - master
  8. paths:
  9. - 'CMakeLists.txt'
  10. - '**.c'
  11. - '**.h'
  12. pull_request:
  13. paths:
  14. - 'CMakeLists.txt'
  15. - '**.c'
  16. - '**.h'
  17. env:
  18. DISABLE_TELEMETRY: 1
  19. concurrency:
  20. group: tests-${{ github.ref }}
  21. cancel-in-progress: true
  22. jobs:
  23. unit-tests-legacy:
  24. name: Unit Tests (legacy)
  25. runs-on: ubuntu-latest
  26. steps:
  27. - name: Checkout
  28. uses: actions/checkout@v3
  29. with:
  30. submodules: recursive
  31. - name: Prepare environment
  32. run: |
  33. ./packaging/installer/install-required-packages.sh --dont-wait --non-interactive netdata-all
  34. sudo apt-get install -y libjson-c-dev libipmimonitoring-dev libcups2-dev libsnappy-dev \
  35. libprotobuf-dev libprotoc-dev libssl-dev protobuf-compiler \
  36. libnetfilter-acct-dev
  37. - name: Run ./tests/run-unit-tests.sh
  38. env:
  39. CFLAGS: "-O1 -DNETDATA_INTERNAL_CHECKS=1 -DNETDATA_VERIFY_LOCKS=1"
  40. run: |
  41. ./tests/run-unit-tests.sh
  42. unit-tests-cmocka:
  43. name: Unit Tests (cmocka)
  44. runs-on: ubuntu-latest
  45. steps:
  46. - name: Checkout
  47. uses: actions/checkout@v3
  48. with:
  49. submodules: recursive
  50. - name: Prepare environment
  51. run: |
  52. ./packaging/installer/install-required-packages.sh --dont-wait --non-interactive netdata-all
  53. sudo apt-get install -y libjson-c-dev libipmimonitoring-dev libcups2-dev libsnappy-dev \
  54. libprotobuf-dev libprotoc-dev libssl-dev protobuf-compiler \
  55. libnetfilter-acct-dev libmongoc-dev libcmocka-dev libzstd-dev
  56. - name: Configure
  57. run: |
  58. autoreconf -ivf
  59. ./configure --disable-ml --disable-dependency-tracking
  60. # XXX: Work-around for bug with libbson-1.0 in Ubuntu 18.04
  61. # See: https://bugs.launchpad.net/ubuntu/+source/libmongoc/+bug/1790771
  62. # https://jira.mongodb.org/browse/CDRIVER-2818
  63. - name: Fix libbson
  64. run: |
  65. pushd /usr/lib || exit 1
  66. sudo ln -s /usr/include .
  67. popd || exit 1
  68. - name: Build
  69. run: |
  70. mkdir build-tmp
  71. cd build-tmp
  72. cmake \
  73. -D UNIT_TESTING=1 \
  74. -D BUILD_TESTING=1 \
  75. -D CMAKE_BUILD_TYPE="Debug" \
  76. -D BSON_LIBRARY=/usr/lib/x86_64-linux-gnu/libbson-1.0.so \
  77. -D MONGOC_LIBRARY=/usr/lib/x86_64-linux-gnu/libmongoc-1.0.so \
  78. ..
  79. make
  80. - name: Run ctest
  81. run: |
  82. cd build-tmp
  83. ctest
  84. - name: Prepare Artifacts
  85. if: always()
  86. run: |
  87. mkdir logs
  88. pushd build-tmp || exit 1
  89. find . -type f -name '*.log' -exec cp {} ../logs/ \;
  90. popd || exit 1
  91. - name: Upload Artifacts
  92. uses: actions/upload-artifact@v3
  93. if: always()
  94. with:
  95. name: logs
  96. path: logs