From 1f12bcb892bf5f950852dac7d0530b41e5adc0cc Mon Sep 17 00:00:00 2001 From: Marc Di Luzio Date: Fri, 13 Apr 2018 14:32:02 +0100 Subject: [PATCH] Add a basic travis file for unit tests Only code formatting implemented at the moment. Travis is currently Ubuntu 14.04, which is missing multiple library versions needed. Bootstrapping in Python 3.5, Meson and Ninja is possible, but can take a while, but also bootstrapping in libsystemd is one step too many for now as it takes a significant amount of time. --- .travis.yml | 11 +++++++++++ scripts/format-check.sh | 14 ++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 .travis.yml create mode 100755 scripts/format-check.sh diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..7989d16 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,11 @@ +language: c +compiler: gcc +sudo: false + +addons: + apt: + packages: + - clang-format-3.4 + +script: + - ./scripts/format-check.sh diff --git a/scripts/format-check.sh b/scripts/format-check.sh new file mode 100755 index 0000000..aec4514 --- /dev/null +++ b/scripts/format-check.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# Simple script to check for clang-format compliance +wget https://llvm.org/svn/llvm-project/cfe/trunk/tools/clang-format/git-clang-format +chmod +x git-clang-format + +CLANG_FORMAT_OUTPUT=$(./git-clang-format --diff) +if [[ ! $CLANG_FORMAT_OUTPUT == "no modified files to format" ]]; then + echo "Failed clang format check:" + echo "${CLANG_FORMAT_OUTPUT}" + exit 1 +else + echo "Passed clang format check" +fi +