@cryptotaxi247 / netdata-1 / commits / 8fb2d8bcf

Add macos check (build from source) (#17139)

* MacOS build from source and test Signed-off-by: Tasos Katsoulas <tasos@netdata.cloud> * Setup notification Signed-off-by: Tasos Katsoulas <tasos@netdata.cloud> * Apply code review Signed-off-by: Tasos Katsoulas <tasos@netdata.cloud> * new line char Signed-off-by: Tasos Katsoulas <tasos@netdata.cloud> --------- Signed-off-by: Tasos Katsoulas <tasos@netdata.cloud>

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