Skip to content

Apache DataFusion SQL Query Engine

ARROW-1578: [C++] Run lint checks in Travis CI much earlier at before_script stage to fail faster

Wes McKinney70effbc460c3
diff --git a/.travis.yml b/.travis.yml
index f6f64003d2..4691eeb065 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -40,8 +40,6 @@ services:
cache:
ccache: true
- directories:
- - $HOME/.conda_packages
matrix:
fast_finish: true
@@ -58,6 +56,7 @@ matrix:
- export ARROW_TRAVIS_USE_TOOLCHAIN=1
- export ARROW_TRAVIS_VALGRIND=1
- export ARROW_TRAVIS_PLASMA=1
+ - $TRAVIS_BUILD_DIR/ci/travis_lint.sh
- $TRAVIS_BUILD_DIR/ci/travis_before_script_cpp.sh
script:
- $TRAVIS_BUILD_DIR/ci/travis_script_cpp.sh
@@ -65,6 +64,7 @@ matrix:
- $TRAVIS_BUILD_DIR/ci/travis_script_python.sh 2.7
- $TRAVIS_BUILD_DIR/ci/travis_script_python.sh 3.6
- compiler: clang
+ language: cpp
osx_image: xcode6.4
os: osx
cache:
@@ -106,6 +106,7 @@ matrix:
- source $TRAVIS_BUILD_DIR/ci/travis_install_clang_tools.sh
- export CC="clang-4.0"
- export CXX="clang++-4.0"
+ - $TRAVIS_BUILD_DIR/ci/travis_lint.sh
- $TRAVIS_BUILD_DIR/ci/travis_before_script_cpp.sh
script:
- $TRAVIS_BUILD_DIR/ci/travis_script_integration.sh
@@ -123,6 +124,7 @@ matrix:
before_script:
- export CC="gcc-4.9"
- export CXX="g++-4.9"
+ - $TRAVIS_BUILD_DIR/ci/travis_lint.sh
- $TRAVIS_BUILD_DIR/ci/travis_before_script_cpp.sh --only-library
- $TRAVIS_BUILD_DIR/ci/travis_before_script_c_glib.sh
script:
diff --git a/ci/travis_before_script_cpp.sh b/ci/travis_before_script_cpp.sh
index d46fa2ff94..a7f1d27563 100755
--- a/ci/travis_before_script_cpp.sh
+++ b/ci/travis_before_script_cpp.sh
@@ -99,6 +99,7 @@ else
$ARROW_CPP_DIR
fi
+# Build and install libraries
$TRAVIS_MAKE -j4
$TRAVIS_MAKE install
diff --git a/ci/travis_lint.sh b/ci/travis_lint.sh
new file mode 100755
index 0000000000..9b7b474524
--- /dev/null
+++ b/ci/travis_lint.sh
@@ -0,0 +1,40 @@
+#!/usr/bin/env bash
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+set -ex
+
+# Fail fast for code linting issues
+mkdir $TRAVIS_BUILD_DIR/cpp/lint
+pushd $TRAVIS_BUILD_DIR/cpp/lint
+
+cmake ..
+make lint
+
+popd
+
+# Fail fast on style checks
+sudo pip install flake8
+
+PYARROW_DIR=$TRAVIS_BUILD_DIR/python
+
+flake8 --count $PYTHON_DIR/pyarrow
+
+# Check Cython files with some checks turned off
+flake8 --count --config=$PYTHON_DIR/.flake8.cython \
+ $PYTHON_DIR/pyarrow
diff --git a/ci/travis_script_cpp.sh b/ci/travis_script_cpp.sh
index 4e3e7bbea1..a2079036c4 100755
--- a/ci/travis_script_cpp.sh
+++ b/ci/travis_script_cpp.sh
@@ -27,8 +27,6 @@ git archive HEAD --prefix=apache-arrow/ --output=arrow-src.tar.gz
pushd $CPP_BUILD_DIR
-$TRAVIS_MAKE lint
-
# ARROW-209: checks depending on the LLVM toolchain are disabled temporarily
# until we are able to install the full LLVM toolchain in Travis CI again
diff --git a/ci/travis_script_python.sh b/ci/travis_script_python.sh
index e2cf254934..f6ce18a2ab 100755
--- a/ci/travis_script_python.sh
+++ b/ci/travis_script_python.sh
@@ -38,7 +38,7 @@ which python
conda install -y -q nomkl
# Expensive dependencies install from Continuum package repo
-conda install -y -q pip numpy pandas cython flake8
+conda install -y -q pip numpy pandas cython
# Build C++ libraries
pushd $ARROW_CPP_BUILD_DIR
@@ -62,12 +62,6 @@ popd
# Other stuff pip install
pushd $ARROW_PYTHON_DIR
-# Fail fast on style checks
-flake8 --count pyarrow
-
-# Check Cython files with some checks turned off
-flake8 --count --config=.flake8.cython pyarrow
-
pip install -r requirements.txt
python setup.py build_ext --with-parquet --with-plasma \
install --single-version-externally-managed --record=record.text