@cryptotaxi247 / netdata-1 / commits / a13354313

Migrate make dist validation to GHA Workflows (#8373)

* Migrate make dist validation to GHA Workflows * Refactor run_install_with_dist_file.sh

James Mills committed Mar 13, 2020 at 07:10 UTC a133543132c156feb4e56f126d05df43e1b46d99
4 files changed +67 -68
.github/scripts/run_install_with_dist_file.sh new
+37
@@ -0,0 +1,37 @@
1 +#!/usr/bin/env bash
2 +#
3 +# This script is evaluating netdata installation with the source from make dist
4 +#
5 +# Copyright: SPDX-License-Identifier: GPL-3.0-or-later
6 +#
7 +# Author : Pavlos Emm. Katsoulakis <paul@netdata.cloud)
8 +
9 +set -e
10 +
11 +if [ $# -ne 1 ]; then
12 + printf >&2 "Usage: %s <dist_file>\n" "$(basename "$0")"
13 + exit 1
14 +fi
15 +
16 +distfile="${1}"
17 +shift
18 +
19 +printf >&2 "Opening dist archive %s ... " "${distfile}"
20 +tar -xovf "${distfile}"
21 +distdir="$(echo "${distfile}" | cut -d. -f1,2,3)"
22 +if [ ! -d "${distdir}" ]; then
23 + printf >&2 "ERROR: %s is not a directory" "${distdir}"
24 + exit 2
25 +fi
26 +
27 +printf >&2 "Entering %s and starting docker run ..." "${distdir}"
28 +
29 +pushd "${distdir}" || exit 1
30 +docker run \
31 + -v "${PWD}:/netdata" \
32 + -w /netdata \
33 + "netdata/os-test:centos7" \
34 + /bin/bash -c "./netdata-installer.sh --dont-wait --install /tmp && echo \"Validating netdata instance is running\" && wget -O - 'http://127.0.0.1:19999/api/v1/info' | grep version"
35 +popd || exit 1
36 +
37 +echo "All Done!"
.github/workflows/checks.yml
+30
@@ -37,3 +37,33 @@ jobs:
37 - name: Compare generated Dashboard vs. Backed up Dashboard
38 run: |
39 diff -sNrdu /tmp/dashboard.js web/gui/dashboard.js
40 + dist-checks:
41 + name: Dist
42 + runs-on: ubuntu-latest
43 + steps:
44 + - name: Checkout
45 + uses: actions/checkout@v2
46 + - name: Prepare environment
47 + run: |
48 + ./packaging/installer/install-required-packages.sh --dont-wait --non-interactive netdata-all
49 + sudo apt-get install -y libjson-c-dev libipmimonitoring-dev libcups2-dev libsnappy-dev \
50 + libprotobuf-dev libprotoc-dev libssl-dev protobuf-compiler \
51 + libnetfilter-acct-dev
52 + - name: Configure
53 + run: |
54 + autoreconf -ivf
55 + ./configure \
56 + --with-zlib \
57 + --with-math \
58 + --with-user=netdata \
59 + CFLAGS=-O2
60 + - name: Make dist
61 + run: |
62 + make dist
63 + - name: Verify & Set distfile
64 + run: |
65 + ls -lah netdata-*.tar.gz
66 + echo "::set-env name=DISTFILE::$(ls netdata-*.tar.gz)"
67 + - name: Run run_install_with_dist_file.sh
68 + run: |
69 + ./.github/scripts/run_install_with_dist_file.sh "${DISTFILE}"
.travis.yml
-20
@@ -107,26 +107,6 @@ jobs:
107 env: DEVEL="true"
108 after_failure: post_message "TRAVIS_MESSAGE" "Docker build process failed"
109
110 - - name: Run 'make dist' validation
111 - before_script: mkdir /tmp/netdata-makedist-test
112 - script:
113 - - echo "GIT Branch:" && git branch
114 - - echo "Last commit:" && git log -1
115 - - echo "GIT Describe:" && git describe
116 - - echo "packaging/version:" && cat packaging/version
117 - - docker run -it -v "${PWD}:/netdata:rw" -v "/tmp/netdata-makedist-test:/netdata_install:rw" -w /netdata "netdata/os-test:ubuntu1804" make clean || echo "Nothing to clean"
118 - - docker run -it -v "${PWD}:/netdata:rw" -v "/tmp/netdata-makedist-test:/netdata_install:rw" -w /netdata "netdata/os-test:ubuntu1804" make distclean || echo "Nothing to distclean"
119 - - docker run -it -v "${PWD}:/netdata:rw" -v "/tmp/netdata-makedist-test:/netdata_install:rw" -w /netdata "netdata/os-test:ubuntu1804" /bin/bash -c "autoreconf -ivf && ./configure --prefix=/netdata_install/usr --sysconfdir=/netdata_install/etc --localstatedir=/netdata_install/var --with-zlib --with-math --with-user=netdata CFLAGS=-O2"
120 - - docker run -it -v "${PWD}:/netdata:rw" -v "/tmp/netdata-makedist-test:/netdata_install:rw" -w /netdata "netdata/os-test:ubuntu1804" make dist
121 - - docker run -it -v "${PWD}:/netdata:rw" -v "/tmp/netdata-makedist-test:/netdata_install:rw" -w /netdata "netdata/os-test:ubuntu1804" ls -ltr ./netdata-$(git describe).tar.gz || ls -ltr ./netdata-$(cat packaging/version | tr -d '\n').tar.gz
122 - - .travis/run_install_with_dist_file.sh
123 - - docker run -it -v "${PWD}:/netdata:rw" -v "/tmp/netdata-makedist-test:/netdata_install:rw" -w /netdata "netdata/os-test:ubuntu1804" make distclean
124 - git:
125 - depth: false
126 - after_script: rm -rf /tmp/netdata-makedist-test
127 - after_failure: post_message "TRAVIS_MESSAGE" "'make dist' failed"
128 -
129 -
110 - stage: Artifacts validation
111 name: Unit Testing
112 script:
.travis/run_install_with_dist_file.sh deleted
-48
@@ -1,48 +0,0 @@
1 -#!/usr/bin/env bash
2 -#
3 -# This script is evaluating netdata installation with the source from make dist
4 -#
5 -# Copyright: SPDX-License-Identifier: GPL-3.0-or-later
6 -#
7 -# Author : Pavlos Emm. Katsoulakis <paul@netdata.cloud)
8 -#
9 -set -e
10 -
11 -# If we are not in netdata git repo, at the top level directory, fail
12 -TOP_LEVEL=$(basename "$(git rev-parse --show-toplevel)")
13 -CWD=$(git rev-parse --show-cdup || echo "")
14 -if [ -n "${CWD}" ] || [ ! "${TOP_LEVEL}" == "netdata" ]; then
15 - echo "Run as .travis/$(basename "$0") from top level directory of netdata git repository"
16 - echo "Changelog generation process aborted"
17 - exit 1
18 -fi
19 -
20 -echo "Initiating dist archive contents validation"
21 -DIST_FILE_FROM_GIT="netdata-$(git describe).tar.gz"
22 -DIST_FILE_FROM_FILE="netdata-$(tr -d '\n' < packaging/version).tar.bgz"
23 -if [ -f ${DIST_FILE_FROM_GIT} ]; then
24 - DIST_FILE="${DIST_FILE_FROM_GIT}"
25 -elif [ -f ${DIST_FILE_FROM_FILE} ]; then
26 - DIST_FILE="${DIST_FILE_FROM_FILE}"
27 -else
28 - echo "I could not find netdata distfile. Nor ${DIST_FILE_FROM_GIT} or ${DIST_FILE_FROM_FILE} exist"
29 - exit 1
30 -fi
31 -
32 -echo "Opening dist archive ${DIST_FILE}"
33 -tar -xovf "${DIST_FILE}"
34 -NETDATA_DIST_FOLDER=$(echo ${DIST_FILE} | cut -d. -f1,2,3)
35 -if [ ! -d ${NETDATA_DIST_FOLDER} ]; then
36 - echo "I could not locate folder ${NETDATA_DIST_FOLDER}, something went wrong failing the test"
37 - exit 1
38 -fi
39 -
40 -echo "Entering ${NETDATA_DIST_FOLDER} and starting docker compilation"
41 -cd ${NETDATA_DIST_FOLDER}
42 -docker run -it -v "${PWD}:/code:rw" -w /code "netdata/os-test:centos7" /bin/bash -c "./netdata-installer.sh --dont-wait --install /tmp && echo \"Validating netdata instance is running\" && wget -O'-' 'http://127.0.0.1:19999/api/v1/info' | grep version"
43 -
44 -echo "Installation completed with no errors! Removing temporary folders"
45 -
46 -# TODO: Travis give me a permission denied on some files here, i made it a soft error until i figure out what is wrong
47 -cd -
48 -rm -rf ${NETDATA_DIST_FOLDER} || echo "I could not remove temporary directory, make sure you delete ${NETDATA_DIST_FOLDER} by yourself if this wasn't run over ephemeral storage"