tests.yml 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. DO_NOT_TRACK: 1
  19. jobs:
  20. unit-tests-legacy:
  21. name: Unit Tests (legacy)
  22. runs-on: ubuntu-latest
  23. steps:
  24. - name: Checkout
  25. uses: actions/checkout@v2
  26. with:
  27. submodules: recursive
  28. - name: Prepare environment
  29. run: |
  30. ./packaging/installer/install-required-packages.sh --dont-wait --non-interactive netdata-all
  31. sudo apt-get install -y libjson-c-dev libipmimonitoring-dev libcups2-dev libsnappy-dev \
  32. libprotobuf-dev libprotoc-dev libssl-dev protobuf-compiler \
  33. libnetfilter-acct-dev
  34. - name: Run ./tests/run-unit-tests.sh
  35. env:
  36. CFLAGS: "-O1 -DNETDATA_INTERNAL_CHECKS=1 -DNETDATA_VERIFY_LOCKS=1"
  37. run: |
  38. ./tests/run-unit-tests.sh
  39. unit-tests-cmocka:
  40. name: Unit Tests (cmocka)
  41. runs-on: ubuntu-latest
  42. steps:
  43. - name: Checkout
  44. uses: actions/checkout@v2
  45. with:
  46. submodules: recursive
  47. - name: Prepare environment
  48. run: |
  49. ./packaging/installer/install-required-packages.sh --dont-wait --non-interactive netdata-all
  50. sudo apt-get install -y libjson-c-dev libipmimonitoring-dev libcups2-dev libsnappy-dev \
  51. libprotobuf-dev libprotoc-dev libssl-dev protobuf-compiler \
  52. libnetfilter-acct-dev libmongoc-dev libcmocka-dev libzstd-dev
  53. - name: Configure
  54. run: |
  55. autoreconf -ivf
  56. ./configure
  57. # XXX: Work-around for bug with libbson-1.0 in Ubuntu 18.04
  58. # See: https://bugs.launchpad.net/ubuntu/+source/libmongoc/+bug/1790771
  59. # https://jira.mongodb.org/browse/CDRIVER-2818
  60. - name: Fix libbson
  61. run: |
  62. pushd /usr/lib || exit 1
  63. sudo ln -s /usr/include .
  64. popd || exit 1
  65. - name: Build
  66. run: |
  67. mkdir build-tmp
  68. cd build-tmp
  69. cmake \
  70. -D UNIT_TESTING=1 \
  71. -D BUILD_TESTING=1 \
  72. -D CMAKE_BUILD_TYPE="Debug" \
  73. -D BSON_LIBRARY=/usr/lib/x86_64-linux-gnu/libbson-1.0.so \
  74. -D MONGOC_LIBRARY=/usr/lib/x86_64-linux-gnu/libmongoc-1.0.so \
  75. ..
  76. make
  77. - name: Run ctest
  78. run: |
  79. cd build-tmp
  80. ctest
  81. - name: Prepare Artifacts
  82. if: always()
  83. run: |
  84. mkdir logs
  85. pushd build-tmp || exit 1
  86. find . -type f -name '*.log' -exec cp {} ../logs/ \;
  87. popd || exit 1
  88. - name: Upload Artifacts
  89. uses: actions/upload-artifact@v2.2.4
  90. if: always()
  91. with:
  92. name: logs
  93. path: logs