checks.yml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. ---
  2. name: Checks
  3. on:
  4. push:
  5. branches:
  6. - master
  7. pull_request: null
  8. env:
  9. DISABLE_TELEMETRY: 1
  10. concurrency:
  11. group: checks-${{ github.ref }}
  12. cancel-in-progress: true
  13. jobs:
  14. file-check: # Check what files changed if we’re being run in a PR or on a push.
  15. name: Check Modified Files
  16. runs-on: ubuntu-latest
  17. outputs:
  18. run: ${{ steps.check-run.outputs.run }}
  19. skip-go: ${{ steps.check-go.outputs.skip-go }}
  20. steps:
  21. - name: Checkout
  22. id: checkout
  23. uses: actions/checkout@v4
  24. with:
  25. fetch-depth: 0
  26. submodules: recursive
  27. - name: Check source files
  28. id: check-source-files
  29. uses: tj-actions/changed-files@v44
  30. with:
  31. since_last_remote_commit: ${{ github.event_name != 'pull_request' }}
  32. files: |
  33. **/*.c
  34. **/*.cc
  35. **/*.h
  36. **/*.hh
  37. **/*.in
  38. **/*.patch
  39. src/aclk/aclk-schemas/
  40. src/ml/dlib/
  41. src/fluent-bit/
  42. src/web/server/h2o/libh2o/
  43. files_ignore: |
  44. netdata.spec.in
  45. **/*.md
  46. - name: Check build files
  47. id: check-build-files
  48. uses: tj-actions/changed-files@v44
  49. with:
  50. since_last_remote_commit: ${{ github.event_name != 'pull_request' }}
  51. files: |
  52. **/*.cmake
  53. CMakeLists.txt
  54. .gitignore
  55. .github/data/distros.yml
  56. .github/workflows/build.yml
  57. packaging/cmake/
  58. packaging/*.version
  59. packaging/*.checksums
  60. files_ignore: |
  61. **/*.md
  62. packaging/repoconfig/
  63. - name: List all changed files in pattern
  64. continue-on-error: true
  65. env:
  66. CHANGED_SOURCE_FILES: ${{ steps.check-source-files.outputs.all_changed_files }}
  67. CHANGED_BUILD_FILES: ${{ steps.check-build-files.outputs.all_changed_files }}
  68. run: |
  69. for file in ${CHANGED_SOURCE_FILES} ${CHANGED_BUILD_FILES} ; do
  70. echo "$file was changed"
  71. done
  72. - name: Check Run
  73. id: check-run
  74. run: |
  75. if [ "${{ steps.check-source-files.outputs.any_modified }}" == "true" ] || [ "${{ steps.check-build-files.outputs.any_modified }}" == "true" ] || [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
  76. echo 'run=true' >> "${GITHUB_OUTPUT}"
  77. else
  78. echo 'run=false' >> "${GITHUB_OUTPUT}"
  79. fi
  80. - name: Check Go
  81. id: check-go
  82. env:
  83. OTHER_CHANGED_FILES: ${{ steps.check-source-files.outputs.other_changed_files }}
  84. run: |
  85. if [ '${{ github.event_name }}' == 'pull_request' ]; then
  86. if echo "${OTHER_CHANGED_FILES}" | grep -q '.*/(.*\.go|go\.mod|go\.sum)$' || [ "${{ steps.check-build-files.outputs.any_modified }}" == "true" ]; then
  87. echo 'skip-go=' >> "${GITHUB_OUTPUT}"
  88. else
  89. echo 'skip-go=--disable-go' >> "${GITHUB_OUTPUT}"
  90. fi
  91. else
  92. echo 'skip-go=' >> "${GITHUB_OUTPUT}"
  93. fi
  94. libressl-checks:
  95. name: LibreSSL
  96. needs:
  97. - file-check
  98. runs-on: ubuntu-latest
  99. steps:
  100. - name: Skip Check
  101. id: skip
  102. if: needs.file-check.outputs.run != 'true'
  103. run: echo "SKIPPED"
  104. - name: Checkout
  105. if: needs.file-check.outputs.run == 'true'
  106. uses: actions/checkout@v4
  107. with:
  108. submodules: recursive
  109. - name: Build
  110. if: needs.file-check.outputs.run == 'true'
  111. run: >
  112. docker run -v "$PWD":/netdata -w /netdata alpine:latest /bin/sh -c
  113. 'apk add bash;
  114. ./packaging/installer/install-required-packages.sh --dont-wait --non-interactive netdata;
  115. apk del openssl openssl-dev;
  116. apk add libressl libressl-dev protobuf-dev;
  117. ./netdata-installer.sh --disable-telemetry --dont-start-it --dont-wait --one-time-build --disable-go;'
  118. clang-checks:
  119. name: Clang
  120. needs:
  121. - file-check
  122. runs-on: ubuntu-latest
  123. steps:
  124. - name: Skip Check
  125. id: skip
  126. if: needs.file-check.outputs.run != 'true'
  127. run: echo "SKIPPED"
  128. - name: Checkout
  129. if: needs.file-check.outputs.run == 'true'
  130. uses: actions/checkout@v4
  131. with:
  132. submodules: recursive
  133. - name: Build
  134. if: needs.file-check.outputs.run == 'true'
  135. run: docker build -f .github/dockerfiles/Dockerfile.clang .
  136. gitignore-check:
  137. name: .gitignore
  138. needs:
  139. - file-check
  140. runs-on: ubuntu-latest
  141. steps:
  142. - name: Skip Check
  143. id: skip
  144. if: needs.file-check.outputs.run != 'true'
  145. run: echo "SKIPPED"
  146. - name: Checkout
  147. if: needs.file-check.outputs.run == 'true'
  148. uses: actions/checkout@v4
  149. with:
  150. submodules: recursive
  151. - name: Prepare environment
  152. if: needs.file-check.outputs.run == 'true'
  153. run: ./packaging/installer/install-required-packages.sh --dont-wait --non-interactive netdata
  154. - name: Build netdata
  155. if: needs.file-check.outputs.run == 'true'
  156. run: ./netdata-installer.sh --dont-start-it --disable-telemetry --dont-wait --install-prefix /tmp/install --one-time-build ${{ needs.file-check.outputs.skip-go }}
  157. - name: Check that repo is clean
  158. if: needs.file-check.outputs.run == 'true'
  159. run: |
  160. git status --porcelain=v1 > /tmp/porcelain
  161. if [ -s /tmp/porcelain ]; then
  162. cat /tmp/porcelain
  163. exit 1
  164. fi