checks.yml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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. - name: List all changed files in pattern
  63. continue-on-error: true
  64. env:
  65. CHANGED_SOURCE_FILES: ${{ steps.check-source-files.outputs.all_changed_files }}
  66. CHANGED_BUILD_FILES: ${{ steps.check-build-files.outputs.all_changed_files }}
  67. run: |
  68. for file in ${CHANGED_SOURCE_FILES} ${CHANGED_BUILD_FILES} ; do
  69. echo "$file was changed"
  70. done
  71. - name: Check Run
  72. id: check-run
  73. run: |
  74. if [ "${{ steps.check-source-files.outputs.any_modified }}" == "true" ] || [ "${{ steps.check-build-files.outputs.any_modified }}" == "true" ] || [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
  75. echo 'run=true' >> "${GITHUB_OUTPUT}"
  76. else
  77. echo 'run=false' >> "${GITHUB_OUTPUT}"
  78. fi
  79. - name: Check Go
  80. id: check-go
  81. env:
  82. OTHER_CHANGED_FILES: ${{ steps.check-source-files.outputs.other_changed_files }}
  83. run: |
  84. if [ '${{ github.event_name }}' == 'pull_request' ]; then
  85. if echo "${OTHER_CHANGED_FILES}" | grep -q '.*/(.*\.go|go\.mod|go\.sum)$' || [ "${{ steps.check-build-files.outputs.any_modified }}" == "true" ]; then
  86. echo 'skip-go=' >> "${GITHUB_OUTPUT}"
  87. else
  88. echo 'skip-go=--disable-go' >> "${GITHUB_OUTPUT}"
  89. fi
  90. else
  91. echo 'skip-go=' >> "${GITHUB_OUTPUT}"
  92. fi
  93. libressl-checks:
  94. name: LibreSSL
  95. needs:
  96. - file-check
  97. runs-on: ubuntu-latest
  98. steps:
  99. - name: Skip Check
  100. id: skip
  101. if: needs.file-check.outputs.run != 'true'
  102. run: echo "SKIPPED"
  103. - name: Checkout
  104. if: needs.file-check.outputs.run == 'true'
  105. uses: actions/checkout@v4
  106. with:
  107. submodules: recursive
  108. - name: Build
  109. if: needs.file-check.outputs.run == 'true'
  110. run: >
  111. docker run -v "$PWD":/netdata -w /netdata alpine:latest /bin/sh -c
  112. 'apk add bash;
  113. ./packaging/installer/install-required-packages.sh --dont-wait --non-interactive netdata;
  114. apk del openssl openssl-dev;
  115. apk add libressl libressl-dev protobuf-dev;
  116. ./netdata-installer.sh --disable-telemetry --dont-start-it --dont-wait --one-time-build --disable-go;'
  117. clang-checks:
  118. name: Clang
  119. needs:
  120. - file-check
  121. runs-on: ubuntu-latest
  122. steps:
  123. - name: Skip Check
  124. id: skip
  125. if: needs.file-check.outputs.run != 'true'
  126. run: echo "SKIPPED"
  127. - name: Checkout
  128. if: needs.file-check.outputs.run == 'true'
  129. uses: actions/checkout@v4
  130. with:
  131. submodules: recursive
  132. - name: Build
  133. if: needs.file-check.outputs.run == 'true'
  134. run: docker build -f .github/dockerfiles/Dockerfile.clang .
  135. gitignore-check:
  136. name: .gitignore
  137. needs:
  138. - file-check
  139. runs-on: ubuntu-latest
  140. steps:
  141. - name: Skip Check
  142. id: skip
  143. if: needs.file-check.outputs.run != 'true'
  144. run: echo "SKIPPED"
  145. - name: Checkout
  146. if: needs.file-check.outputs.run == 'true'
  147. uses: actions/checkout@v4
  148. with:
  149. submodules: recursive
  150. - name: Prepare environment
  151. if: needs.file-check.outputs.run == 'true'
  152. run: ./packaging/installer/install-required-packages.sh --dont-wait --non-interactive netdata
  153. - name: Build netdata
  154. if: needs.file-check.outputs.run == 'true'
  155. run: ./netdata-installer.sh --dont-start-it --disable-telemetry --dont-wait --install-prefix /tmp/install --one-time-build ${{ needs.file-check.outputs.skip-go }}
  156. - name: Check that repo is clean
  157. if: needs.file-check.outputs.run == 'true'
  158. run: |
  159. git status --porcelain=v1 > /tmp/porcelain
  160. if [ -s /tmp/porcelain ]; then
  161. cat /tmp/porcelain
  162. exit 1
  163. fi