build-macos.yml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. ---
  2. # CI code for build and test on macOS
  3. name: macOS Build and test
  4. on:
  5. push: # Master branch checks only validate the build and generate artifacts for testing.
  6. branches:
  7. - master
  8. pull_request: null # PR checks only validate the build and generate artifacts for testing.
  9. concurrency:
  10. group: ${{ github.workflow }}-${{ github.ref }}
  11. jobs:
  12. file-check: # Check what files changed if we’re being run in a PR or on a push.
  13. name: Check Modified Files
  14. runs-on: ubuntu-latest
  15. outputs:
  16. run: ${{ steps.check-run.outputs.run }}
  17. steps:
  18. - name: Checkout
  19. id: checkout
  20. uses: actions/checkout@v4
  21. with:
  22. fetch-depth: 0
  23. submodules: recursive
  24. - name: Check files
  25. id: check-files
  26. uses: tj-actions/changed-files@v44
  27. with:
  28. since_last_remote_commit: ${{ github.event_name != 'pull_request' }}
  29. files: |
  30. **/*.c
  31. **/*.cc
  32. **/*.h
  33. **/*.hh
  34. **/*.in
  35. **/*.patch
  36. **/*.cmake
  37. CMakeLists.txt
  38. netdata-installer.sh
  39. .github/workflows/build-macos.yml
  40. .github/scripts/run-updater-check.sh
  41. packaging/cmake/
  42. packaging/installer/
  43. packaging/*.sh
  44. packaging/*.version
  45. packaging/*.checksums
  46. src/aclk/aclk-schemas/
  47. src/ml/dlib/
  48. src/fluent-bit/
  49. src/web/server/h2o/libh2o/
  50. files_ignore: |
  51. netdata.spec.in
  52. **/*.md
  53. packaging/repoconfig/
  54. - name: List all changed files in pattern
  55. continue-on-error: true
  56. env:
  57. ALL_CHANGED_FILES: ${{ steps.check-files.outputs.all_changed_files }}
  58. run: |
  59. for file in ${ALL_CHANGED_FILES}; do
  60. echo "$file was changed"
  61. done
  62. - name: Check Run
  63. id: check-run
  64. run: |
  65. if [ "${{ steps.check-files.outputs.any_modified }}" == "true" ] || [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
  66. echo 'run=true' >> "${GITHUB_OUTPUT}"
  67. else
  68. echo 'run=false' >> "${GITHUB_OUTPUT}"
  69. fi
  70. build-test:
  71. env:
  72. DISABLE_TELEMETRY: 1
  73. runs-on: ${{ matrix.runner }}
  74. needs:
  75. - file-check
  76. strategy:
  77. fail-fast: false
  78. max-parallel: 3
  79. matrix:
  80. include:
  81. - name: macos-12
  82. runner: macos-12
  83. - name: macos-13
  84. runner: macos-13
  85. - name: macos-14-M1
  86. runner: macos-14
  87. steps:
  88. - name: Skip Check
  89. id: skip
  90. if: needs.file-check.outputs.run != 'true'
  91. run: echo "SKIPPED"
  92. - uses: actions/checkout@v4
  93. id: checkout
  94. if: needs.file-check.outputs.run == 'true'
  95. with:
  96. submodules: recursive
  97. - name: Install latest bash
  98. id: install-bash
  99. if: needs.file-check.outputs.run == 'true'
  100. run: |
  101. brew install bash
  102. - name: Install netdata dependencies
  103. id: install-nd-dep
  104. if: needs.file-check.outputs.run == 'true'
  105. run: |
  106. bash ./packaging/installer/install-required-packages.sh --dont-wait --non-interactive netdata-all
  107. - name: Build from source
  108. id: build-source
  109. if: needs.file-check.outputs.run == 'true'
  110. run: |
  111. sudo bash ./netdata-installer.sh --install-no-prefix /usr/local/netdata --dont-wait --dont-start-it --require-cloud --one-time-build
  112. - name: Test Agent start up
  113. id: test-agent
  114. if: needs.file-check.outputs.run == 'true'
  115. run: |
  116. /usr/local/netdata/usr/sbin/netdata -D > ./netdata.log 2>&1 &
  117. ./packaging/runtime-check.sh
  118. - name: Failure Notification
  119. uses: rtCamp/action-slack-notify@v2
  120. env:
  121. SLACK_COLOR: 'danger'
  122. SLACK_FOOTER: ''
  123. SLACK_ICON_EMOJI: ':github-actions:'
  124. SLACK_TITLE: 'Build & test from source macOS failed:'
  125. SLACK_USERNAME: 'GitHub Actions'
  126. SLACK_MESSAGE: |-
  127. ${{ github.repository }}: macOS Build and test.
  128. Checkout: ${{ steps.checkout.outcome }}
  129. Setup runner: ${{ steps.install-bash.outcome }}
  130. Install netdata required packages: ${{ steps.install-nd-dep.outcome }}
  131. Build from source: ${{ steps.build-source.outcome }}
  132. Test Agent runtime: ${{ steps.test-agent.outcome }}
  133. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  134. if: >-
  135. ${{
  136. failure()
  137. && startsWith(github.ref, 'refs/heads/master')
  138. && github.event_name != 'pull_request'
  139. && github.repository == 'netdata/netdata'
  140. }}