summaryrefslogtreecommitdiffstats
path: root/.github
diff options
context:
space:
mode:
authorJames Mills <prologic@shortcircuit.net.au>2020-05-26 12:19:27 +1000
committerGitHub <noreply@github.com>2020-05-26 12:19:27 +1000
commita20e8f163fde7d64cbc258b6903230dda651adf9 (patch)
treee39afc950b1740c4853a346eb8a98f3f72f2e1ef /.github
parentb5f5675cb53d4b2f276666b55ef582aa8ba7a574 (diff)
Add CI for our Static Netdata builds (which kickstart-static64 uses) (#9130)
* Add tool to build the static x864_64 Netdata * Add error if the netdata binary is not statically linked * Add Github Workflow for testing static builds * Don't use docker run -i -t if not on a tty
Diffstat (limited to '.github')
-rwxr-xr-x.github/scripts/build-static-x86_64.sh58
-rw-r--r--.github/scripts/functions.sh69
-rw-r--r--.github/workflows/build-and-install.yml13
3 files changed, 139 insertions, 1 deletions
diff --git a/.github/scripts/build-static-x86_64.sh b/.github/scripts/build-static-x86_64.sh
new file mode 100755
index 0000000000..2676b6321a
--- /dev/null
+++ b/.github/scripts/build-static-x86_64.sh
@@ -0,0 +1,58 @@
+#!/bin/sh
+#
+# Builds the netdata-vX.Y.Z-xxxx.gz.run (static x86_64) artifact.
+
+set -e
+
+# shellcheck source=.github/scripts/functions.sh
+. "$(dirname "$0")/functions.sh"
+
+NAME="${NAME:-netdata}"
+VERSION="${VERSION:-"$(git describe)"}"
+BASENAME="$NAME-$VERSION"
+
+prepare_build() {
+ progress "Preparing build"
+ (
+ test -d artifacts || mkdir -p artifacts
+ ) >&2
+}
+
+build_static_x86_64() {
+ progress "Building static x86_64"
+ (
+ USER="" ./packaging/makeself/build-x86_64-static.sh
+ ) >&2
+}
+
+prepare_assets() {
+ progress "Preparing assets"
+ (
+ cp packaging/version artifacts/latest-version.txt
+
+ cd artifacts || exit 1
+ ln -s "${BASENAME}.gz.run" netdata-latest.gz.run
+ sha256sum -b ./* > "sha256sums.txt"
+ ) >&2
+}
+
+steps="prepare_build build_static_x86_64"
+steps="$steps prepare_assets"
+
+_main() {
+ for step in $steps; do
+ if ! run "$step"; then
+ if [ -t 1 ]; then
+ debug
+ else
+ fail "Build failed"
+ fi
+ fi
+ done
+
+ echo "🎉 All Done!"
+}
+
+if [ -n "$0" ] && [ x"$0" != x"-bash" ]; then
+ _main "$@"
+fi
diff --git a/.github/scripts/functions.sh b/.github/scripts/functions.sh
new file mode 100644
index 0000000000..7cd2e08094
--- /dev/null
+++ b/.github/scripts/functions.sh
@@ -0,0 +1,69 @@
+#!/bin/sh
+
+# This file is included by download.sh & build.sh
+
+set -e
+
+color() {
+ fg="$1"
+ bg="${2}"
+ ft="${3:-0}"
+
+ printf "\33[%s;%s;%s" "$ft" "$fg" "$bg"
+}
+
+color_reset() {
+ printf "\033[0m"
+}
+
+ok() {
+ if [ -t 1 ]; then
+ printf "%s[ OK ]%s\n" "$(color 37 42m 1)" "$(color_reset)"
+ else
+ printf "%s\n" "[ OK ]"
+ fi
+}
+
+err() {
+ if [ -t 1 ]; then
+ printf "%s[ ERR ]%s\n" "$(color 37 41m 1)" "$(color_reset)"
+ else
+ printf "%s\n" "[ ERR ]"
+ fi
+}
+
+run() {
+ retval=0
+ logfile="$(mktemp -t "run-XXXXXX")"
+ if "$@" 2> "$logfile"; then
+ ok
+ else
+ retval=$?
+ err
+ tail -n 100 "$logfile" || true
+ fi
+ rm -rf "$logfile"
+ return $retval
+}
+
+progress() {
+ printf "%-40s" "$(printf "%s ... " "$1")"
+}
+
+log() {
+ printf "%s\n" "$1"
+}
+
+error() {
+ log "ERROR: ${1}"
+}
+
+fail() {
+ log "FATAL: ${1}"
+ exit 1
+}
+
+debug() {
+ log "Dropping into a shell for debugging ..."
+ exec /bin/sh
+}
diff --git a/.github/workflows/build-and-install.yml b/.github/workflows/build-and-install.yml
index afa61e9891..fe7a07bd7a 100644
--- a/.github/workflows/build-and-install.yml
+++ b/.github/workflows/build-and-install.yml
@@ -6,7 +6,18 @@ on:
- master
pull_request:
jobs:
- build:
+ static-build:
+ name: Build (x86_64)
+ runs-on: ubuntu-latest
+ steps:
+ - name: Git clone repository
+ uses: actions/checkout@v2
+ - run: |
+ git fetch --prune --unshallow --tags
+ - name: Build
+ run: |
+ .github/scripts/build-static-x86_64.sh
+ source-build:
name: Build & Install
strategy:
fail-fast: false