build.yml 48 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237
  1. ---
  2. # CI code for building release artifacts.
  3. name: Build
  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. workflow_dispatch: # Dispatch runs build and does limited validation, then pushes to the appropriate storage location.
  10. inputs:
  11. type:
  12. description: Build Type
  13. default: nightly
  14. required: true
  15. version:
  16. description: Version Tag
  17. default: nightly
  18. required: true
  19. concurrency: # This keeps multiple instances of the job from running concurrently for the same ref and event type.
  20. group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
  21. cancel-in-progress: true
  22. jobs:
  23. file-check: # Check what files changed if we’re being run in a PR or on a push.
  24. name: Check Modified Files
  25. runs-on: ubuntu-latest
  26. outputs:
  27. run: ${{ steps.check-run.outputs.run }}
  28. skip-go: ${{ steps.check-go.outputs.skip-go }}
  29. steps:
  30. - name: Checkout
  31. id: checkout
  32. uses: actions/checkout@v4
  33. with:
  34. fetch-depth: 0
  35. submodules: recursive
  36. - name: Check source files
  37. id: check-source-files
  38. uses: tj-actions/changed-files@v45
  39. with:
  40. since_last_remote_commit: ${{ github.event_name != 'pull_request' }}
  41. files: |
  42. **/*.c
  43. **/*.cc
  44. **/*.h
  45. **/*.hh
  46. **/*.in
  47. **/*.patch
  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: Check build files
  56. id: check-build-files
  57. uses: tj-actions/changed-files@v45
  58. with:
  59. since_last_remote_commit: ${{ github.event_name != 'pull_request' }}
  60. files: |
  61. **/*.cmake
  62. CMakeLists.txt
  63. netdata-installer.sh
  64. .github/data/distros.yml
  65. .github/workflows/build.yml
  66. .github/scripts/build-static.sh
  67. .github/scripts/get-static-cache-key.sh
  68. .github/scripts/gen-matrix-build.py
  69. .github/scripts/run-updater-check.sh
  70. packaging/cmake/
  71. packaging/makeself/
  72. packaging/installer/
  73. packaging/windows/
  74. packaging/*.sh
  75. packaging/*.version
  76. packaging/*.checksums
  77. files_ignore: |
  78. **/*.md
  79. packaging/repoconfig/
  80. - name: List all changed files in pattern
  81. continue-on-error: true
  82. if: github.event_name != 'workflow_dispatch'
  83. env:
  84. CHANGED_SOURCE_FILES: ${{ steps.check-source-files.outputs.all_changed_files }}
  85. CHANGED_BUILD_FILES: ${{ steps.check-build-files.outputs.all_changed_files }}
  86. run: |
  87. for file in ${CHANGED_SOURCE_FILES} ${CHANGED_BUILD_FILES} ; do
  88. echo "$file was changed"
  89. done
  90. - name: Check Run
  91. id: check-run
  92. run: |
  93. if [ "${{ steps.check-source-files.outputs.any_modified }}" == "true" ] || [ "${{ steps.check-build-files.outputs.any_modified }}" == "true" ] || [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
  94. echo 'run=true' >> "${GITHUB_OUTPUT}"
  95. else
  96. echo 'run=false' >> "${GITHUB_OUTPUT}"
  97. fi
  98. - name: Check Go
  99. id: check-go
  100. run: |
  101. if [ '${{ github.event_name }}' == 'pull_request' ]; then
  102. if echo "${{ steps.check-source-files.outputs.other_changed_files }}" | grep -q '.*/(.*\.go|go\.mod|go\.sum)$' || [ "${{ steps.check-build-files.outputs.any_modified }}" == "true" ]; then
  103. echo 'skip-go=' >> "${GITHUB_OUTPUT}"
  104. else
  105. echo 'skip-go=--disable-go' >> "${GITHUB_OUTPUT}"
  106. fi
  107. else
  108. echo 'skip-go=' >> "${GITHUB_OUTPUT}"
  109. fi
  110. build-dist: # Build the distribution tarball and store it as an artifact.
  111. name: Build Distribution Tarball
  112. runs-on: ubuntu-latest
  113. needs:
  114. - file-check
  115. outputs:
  116. distfile: ${{ steps.build.outputs.distfile }}
  117. steps:
  118. - name: Skip Check
  119. id: skip
  120. if: needs.file-check.outputs.run != 'true'
  121. run: echo "SKIPPED"
  122. - name: Checkout
  123. id: checkout
  124. if: needs.file-check.outputs.run == 'true'
  125. uses: actions/checkout@v4
  126. with:
  127. fetch-depth: 0
  128. submodules: recursive
  129. - name: Fix tags
  130. id: fix-tags
  131. if: github.event_name != 'push' && needs.file-check.outputs.run == 'true'
  132. run: |
  133. git fetch --tags --force
  134. - name: Mark Stable
  135. id: channel
  136. if: github.event_name == 'workflow_dispatch' && github.event.inputs.type != 'nightly' && needs.file-check.outputs.run == 'true'
  137. run: |
  138. sed -i 's/^RELEASE_CHANNEL="nightly"/RELEASE_CHANNEL="stable"/' netdata-installer.sh
  139. - name: Build
  140. id: build
  141. if: needs.file-check.outputs.run == 'true'
  142. run: |
  143. mkdir -p artifacts/
  144. tar --create --file "artifacts/netdata-$(git describe).tar.gz" \
  145. --sort=name --posix --auto-compress --exclude=artifacts/ --exclude=.git \
  146. --exclude=.gitignore --exclude=.gitattributes --exclude=.gitmodules \
  147. --transform "s/^\\.\\//netdata-$(git describe)\\//" --verbose .
  148. cd artifacts/
  149. echo "distfile=$(find . -name 'netdata-*.tar.gz')" >> "${GITHUB_OUTPUT}"
  150. - name: Store
  151. id: store
  152. if: needs.file-check.outputs.run == 'true'
  153. uses: actions/upload-artifact@v4.4.2
  154. with:
  155. name: dist-tarball
  156. path: artifacts/*.tar.gz
  157. retention-days: 30
  158. - name: Failure Notification
  159. uses: rtCamp/action-slack-notify@v2
  160. env:
  161. SLACK_COLOR: 'danger'
  162. SLACK_FOOTER: ''
  163. SLACK_ICON_EMOJI: ':github-actions:'
  164. SLACK_TITLE: 'Distribution tarball creation failed:'
  165. SLACK_USERNAME: 'GitHub Actions'
  166. SLACK_MESSAGE: |-
  167. ${{ github.repository }}: Failed to create source tarball for distribution.
  168. Checkout: ${{ steps.checkout.outcome }}
  169. Fix Tags: ${{ steps.fix-tags.outcome }}
  170. Mark stable: ${{ steps.channel.outcome }}
  171. Build: ${{ steps.build.outcome }}
  172. Store: ${{ steps.store.outcome }}
  173. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  174. if: >-
  175. ${{
  176. failure()
  177. && startsWith(github.ref, 'refs/heads/master')
  178. && github.event_name != 'pull_request'
  179. && github.repository == 'netdata/netdata'
  180. && needs.file-check.outputs.run == 'true'
  181. }}
  182. build-static: # Build the static binary archives, and store them as artifacts.
  183. name: Build Static
  184. runs-on: ubuntu-latest
  185. needs:
  186. - file-check
  187. strategy:
  188. matrix:
  189. arch:
  190. - x86_64
  191. - armv6l
  192. - armv7l
  193. - aarch64
  194. - ppc64le
  195. steps:
  196. - name: Skip Check
  197. id: skip
  198. if: needs.file-check.outputs.run != 'true'
  199. run: echo "SKIPPED"
  200. - name: Checkout
  201. id: checkout
  202. if: needs.file-check.outputs.run == 'true'
  203. uses: actions/checkout@v4
  204. with:
  205. fetch-depth: 0
  206. submodules: recursive
  207. - name: Fix tags
  208. id: fix-tags
  209. if: github.event_name != 'push' && needs.file-check.outputs.run == 'true'
  210. run: |
  211. git fetch --tags --force
  212. - name: Mark Stable
  213. id: channel
  214. if: github.event_name == 'workflow_dispatch' && github.event.inputs.type != 'nightly' && needs.file-check.outputs.run == 'true'
  215. run: |
  216. sed -i 's/^RELEASE_CHANNEL="nightly"/RELEASE_CHANNEL="stable"/' netdata-installer.sh packaging/makeself/install-or-update.sh
  217. - name: Get Cache Key
  218. if: (github.event_name != 'pull_request' || ! contains(github.event.pull_request.labels.*.name, 'run-ci/no-cache')) && needs.file-check.outputs.run == 'true'
  219. id: cache-key
  220. run: .github/scripts/get-static-cache-key.sh ${{ matrix.arch }} "${{ contains(github.event.pull_request.labels.*.name, 'run-ci/no-cache') }}"
  221. - name: Cache
  222. if: (github.event_name != 'pull_request' || ! contains(github.event.pull_request.labels.*.name, 'run-ci/no-cache')) && needs.file-check.outputs.run == 'true'
  223. id: cache
  224. uses: actions/cache@v4
  225. with:
  226. path: artifacts/cache
  227. key: ${{ steps.cache-key.outputs.key }}
  228. - name: Build
  229. if: github.event_name != 'workflow_dispatch' && needs.file-check.outputs.run == 'true' # Don’t use retries on PRs.
  230. run: |
  231. export EXTRA_INSTALL_FLAGS=${{ needs.file-check.outputs.skip-go }}
  232. .github/scripts/build-static.sh ${{ matrix.arch }}
  233. - name: Build
  234. if: github.event_name == 'workflow_dispatch' && needs.file-check.outputs.run == 'true'
  235. id: build
  236. uses: nick-fields/retry@v3
  237. with:
  238. timeout_minutes: 180
  239. max_attempts: 3
  240. command: |
  241. export EXTRA_INSTALL_FLAGS=${{ needs.file-check.outputs.skip-go }}
  242. .github/scripts/build-static.sh ${{ matrix.arch }}
  243. - name: Store
  244. id: store
  245. if: needs.file-check.outputs.run == 'true'
  246. uses: actions/upload-artifact@v4.4.2
  247. with:
  248. name: dist-static-${{ matrix.arch }}
  249. path: artifacts/*.gz.run
  250. retention-days: 30
  251. - name: Failure Notification
  252. uses: rtCamp/action-slack-notify@v2
  253. env:
  254. SLACK_COLOR: 'danger'
  255. SLACK_FOOTER: ''
  256. SLACK_ICON_EMOJI: ':github-actions:'
  257. SLACK_TITLE: 'Static build failed:'
  258. SLACK_USERNAME: 'GitHub Actions'
  259. SLACK_MESSAGE: |-
  260. ${{ github.repository }}: Failed to create static installer archive for ${{ matrix.arch }}.
  261. Checkout: ${{ steps.checkout.outcome }}
  262. Fix Tags: ${{ steps.fix-tags.outcome }}
  263. Mark stable: ${{ steps.channel.outcome }}
  264. Build: ${{ steps.build.outcome }}
  265. Store: ${{ steps.store.outcome }}
  266. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  267. if: >-
  268. ${{
  269. failure()
  270. && startsWith(github.ref, 'refs/heads/master')
  271. && github.event_name != 'pull_request'
  272. && github.repository == 'netdata/netdata'
  273. && needs.file-check.outputs.run == 'true'
  274. }}
  275. windows-build: # Test building on Windows
  276. name: Test building on Windows
  277. runs-on: windows-latest
  278. needs:
  279. - file-check
  280. steps:
  281. - name: Skip Check
  282. id: skip
  283. if: needs.file-check.outputs.run != 'true'
  284. run: Write-Output "SKIPPED"
  285. - name: Checkout
  286. uses: actions/checkout@v4
  287. id: checkout
  288. if: needs.file-check.outputs.run == 'true'
  289. with:
  290. submodules: recursive
  291. lfs: true
  292. - name: Set Up Go
  293. id: golang
  294. if: needs.file-check.outputs.run == 'true'
  295. uses: actions/setup-go@v5
  296. with:
  297. go-version: "^1.22"
  298. - name: Set Up Dependencies
  299. id: deps
  300. if: needs.file-check.outputs.run == 'true'
  301. run: ./packaging/windows/install-dependencies.ps1
  302. - name: Build Netdata
  303. id: build
  304. if: needs.file-check.outputs.run == 'true'
  305. env:
  306. BUILD_DIR: ${{ github.workspace }}\build
  307. run: ./packaging/windows/build.ps1
  308. - name: Sign Agent Code
  309. id: sign-agent
  310. if: needs.file-check.outputs.run == 'true' && github.event_name != 'pull_request'
  311. uses: azure/trusted-signing-action@v0.5.0
  312. with:
  313. azure-tenant-id: ${{ secrets.CODE_SIGNING_TENNANT_ID }}
  314. azure-client-id: ${{ secrets.CODE_SIGNING_CLIENT_ID }}
  315. azure-client-secret: ${{ secrets.CODE_SIGNING_CLIENT_SECRET }}
  316. endpoint: "https://eus.codesigning.azure.net/"
  317. trusted-signing-account-name: Netdata
  318. certificate-profile-name: Netdata
  319. files-folder: ${{ github.workspace }}\build
  320. files-folder-filter: exe,dll
  321. files-folder-recurse: true
  322. file-digest: SHA256
  323. timestamp-rfc3161: "http://timestamp.acs.microsoft.com"
  324. timestamp-digest: SHA256
  325. - name: Package Netdata
  326. id: package
  327. if: needs.file-check.outputs.run == 'true'
  328. env:
  329. BUILD_DIR: ${{ github.workspace }}\build
  330. run: ./packaging/windows/package.ps1
  331. - name: Sign Installer
  332. id: sign-installer
  333. if: needs.file-check.outputs.run == 'true' && github.event_name != 'pull_request'
  334. uses: azure/trusted-signing-action@v0.5.0
  335. with:
  336. azure-tenant-id: ${{ secrets.CODE_SIGNING_TENNANT_ID }}
  337. azure-client-id: ${{ secrets.CODE_SIGNING_CLIENT_ID }}
  338. azure-client-secret: ${{ secrets.CODE_SIGNING_CLIENT_SECRET }}
  339. endpoint: "https://eus.codesigning.azure.net/"
  340. trusted-signing-account-name: Netdata
  341. certificate-profile-name: Netdata
  342. files-folder: ${{ github.workspace }}\packaging\windows
  343. files-folder-filter: msi
  344. file-digest: SHA256
  345. timestamp-rfc3161: "http://timestamp.acs.microsoft.com"
  346. timestamp-digest: SHA256
  347. - name: Upload Installer
  348. id: upload
  349. uses: actions/upload-artifact@v4.4.2
  350. with:
  351. name: windows-x86_64-installer
  352. path: packaging\windows\netdata*.msi
  353. retention-days: 30
  354. - name: Failure Notification
  355. uses: rtCamp/action-slack-notify@v2
  356. env:
  357. SLACK_COLOR: 'danger'
  358. SLACK_FOOTER: ''
  359. SLACK_ICON_EMOJI: ':github-actions:'
  360. SLACK_TITLE: 'Windows build failed:'
  361. SLACK_USERNAME: 'GitHub Actions'
  362. SLACK_MESSAGE: |-
  363. ${{ github.repository }}: Updater checks for ${{ matrix.distro }} failed.
  364. Checkout: ${{ steps.checkout.outcome }}
  365. Set Up Dependencies: ${{ steps.deps.outcome }}
  366. Build Netdata: ${{ steps.build.outcome }}
  367. Sign Agent Code: ${{ steps.sign-agent.outcome }}
  368. Package Netdata: ${{ steps.package.outcome }}
  369. Sign Installer: ${{ steps.sign-installer.outcome }}
  370. Upload Installer: ${{ steps.upload.outcome }}
  371. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  372. if: >-
  373. ${{
  374. failure()
  375. && startsWith(github.ref, 'refs/heads/master')
  376. && github.event_name != 'pull_request'
  377. && github.repository == 'netdata/netdata'
  378. && needs.file-check.outputs.run == 'true'
  379. }}
  380. prepare-upload: # Consolidate the artifacts for uploading or releasing.
  381. name: Prepare Artifacts
  382. runs-on: ubuntu-latest
  383. needs:
  384. - build-dist
  385. - build-static
  386. - windows-build
  387. - file-check
  388. steps:
  389. - name: Skip Check
  390. id: skip
  391. if: needs.file-check.outputs.run != 'true'
  392. run: echo "SKIPPED"
  393. - name: Checkout
  394. id: checkout
  395. if: needs.file-check.outputs.run == 'true'
  396. uses: actions/checkout@v4
  397. - name: Prepare Environment
  398. id: prepare
  399. if: needs.file-check.outputs.run == 'true'
  400. run: mkdir -p artifacts
  401. - name: Retrieve Build Artifacts
  402. id: fetch-dist
  403. if: needs.file-check.outputs.run == 'true'
  404. uses: Wandalen/wretry.action@v3
  405. with:
  406. action: actions/download-artifact@v4
  407. with: |
  408. pattern: dist-*
  409. path: dist-artifacts
  410. merge-multiple: true
  411. attempt_limit: 3
  412. attempt_delay: 2000
  413. - name: Retrieve Windows Artifacts
  414. id: fetch-windows
  415. if: needs.file-check.outputs.run == 'true' && github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'nightly'
  416. uses: Wandalen/wretry.action@v3
  417. with:
  418. action: actions/download-artifact@v4
  419. with: |
  420. pattern: windows-*-installer
  421. path: dist-artifacts
  422. merge-multiple: true
  423. attempt_limit: 3
  424. attempt_delay: 2000
  425. - name: Prepare Artifacts
  426. id: consolidate
  427. if: needs.file-check.outputs.run == 'true'
  428. working-directory: ./artifacts/
  429. run: |
  430. mv ../dist-artifacts/* . || exit 1
  431. ln -s ${{ needs.build-dist.outputs.distfile }} netdata-latest.tar.gz || exit 1
  432. cp ../packaging/version ./latest-version.txt || exit 1
  433. cp ../integrations/integrations.js ./integrations.js || exit 1
  434. sha256sum -b ./* > sha256sums.txt || exit 1
  435. cat sha256sums.txt
  436. - name: Store Artifacts
  437. id: store
  438. if: needs.file-check.outputs.run == 'true'
  439. uses: actions/upload-artifact@v4.4.2
  440. with:
  441. name: final-artifacts
  442. path: artifacts/*
  443. retention-days: 30
  444. - name: Failure Notification
  445. uses: rtCamp/action-slack-notify@v2
  446. env:
  447. SLACK_COLOR: 'danger'
  448. SLACK_FOOTER: ''
  449. SLACK_ICON_EMOJI: ':github-actions:'
  450. SLACK_TITLE: 'Failed to prepare release artifacts for upload:'
  451. SLACK_USERNAME: 'GitHub Actions'
  452. SLACK_MESSAGE: |-
  453. ${{ github.repository }}: Failed to prepare release artifacts for upload.
  454. Checkout: ${{ steps.checkout.outcome }}
  455. Prepare environment: ${{ steps.prepare.outcome }}
  456. Fetch dist artifacts: ${{ steps.fetch-dist.outcome }}
  457. Fetch Windows installers: ${{ steps.fetch-windows.outcome }}
  458. Consolidate artifacts: ${{ steps.consolidate.outcome }}
  459. Store: ${{ steps.store.outcome }}
  460. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  461. if: >-
  462. ${{
  463. failure()
  464. && startsWith(github.ref, 'refs/heads/master')
  465. && github.event_name != 'pull_request'
  466. && github.repository == 'netdata/netdata'
  467. && needs.file-check.outputs.run == 'true'
  468. }}
  469. artifact-verification-dist: # Verify the regular installer works with the consolidated artifacts.
  470. name: Test Consolidated Artifacts (Source)
  471. runs-on: ubuntu-latest
  472. needs:
  473. - prepare-upload
  474. - file-check
  475. services:
  476. apache: # This gets used to serve the dist tarball for the updater script.
  477. image: httpd:2.4
  478. ports:
  479. - 8080:80
  480. volumes:
  481. - ${{ github.workspace }}:/usr/local/apache2/htdocs/
  482. steps:
  483. - name: Skip Check
  484. id: skip
  485. if: needs.file-check.outputs.run != 'true'
  486. run: echo "SKIPPED"
  487. - name: Checkout
  488. id: checkout
  489. if: needs.file-check.outputs.run == 'true'
  490. uses: actions/checkout@v4
  491. - name: Fetch artifacts
  492. id: fetch
  493. if: needs.file-check.outputs.run == 'true'
  494. uses: Wandalen/wretry.action@v3
  495. with:
  496. action: actions/download-artifact@v4
  497. with: |
  498. name: final-artifacts
  499. path: artifacts
  500. attempt_limit: 3
  501. attempt_delay: 2000
  502. - name: Prepare artifacts directory
  503. id: prepare
  504. if: needs.file-check.outputs.run == 'true'
  505. run: |
  506. mkdir -p download/latest
  507. mv artifacts/* download/latest
  508. ls -al download/latest
  509. - name: Verify that artifacts work with installer
  510. id: verify
  511. if: needs.file-check.outputs.run == 'true'
  512. env:
  513. NETDATA_TARBALL_BASEURL: http://localhost:8080/
  514. run: sh -x packaging/installer/kickstart.sh --build-only --dont-start-it --disable-telemetry --dont-wait
  515. - name: Failure Notification
  516. uses: rtCamp/action-slack-notify@v2
  517. env:
  518. SLACK_COLOR: 'danger'
  519. SLACK_FOOTER: ''
  520. SLACK_ICON_EMOJI: ':github-actions:'
  521. SLACK_TITLE: 'Artifact verification for source tarball failed.'
  522. SLACK_USERNAME: 'GitHub Actions'
  523. SLACK_MESSAGE: |-
  524. ${{ github.repository }}: Artifact verification for source tarball failed.
  525. Checkout: ${{ steps.checkout.outcome }}
  526. Fetch artifacts: ${{ steps.fetch.outcome }}
  527. Verify artifacts: ${{ steps.verify.outcome }}
  528. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  529. if: >-
  530. ${{
  531. failure()
  532. && startsWith(github.ref, 'refs/heads/master')
  533. && github.event_name != 'pull_request'
  534. && github.repository == 'netdata/netdata'
  535. && needs.file-check.outputs.run == 'true'
  536. }}
  537. artifact-verification-static: # Verify the static installer works with the consolidated artifacts.
  538. name: Test Consolidated Artifacts (Static)
  539. runs-on: ubuntu-latest
  540. needs:
  541. - prepare-upload
  542. - file-check
  543. services:
  544. apache: # This gets used to serve the static archives.
  545. image: httpd:2.4
  546. ports:
  547. - 8080:80
  548. volumes:
  549. - ${{ github.workspace }}:/usr/local/apache2/htdocs/
  550. steps:
  551. - name: Skip Check
  552. id: skip
  553. if: needs.file-check.outputs.run != 'true'
  554. run: echo "SKIPPED"
  555. - name: Checkout
  556. id: checkout
  557. if: needs.file-check.outputs.run == 'true'
  558. uses: actions/checkout@v4
  559. - name: Fetch artifacts
  560. id: fetch-artifacts
  561. if: needs.file-check.outputs.run == 'true'
  562. uses: Wandalen/wretry.action@v3
  563. with:
  564. action: actions/download-artifact@v4
  565. with: |
  566. name: final-artifacts
  567. path: artifacts
  568. attempt_limit: 3
  569. attempt_delay: 2000
  570. - name: Prepare artifacts directory
  571. id: prepare
  572. if: needs.file-check.outputs.run == 'true'
  573. run: |
  574. mkdir -p download/latest
  575. mv artifacts/* download/latest
  576. ls -al download/latest
  577. - name: Verify that artifacts work with installer
  578. id: verify
  579. if: needs.file-check.outputs.run == 'true'
  580. env:
  581. NETDATA_TARBALL_BASEURL: http://localhost:8080/
  582. run: sh -x packaging/installer/kickstart.sh --static-only --dont-start-it --disable-telemetry
  583. - name: Failure Notification
  584. uses: rtCamp/action-slack-notify@v2
  585. env:
  586. SLACK_COLOR: 'danger'
  587. SLACK_FOOTER: ''
  588. SLACK_ICON_EMOJI: ':github-actions:'
  589. SLACK_TITLE: 'Artifact verification for static build failed.'
  590. SLACK_USERNAME: 'GitHub Actions'
  591. SLACK_MESSAGE: |-
  592. ${{ github.repository }}: Artifact verification for static build failed.
  593. Checkout: ${{ steps.checkout.outcome }}
  594. Fetch artifacts: ${{ steps.fetch-artifacts.outcome }}
  595. Verify artifacts: ${{ steps.verify.outcome }}
  596. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  597. if: >-
  598. ${{
  599. failure()
  600. && startsWith(github.ref, 'refs/heads/master')
  601. && github.event_name != 'pull_request'
  602. && github.repository == 'netdata/netdata'
  603. && needs.file-check.outputs.run == 'true'
  604. }}
  605. create-nightly: # Create a nightly build release in netdata/netdata-nightlies
  606. name: Create Nightly Release
  607. runs-on: ubuntu-latest
  608. if: github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'nightly' && github.repository == 'netdata/netdata'
  609. needs:
  610. - prepare-upload
  611. - artifact-verification-dist
  612. - artifact-verification-static
  613. steps:
  614. - name: Checkout Main Repo
  615. id: checkout-main
  616. uses: actions/checkout@v4
  617. with:
  618. path: main
  619. - name: Checkout Nightly Repo
  620. id: checkout-nightly
  621. uses: actions/checkout@v4
  622. with:
  623. repository: netdata/netdata-nightlies
  624. path: nightlies
  625. token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
  626. - name: Retrieve Artifacts
  627. id: fetch
  628. uses: Wandalen/wretry.action@v3
  629. with:
  630. action: actions/download-artifact@v4
  631. with: |
  632. name: final-artifacts
  633. path: final-artifacts
  634. attempt_limit: 3
  635. attempt_delay: 2000
  636. - name: Prepare version info
  637. id: version
  638. run: |
  639. # shellcheck disable=SC2129
  640. echo "version=$(cat main/packaging/version)" >> "${GITHUB_OUTPUT}"
  641. echo "commit=$(cd nightlies && git rev-parse HEAD)" >> "${GITHUB_OUTPUT}"
  642. echo "date=$(date +%F)" >> "${GITHUB_OUTPUT}"
  643. - name: Create Release
  644. id: create-release
  645. uses: ncipollo/release-action@v1
  646. with:
  647. allowUpdates: false
  648. artifactErrorsFailBuild: true
  649. artifacts: 'final-artifacts/sha256sums.txt,final-artifacts/netdata-*.tar.gz,final-artifacts/netdata-*.gz.run,final-artifacts/netdata-*.msi,final-artifacts/integrations.js'
  650. owner: netdata
  651. repo: netdata-nightlies
  652. body: Netdata nightly build for ${{ steps.version.outputs.date }}.
  653. commit: ${{ steps.version.outputs.commit }}
  654. makeLatest: true
  655. tag: ${{ steps.version.outputs.version }}
  656. token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
  657. - name: Checkout netdata main Repo # Checkout back to netdata/netdata repo to the update latest packaged versions
  658. id: checkout-netdata
  659. uses: actions/checkout@v4
  660. with:
  661. token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
  662. - name: Init python environment for publish release metadata
  663. uses: actions/setup-python@v5
  664. id: init-python
  665. with:
  666. python-version: "3.12"
  667. - name: Setup python environment
  668. id: setup-python
  669. run: |
  670. pip install -r .github/scripts/modules/requirements.txt
  671. - name: Check if the version is latest and published
  672. id: check-latest-version
  673. run: |
  674. python .github/scripts/check_latest_versions.py ${{ steps.version.outputs.version }}
  675. - name: SSH setup
  676. id: ssh-setup
  677. if: github.event_name == 'workflow_dispatch' && github.repository == 'netdata/netdata' && steps.check-latest-version.outputs.versions_needs_update == 'true'
  678. uses: shimataro/ssh-key-action@v2
  679. with:
  680. key: ${{ secrets.NETDATABOT_PACKAGES_SSH_KEY }}
  681. name: id_ecdsa
  682. known_hosts: ${{ secrets.PACKAGES_KNOWN_HOSTS }}
  683. - name: Sync release info to packages.netdata.cloud
  684. id: sync-releases
  685. continue-on-error: true
  686. if: github.event_name == 'workflow_dispatch' && github.repository == 'netdata/netdata' && steps.check-latest-version.outputs.versions_needs_update == 'true'
  687. run: |
  688. .github/scripts/upload-new-version-tags.sh packages.netdata.cloud
  689. - name: Sync release info to packages2.netdata.cloud
  690. id: sync-releases2
  691. if: github.event_name == 'workflow_dispatch' && github.repository == 'netdata/netdata' && steps.check-latest-version.outputs.versions_needs_update == 'true'
  692. run: |
  693. .github/scripts/upload-new-version-tags.sh packages.netdata.cloud
  694. - name: Failure Notification
  695. uses: rtCamp/action-slack-notify@v2
  696. env:
  697. SLACK_COLOR: 'danger'
  698. SLACK_FOOTER: ''
  699. SLACK_ICON_EMOJI: ':github-actions:'
  700. SLACK_TITLE: 'Failed to draft release:'
  701. SLACK_USERNAME: 'GitHub Actions'
  702. SLACK_MESSAGE: |-
  703. ${{ github.repository }}: Failed to create nightly release or attach artifacts.
  704. Checkout netdata/netdata: ${{ steps.checkout-main.outcome }}
  705. Checkout netdata/netdata-nightlies: ${{ steps.checkout-nightly.outcome }}
  706. Fetch artifacts: ${{ steps.fetch.outcome }}
  707. Prepare version info: ${{ steps.version.outcome }}
  708. Create release: ${{ steps.create-release.outcome }}
  709. Checkout back netdata/netdata: ${{ steps.checkout-netdata.outcome }}
  710. Init python environment: ${{ steps.init-python.outcome }}
  711. Setup python environment: ${{ steps.setup-python.outcome }}
  712. Check the nearly published release against the advertised: ${{ steps.check-latest-version.outcome }}
  713. Setup ssh: ${{ steps.ssh-setup.outcome }}
  714. Sync release info to packages.netdata.cloud: ${{ steps.sync-releases.outcome }}
  715. Sync release info to packages2.netdata.cloud: ${{ steps.sync-releases2.outcome }}
  716. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  717. if: >-
  718. ${{
  719. failure()
  720. && github.event_name == 'workflow_dispatch'
  721. }}
  722. normalize-tag: # Fix the release tag if needed
  723. name: Normalize Release Tag
  724. runs-on: ubuntu-latest
  725. if: github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'release'
  726. outputs:
  727. tag: ${{ steps.tag.outputs.tag }}
  728. steps:
  729. - name: Normalize Tag
  730. id: tag
  731. run: |
  732. if echo ${{ github.event.inputs.version }} | grep -qE '^[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$'; then
  733. echo "tag=v${{ github.event.inputs.version }}" >> "${GITHUB_OUTPUT}"
  734. else
  735. echo "tag=${{ github.event.inputs.version }}" >> "${GITHUB_OUTPUT}"
  736. fi
  737. upload-release: # Create the draft release and upload the build artifacts.
  738. name: Create Release Draft
  739. runs-on: ubuntu-latest
  740. if: github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'release' && github.repository == 'netdata/netdata'
  741. needs:
  742. - artifact-verification-dist
  743. - artifact-verification-static
  744. - normalize-tag
  745. steps:
  746. - name: Checkout
  747. id: checkout
  748. uses: actions/checkout@v4
  749. - name: Retrieve Artifacts
  750. id: fetch
  751. uses: Wandalen/wretry.action@v3
  752. with:
  753. action: actions/download-artifact@v4
  754. with: |
  755. name: final-artifacts
  756. path: final-artifacts
  757. attempt_limit: 3
  758. attempt_delay: 2000
  759. - name: Create Release
  760. id: create-release
  761. uses: ncipollo/release-action@v1
  762. with:
  763. allowUpdates: false
  764. artifactErrorsFailBuild: true
  765. artifacts: 'final-artifacts/sha256sums.txt,final-artifacts/netdata-*.tar.gz,final-artifacts/netdata-*.gz.run,final-artifacts/netdata-*.msi,final-artifacts/integrations.js'
  766. draft: true
  767. tag: ${{ needs.normalize-tag.outputs.tag }}
  768. token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
  769. - name: Failure Notification
  770. uses: rtCamp/action-slack-notify@v2
  771. env:
  772. SLACK_COLOR: 'danger'
  773. SLACK_FOOTER: ''
  774. SLACK_ICON_EMOJI: ':github-actions:'
  775. SLACK_TITLE: 'Failed to draft release:'
  776. SLACK_USERNAME: 'GitHub Actions'
  777. SLACK_MESSAGE: |-
  778. ${{ github.repository }}: Failed to create draft release or attach artifacts.
  779. Checkout: ${{ steps.checkout.outcome }}
  780. Fetch artifacts: ${{ steps.fetch.outcome }}
  781. Create draft release: ${{ steps.create-release.outcome }}
  782. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  783. if: >-
  784. ${{
  785. failure()
  786. && github.event_name == 'workflow_dispatch'
  787. }}
  788. - name: Success Notification
  789. uses: rtCamp/action-slack-notify@v2
  790. env:
  791. SLACK_COLOR: 'good'
  792. SLACK_FOOTER: ''
  793. SLACK_ICON_EMOJI: ':github-actions:'
  794. SLACK_TITLE: 'Created agent draft release:'
  795. SLACK_USERNAME: 'GitHub Actions'
  796. SLACK_MESSAGE: "${{ github.repository }}: ${{ steps.create-release.outputs.html_url }}"
  797. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  798. if: >-
  799. ${{
  800. success()
  801. && github.event_name == 'workflow_dispatch'
  802. }}
  803. # Remaining jobs are only used for CI checks, and not as part of the release process
  804. matrix: # Generate the shared build matrix for our Linux build tests.
  805. name: Prepare Build Matrix
  806. runs-on: ubuntu-latest
  807. if: github.event_name != 'workflow_dispatch'
  808. outputs:
  809. matrix: ${{ steps.set-matrix.outputs.matrix }}
  810. steps:
  811. - name: Checkout
  812. id: checkout
  813. uses: actions/checkout@v4
  814. - name: Prepare tools
  815. id: prepare
  816. run: |
  817. sudo apt-get update || true
  818. sudo apt-get install -y python3-ruamel.yaml
  819. - name: Read build matrix
  820. id: set-matrix
  821. run: |
  822. matrix="$(.github/scripts/gen-matrix-build.py)"
  823. echo "Generated matrix: ${matrix}"
  824. echo "matrix=${matrix}" >> "${GITHUB_OUTPUT}"
  825. - name: Failure Notification
  826. uses: rtCamp/action-slack-notify@v2
  827. env:
  828. SLACK_COLOR: 'danger'
  829. SLACK_FOOTER: ''
  830. SLACK_ICON_EMOJI: ':github-actions:'
  831. SLACK_TITLE: 'Build matrix preparation failed:'
  832. SLACK_USERNAME: 'GitHub Actions'
  833. SLACK_MESSAGE: |-
  834. ${{ github.repository }}: Failed to prepare build matrix for build checks.
  835. Checkout: ${{ steps.checkout.outcome }}
  836. Prepare tools: ${{ steps.prepare.outcome }}
  837. Read build matrix: ${{ steps.set-matrix.outcome }}
  838. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  839. if: >-
  840. ${{
  841. failure()
  842. && startsWith(github.ref, 'refs/heads/master')
  843. && github.event_name != 'pull_request'
  844. && github.repository == 'netdata/netdata'
  845. }}
  846. prepare-test-images: # Prepare the test environments for our build checks. This also checks dependency handling code for each tested environment.
  847. name: Prepare Test Environments
  848. runs-on: ubuntu-latest
  849. if: github.event_name != 'workflow_dispatch'
  850. needs:
  851. - matrix
  852. env:
  853. RETRY_DELAY: 300
  854. strategy:
  855. # Unlike the actual build tests, this completes _very_ fast (average of about 3 minutes for each job), so we
  856. # just run everything in parallel instead lof limiting job concurrency.
  857. fail-fast: false
  858. matrix: ${{ fromJson(needs.matrix.outputs.matrix) }}
  859. steps:
  860. - name: Checkout
  861. id: checkout
  862. uses: actions/checkout@v4
  863. - name: Setup Buildx
  864. id: buildx
  865. uses: docker/setup-buildx-action@v3
  866. - name: Build test environment
  867. id: build1
  868. uses: docker/build-push-action@v6
  869. continue-on-error: true # We retry 3 times at 5 minute intervals if there is a failure here.
  870. with:
  871. push: false
  872. load: false
  873. file: .github/dockerfiles/Dockerfile.build_test
  874. build-args: |
  875. BASE=${{ matrix.distro }}
  876. PRE=${{ matrix.env_prep }}
  877. RMJSONC=${{ matrix.jsonc_removal }}
  878. outputs: type=docker,dest=/tmp/image.tar
  879. tags: test:${{ matrix.artifact_key }}
  880. - name: Retry delay
  881. if: ${{ steps.build1.outcome == 'failure' }}
  882. run: sleep "${RETRY_DELAY}"
  883. - name: Build test environment (attempt 2)
  884. if: ${{ steps.build1.outcome == 'failure' }}
  885. id: build2
  886. uses: docker/build-push-action@v6
  887. continue-on-error: true # We retry 3 times at 5 minute intervals if there is a failure here.
  888. with:
  889. push: false
  890. load: false
  891. file: .github/dockerfiles/Dockerfile.build_test
  892. build-args: |
  893. BASE=${{ matrix.distro }}
  894. PRE=${{ matrix.env_prep }}
  895. RMJSONC=${{ matrix.jsonc_removal }}
  896. outputs: type=docker,dest=/tmp/image.tar
  897. tags: test:${{ matrix.artifact_key }}
  898. - name: Retry delay
  899. if: ${{ steps.build1.outcome == 'failure' && steps.build2.outcome == 'failure' }}
  900. run: sleep "${RETRY_DELAY}"
  901. - name: Build test environment (attempt 3)
  902. if: ${{ steps.build1.outcome == 'failure' && steps.build2.outcome == 'failure' }}
  903. id: build3
  904. uses: docker/build-push-action@v6
  905. with:
  906. push: false
  907. load: false
  908. file: .github/dockerfiles/Dockerfile.build_test
  909. build-args: |
  910. BASE=${{ matrix.distro }}
  911. PRE=${{ matrix.env_prep }}
  912. RMJSONC=${{ matrix.jsonc_removal }}
  913. outputs: type=docker,dest=/tmp/image.tar
  914. tags: test:${{ matrix.artifact_key }}
  915. - name: Upload image artifact
  916. id: upload
  917. uses: actions/upload-artifact@v4.4.2
  918. with:
  919. name: ${{ matrix.artifact_key }}-test-env
  920. path: /tmp/image.tar
  921. retention-days: 30
  922. - name: Failure Notification
  923. uses: rtCamp/action-slack-notify@v2
  924. env:
  925. SLACK_COLOR: 'danger'
  926. SLACK_FOOTER: ''
  927. SLACK_ICON_EMOJI: ':github-actions:'
  928. SLACK_TITLE: 'Test environment preparation for ${{ matrix.distro }} failed:'
  929. SLACK_USERNAME: 'GitHub Actions'
  930. SLACK_MESSAGE: |-
  931. ${{ github.repository }}: Test environment preparation for ${{ matrix.distro }} failed.
  932. Checkout: ${{ steps.checkout.outcome }}
  933. Set up Buildx: ${{ steps.buildx.outcome }}
  934. Build test environment: ${{ steps.build1.outcome }}
  935. Build test environment (attempt 2): ${{ steps.build2.outcome }}
  936. Build test environment (attempt 3): ${{ steps.build3.outcome }}
  937. Upload: ${{ steps.upload.outcome }}
  938. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  939. if: >-
  940. ${{
  941. failure()
  942. && startsWith(github.ref, 'refs/heads/master')
  943. && github.event_name != 'pull_request'
  944. && github.repository == 'netdata/netdata'
  945. }}
  946. source-build: # Test various source build arrangements.
  947. name: Test Source Build
  948. runs-on: ubuntu-latest
  949. if: github.event_name != 'workflow_dispatch'
  950. needs:
  951. - matrix
  952. - prepare-test-images
  953. - file-check
  954. strategy:
  955. fail-fast: false
  956. max-parallel: 8
  957. matrix: ${{ fromJson(needs.matrix.outputs.matrix) }}
  958. steps:
  959. - name: Skip Check
  960. id: skip
  961. if: needs.file-check.outputs.run != 'true'
  962. run: echo "SKIPPED"
  963. - name: Checkout
  964. id: checkout
  965. if: needs.file-check.outputs.run == 'true'
  966. uses: actions/checkout@v4
  967. with:
  968. submodules: recursive
  969. - name: Fetch test environment
  970. id: fetch
  971. if: needs.file-check.outputs.run == 'true'
  972. uses: Wandalen/wretry.action@v3
  973. with:
  974. action: actions/download-artifact@v4
  975. with: |
  976. name: ${{ matrix.artifact_key }}-test-env
  977. path: .
  978. attempt_limit: 3
  979. attempt_delay: 2000
  980. - name: Load test environment
  981. id: load
  982. if: needs.file-check.outputs.run == 'true'
  983. run: docker load --input image.tar
  984. - name: netdata-installer on ${{ matrix.distro }}, require cloud
  985. id: build-cloud
  986. if: needs.file-check.outputs.run == 'true'
  987. run: |
  988. docker run --security-opt seccomp=unconfined -w /netdata test:${{ matrix.artifact_key }} \
  989. /bin/sh -c './netdata-installer.sh --dont-wait --dont-start-it --one-time-build ${{ needs.file-check.outputs.skip-go }}'
  990. - name: netdata-installer on ${{ matrix.distro }}, require cloud, no JSON-C
  991. id: build-no-jsonc
  992. if: matrix.jsonc_removal != '' && needs.file-check.outputs.run == 'true'
  993. run: |
  994. docker run --security-opt seccomp=unconfined -w /netdata test:${{ matrix.artifact_key }} \
  995. /bin/sh -c '/rmjsonc.sh && ./netdata-installer.sh --dont-wait --dont-start-it --one-time-build ${{ needs.file-check.outputs.skip-go }}'
  996. - name: Failure Notification
  997. uses: rtCamp/action-slack-notify@v2
  998. env:
  999. SLACK_COLOR: 'danger'
  1000. SLACK_FOOTER: ''
  1001. SLACK_ICON_EMOJI: ':github-actions:'
  1002. SLACK_TITLE: 'Build tests for ${{ matrix.distro }} failed:'
  1003. SLACK_USERNAME: 'GitHub Actions'
  1004. SLACK_MESSAGE: |-
  1005. ${{ github.repository }}: Build tests for ${{ matrix.distro }} failed.
  1006. Checkout: ${{ steps.checkout.outcome }}
  1007. Fetch test environment: ${{ steps.fetch.outcome }}
  1008. Load test environment: ${{ steps.load.outcome }}
  1009. netdata-installer: ${{ steps.build-cloud.outcome }}
  1010. netdata-installer, no JSON-C: ${{ steps.build-no-jsonc.outcome }}
  1011. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  1012. if: >-
  1013. ${{
  1014. failure()
  1015. && startsWith(github.ref, 'refs/heads/master')
  1016. && github.event_name != 'pull_request'
  1017. && github.repository == 'netdata/netdata'
  1018. && needs.file-check.outputs.run == 'true'
  1019. }}
  1020. macos-build: # Test building on macOS
  1021. name: Test building on macOS
  1022. runs-on: ${{ matrix.runner }}
  1023. if: github.event_name != 'workflow_dispatch'
  1024. needs:
  1025. - file-check
  1026. strategy:
  1027. fail-fast: false
  1028. max-parallel: 8
  1029. matrix:
  1030. include:
  1031. - name: macos-13
  1032. runner: macos-13
  1033. - name: macos-14-M1
  1034. runner: macos-14
  1035. - name: macos-15-M1
  1036. runner: macos-15
  1037. steps:
  1038. - name: Skip Check
  1039. id: skip
  1040. if: needs.file-check.outputs.run != 'true'
  1041. run: echo "SKIPPED"
  1042. - uses: actions/checkout@v4
  1043. id: checkout
  1044. if: needs.file-check.outputs.run == 'true'
  1045. with:
  1046. submodules: recursive
  1047. - name: Install latest bash
  1048. id: install-bash
  1049. if: needs.file-check.outputs.run == 'true'
  1050. run: |
  1051. brew install bash
  1052. - name: Install netdata dependencies
  1053. id: install-nd-dep
  1054. if: needs.file-check.outputs.run == 'true'
  1055. run: |
  1056. bash ./packaging/installer/install-required-packages.sh --dont-wait --non-interactive netdata-all
  1057. - name: Build from source
  1058. id: build-source
  1059. if: needs.file-check.outputs.run == 'true'
  1060. run: |
  1061. sudo bash ./netdata-installer.sh --install-no-prefix /usr/local/netdata --dont-wait --dont-start-it --one-time-build
  1062. - name: Test Agent start up
  1063. id: test-agent
  1064. if: needs.file-check.outputs.run == 'true'
  1065. run: |
  1066. /usr/local/netdata/usr/sbin/netdata -D > ./netdata.log 2>&1 &
  1067. ./packaging/runtime-check.sh
  1068. - name: Failure Notification
  1069. uses: rtCamp/action-slack-notify@v2
  1070. env:
  1071. SLACK_COLOR: 'danger'
  1072. SLACK_FOOTER: ''
  1073. SLACK_ICON_EMOJI: ':github-actions:'
  1074. SLACK_TITLE: 'Build & test from source macOS failed:'
  1075. SLACK_USERNAME: 'GitHub Actions'
  1076. SLACK_MESSAGE: |-
  1077. ${{ github.repository }}: macOS Build and test.
  1078. Checkout: ${{ steps.checkout.outcome }}
  1079. Setup runner: ${{ steps.install-bash.outcome }}
  1080. Install netdata required packages: ${{ steps.install-nd-dep.outcome }}
  1081. Build from source: ${{ steps.build-source.outcome }}
  1082. Test Agent runtime: ${{ steps.test-agent.outcome }}
  1083. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  1084. if: >-
  1085. ${{
  1086. failure()
  1087. && startsWith(github.ref, 'refs/heads/master')
  1088. && github.event_name != 'pull_request'
  1089. && github.repository == 'netdata/netdata'
  1090. }}
  1091. updater-check: # Test the generated dist archive using the updater code.
  1092. name: Test Generated Distfile and Updater Code
  1093. runs-on: ubuntu-latest
  1094. if: github.event_name != 'workflow_dispatch'
  1095. needs:
  1096. - build-dist
  1097. - matrix
  1098. - prepare-test-images
  1099. - file-check
  1100. strategy:
  1101. fail-fast: false
  1102. max-parallel: 8
  1103. matrix: ${{ fromJson(needs.matrix.outputs.matrix) }}
  1104. services:
  1105. apache: # This gets used to serve the dist tarball for the updater script.
  1106. image: httpd:2.4
  1107. ports:
  1108. - 8080:80
  1109. volumes:
  1110. - ${{ github.workspace }}:/usr/local/apache2/htdocs/
  1111. steps:
  1112. - name: Skip Check
  1113. id: skip
  1114. if: needs.file-check.outputs.run != 'true'
  1115. run: echo "SKIPPED"
  1116. - name: Checkout
  1117. id: checkout
  1118. if: needs.file-check.outputs.run == 'true'
  1119. uses: actions/checkout@v4
  1120. - name: Fetch dist tarball artifacts
  1121. id: fetch-tarball
  1122. if: needs.file-check.outputs.run == 'true'
  1123. uses: Wandalen/wretry.action@v3
  1124. with:
  1125. action: actions/download-artifact@v4
  1126. with: |
  1127. name: dist-tarball
  1128. path: dist-tarball
  1129. attempt_limit: 3
  1130. attempt_delay: 2000
  1131. - name: Prepare artifact directory
  1132. id: prepare
  1133. if: needs.file-check.outputs.run == 'true'
  1134. run: |
  1135. mkdir -p artifacts/download/v9999.0.0 || exit 1
  1136. mkdir -p artifacts/latest || exit 1
  1137. echo "v9999.0.0" > artifacts/latest/latest-version.txt || exit 1
  1138. cp dist-tarball/* artifacts/download/v9999.0.0 || exit 1
  1139. cd artifacts/download/v9999.0.0 || exit 1
  1140. ln -s ${{ needs.build-dist.outputs.distfile }} netdata-latest.tar.gz || exit 1
  1141. ls -lFh
  1142. sha256sum -b ./* > "sha256sums.txt" || exit 1
  1143. cat sha256sums.txt
  1144. cd ../.. || exit 1
  1145. ls -lR
  1146. - name: Fetch test environment
  1147. id: fetch-test-environment
  1148. if: needs.file-check.outputs.run == 'true'
  1149. uses: Wandalen/wretry.action@v3
  1150. with:
  1151. action: actions/download-artifact@v4
  1152. with: |
  1153. name: ${{ matrix.artifact_key }}-test-env
  1154. path: .
  1155. attempt_limit: 3
  1156. attempt_delay: 2000
  1157. - name: Load test environment
  1158. id: load
  1159. if: needs.file-check.outputs.run == 'true'
  1160. run: docker load --input image.tar
  1161. - name: Install netdata and run the updater on ${{ matrix.distro }}
  1162. id: updater-check
  1163. if: needs.file-check.outputs.run == 'true'
  1164. run: |
  1165. docker run --security-opt seccomp=unconfined -e DISABLE_TELEMETRY=1 --network host -w /netdata \
  1166. -e EXTRA_INSTALL_FLAGS=${{ needs.file-check.outputs.skip-go }} \
  1167. test:${{ matrix.artifact_key }} /netdata/.github/scripts/run-updater-check.sh
  1168. - name: Failure Notification
  1169. uses: rtCamp/action-slack-notify@v2
  1170. env:
  1171. SLACK_COLOR: 'danger'
  1172. SLACK_FOOTER: ''
  1173. SLACK_ICON_EMOJI: ':github-actions:'
  1174. SLACK_TITLE: 'Updater checks for ${{ matrix.distro }} failed:'
  1175. SLACK_USERNAME: 'GitHub Actions'
  1176. SLACK_MESSAGE: |-
  1177. ${{ github.repository }}: Updater checks for ${{ matrix.distro }} failed.
  1178. Checkout: ${{ steps.checkout.outcome }}
  1179. Fetch dist tarball: ${{ steps.fetch-tarball.outcome }}
  1180. Prepare artifact directory: ${{ steps.prepare.outcome }}
  1181. Fetch test environment: ${{ steps.fetch-test-environment.outcome }}
  1182. Load test environment: ${{ steps.load.outcome }}
  1183. Updater check: ${{ steps.updater-check.outcome }}
  1184. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  1185. if: >-
  1186. ${{
  1187. failure()
  1188. && startsWith(github.ref, 'refs/heads/master')
  1189. && github.event_name != 'pull_request'
  1190. && github.repository == 'netdata/netdata'
  1191. && needs.file-check.outputs.run == 'true'
  1192. }}
  1193. gitignore-check: # Verify that the build process does not make any changes to the source tree.
  1194. name: .gitignore
  1195. needs:
  1196. - file-check
  1197. runs-on: ubuntu-latest
  1198. steps:
  1199. - name: Skip Check
  1200. id: skip
  1201. if: needs.file-check.outputs.run != 'true'
  1202. run: echo "SKIPPED"
  1203. - name: Checkout
  1204. if: needs.file-check.outputs.run == 'true'
  1205. uses: actions/checkout@v4
  1206. with:
  1207. submodules: recursive
  1208. - name: Prepare environment
  1209. if: needs.file-check.outputs.run == 'true'
  1210. run: ./packaging/installer/install-required-packages.sh --dont-wait --non-interactive netdata
  1211. - name: Build netdata
  1212. if: needs.file-check.outputs.run == 'true'
  1213. run: ./netdata-installer.sh --dont-start-it --disable-telemetry --dont-wait --install-prefix /tmp/install --one-time-build ${{ needs.file-check.outputs.skip-go }}
  1214. - name: Check that repo is clean
  1215. if: needs.file-check.outputs.run == 'true'
  1216. run: |
  1217. git status --porcelain=v1 > /tmp/porcelain
  1218. if [ -s /tmp/porcelain ]; then
  1219. cat /tmp/porcelain
  1220. exit 1
  1221. fi