build-macos.yml 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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. - name: List all changed files in pattern
  54. continue-on-error: true
  55. env:
  56. ALL_CHANGED_FILES: ${{ steps.check-files.outputs.all_changed_files }}
  57. run: |
  58. for file in ${ALL_CHANGED_FILES}; do
  59. echo "$file was changed"
  60. done
  61. - name: Check Run
  62. id: check-run
  63. run: |
  64. if [ "${{ steps.check-files.outputs.any_modified }}" == "true" ] || [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
  65. echo 'run=true' >> "${GITHUB_OUTPUT}"
  66. else
  67. echo 'run=false' >> "${GITHUB_OUTPUT}"
  68. fi
  69. build-test:
  70. env:
  71. DISABLE_TELEMETRY: 1
  72. runs-on: ${{ matrix.runner }}
  73. needs:
  74. - file-check
  75. strategy:
  76. fail-fast: false
  77. max-parallel: 3
  78. matrix:
  79. include:
  80. - name: macos-12
  81. runner: macos-12
  82. - name: macos-13
  83. runner: macos-13
  84. - name: macos-14-M1
  85. runner: macos-14
  86. steps:
  87. - name: Skip Check
  88. id: skip
  89. if: needs.file-check.outputs.run != 'true'
  90. run: echo "SKIPPED"
  91. - uses: actions/checkout@v4
  92. id: checkout
  93. if: needs.file-check.outputs.run == 'true'
  94. with:
  95. submodules: recursive
  96. - name: Install latest bash
  97. id: install-bash
  98. if: needs.file-check.outputs.run == 'true'
  99. run: |
  100. brew install bash
  101. - name: Install netdata dependencies
  102. id: install-nd-dep
  103. if: needs.file-check.outputs.run == 'true'
  104. run: |
  105. bash ./packaging/installer/install-required-packages.sh --dont-wait --non-interactive netdata
  106. - name: Build from source
  107. id: build-source
  108. if: needs.file-check.outputs.run == 'true'
  109. run: |
  110. sudo bash ./netdata-installer.sh --install-no-prefix /usr/local/netdata --dont-wait --dont-start-it --require-cloud --one-time-build
  111. - name: Test Agent start up
  112. id: test-agent
  113. if: needs.file-check.outputs.run == 'true'
  114. run: |
  115. /usr/local/netdata/usr/sbin/netdata -D > ./netdata.log 2>&1 &
  116. ./packaging/runtime-check.sh
  117. - name: Failure Notification
  118. uses: rtCamp/action-slack-notify@v2
  119. env:
  120. SLACK_COLOR: 'danger'
  121. SLACK_FOOTER: ''
  122. SLACK_ICON_EMOJI: ':github-actions:'
  123. SLACK_TITLE: 'Build & test from source macOS failed:'
  124. SLACK_USERNAME: 'GitHub Actions'
  125. SLACK_MESSAGE: |-
  126. ${{ github.repository }}: macOS Build and test.
  127. Checkout: ${{ steps.checkout.outcome }}
  128. Setup runner: ${{ steps.install-bash.outcome }}
  129. Install netdata required packages: ${{ steps.install-nd-dep.outcome }}
  130. Build from source: ${{ steps.build-source.outcome }}
  131. Test Agent runtime: ${{ steps.test-agent.outcome }}
  132. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  133. if: >-
  134. ${{
  135. failure()
  136. && startsWith(github.ref, 'refs/heads/master')
  137. && github.event_name != 'pull_request'
  138. && github.repository == 'netdata/netdata'
  139. }}