Bug 1204998 - travis.yml with clang-format 3.8, mac and asan builds, r=mt,ekr
authorFranziskus Kiefer <franziskuskiefer@gmail.com>
Mon, 02 May 2016 10:12:29 +0200
changeset 12132 3308d661b69b55310804e7e997e1ebce07408192
parent 12131 bc30560fa64f0149ddfa4cadc45521a3c0bed69c
child 12133 09756fe497473c739cbcef0a883ba559828b0845
push id1185
push userfranziskuskiefer@gmail.com
push dateMon, 02 May 2016 08:18:33 +0000
reviewersmt, ekr
bugs1204998
Bug 1204998 - travis.yml with clang-format 3.8, mac and asan builds, r=mt,ekr
.clang-format
.travis.yml
automation/travis/validate-formatting.sh
--- a/.clang-format
+++ b/.clang-format
@@ -10,17 +10,17 @@ AllowAllParametersOfDeclarationOnNextLin
 AllowShortBlocksOnASingleLine: false
 AllowShortCaseLabelsOnASingleLine: false
 AllowShortIfStatementsOnASingleLine: false
 AllowShortLoopsOnASingleLine: false
 AllowShortFunctionsOnASingleLine: All
 AlwaysBreakAfterDefinitionReturnType: true
 AlwaysBreakTemplateDeclarations: false
 AlwaysBreakBeforeMultilineStrings: false
-BreakBeforeBinaryOperators: None
+BreakBeforeBinaryOperators: false
 BreakBeforeTernaryOperators: true
 BreakConstructorInitializersBeforeComma: false
 BinPackParameters: true
 BinPackArguments: true
 ColumnLimit:     0
 ConstructorInitializerAllOnOneLineOrOnePerLine: true
 ConstructorInitializerIndentWidth: 4
 DerivePointerAlignment: true
new file mode 100644
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,65 @@
+sudo: required
+dist: trusty
+
+addons:
+  apt:
+    sources:
+    # add PPAs with more up-to-date toolchains
+    - ubuntu-toolchain-r-test
+    - llvm-toolchain-precise-3.8
+    packages:
+    # install toolchains
+    - gcc-5
+    - g++-5
+    - clang-3.8
+    # install additional tools
+    - clang-format-3.8
+
+matrix:
+  include:
+    - os: osx
+      compiler: clang-3.8
+      env:
+        - CC=clang-3.8
+        - CCC=clang++-3.8
+    - os: osx
+      compiler: clang-3.8
+      env:
+        - CC=clang-3.8
+        - CCC=clang++-3.8
+        - BUILD_OPT=1
+    - os: linux
+      compiler: gcc
+      env:
+        - CC=gcc-5
+        - CCC=g++-5
+    - os: linux
+      compiler: gcc
+      env:
+        - CC=gcc-5
+        - CCC=g++-5
+        - BUILD_OPT=1
+    - os: linux
+      compiler: gcc
+      env:
+        - CC=gcc-5
+        - CCC=g++-5
+        - USE_ASAN=1
+    - os: linux
+      env: CLANG_FORMAT=1
+  allow_failures:
+    - env: CLANG_FORMAT=1
+
+env:
+  global:
+    - USE_64=1
+    - NSS_ENABLE_TLS_1_3=1
+
+install:
+  - hg clone https://hg.mozilla.org/projects/nspr ../nspr
+  - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update; brew install llvm38; fi
+
+script:
+  - if [ -n "$CLANG_FORMAT" ]; then automation/travis/validate-formatting.sh lib/ssl; exit $?; fi
+  - make nss_build_all
+  - cd tests; NSS_TESTS="ssl_gtests pk11_gtests der_gtests util_gtests" NSS_CYCLES=standard ./all.sh
new file mode 100755
--- /dev/null
+++ b/automation/travis/validate-formatting.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# Apply clang-format 3.8 on the provided folder and verify that this doesn't change any file.
+# If any file differs after formatting, the script eventually exits with 1.
+# Any differences between formatted and unformatted files is printed to stdout to give a hint what's wrong.
+
+STATUS=0
+for i in $(find $1 -type f -name '*.[ch]' -print); do
+  if ! clang-format-3.8 $i | diff $i -; then
+    echo "Sorry, $i is not formatted properly. Please use clang-format 3.8 on your patch before landing."
+    STATUS=1
+  fi
+done
+exit $STATUS