Page MenuHomeClusterLabs Projects

No OneTemporary

diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 000000000..79f775399
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,8 @@
+language: bash
+install:
+ - ./ci/install.sh
+script:
+ - ./ci/build.sh
+notifications:
+ email: false
+sudo: required
diff --git a/ci/build.sh b/ci/build.sh
new file mode 100755
index 000000000..798bd39ee
--- /dev/null
+++ b/ci/build.sh
@@ -0,0 +1,46 @@
+#!/usr/bin/env bash
+set -eo pipefail
+[[ "${DEBUG:-}" ]] && set -x
+
+declare -i failed
+failed=0
+
+success() {
+ printf "\r\033[2K [ \033[00;32mOK\033[0m ] Checking %s...\n" "$1"
+}
+
+fail() {
+ printf "\r\033[2K [\033[0;31mFAIL\033[0m] Checking %s...\n" "$1"
+ failed=1
+}
+
+check() {
+ local script="$1"
+ shellcheck "$script" || fail "$script"
+ success "$script"
+}
+
+find_prunes() {
+ local prunes="! -path './.git/*'"
+ if [ -f .gitmodules ]; then
+ while read module; do
+ prunes="$prunes ! -path './$module/*'"
+ done < <(grep path .gitmodules | awk '{print $3}')
+ fi
+ echo "$prunes"
+}
+
+find_cmd() {
+ echo "find . -type f -and \( -perm +111 -or -name '*.sh' \) $(find_prunes)"
+}
+
+check_all_executables() {
+ echo "Checking executables and .sh files..."
+ eval "$(find_cmd)" | while read script; do
+ head=$(head -n1 "$script")
+ check "$script"
+ done
+ exit $failed
+}
+
+check_all_executables
diff --git a/ci/install.sh b/ci/install.sh
new file mode 100755
index 000000000..c66b56c59
--- /dev/null
+++ b/ci/install.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+set -eo pipefail
+
+main() {
+ local filename="shellcheck_0.3.7-1_amd64.deb"
+ wget "http://ftp.debian.org/debian/pool/main/s/shellcheck/$filename"
+ sudo dpkg -i "$filename"
+}
+
+main

File Metadata

Mime Type
text/x-diff
Expires
Sat, Jan 25, 11:21 AM (1 d, 11 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1318435
Default Alt Text
(1 KB)

Event Timeline