blob: 1910355b759d942b51a0f629d340c1d642e08212 [file] [log] [blame]
language: minimal
env:
global:
- BORINGSSL_HOME="$HOME/boringssl"
- CXXFLAGS="-std=c++11"
- GOOGLE_JAVA_FORMAT_VERSION=1.1
cache:
directories:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/dists/
matrix:
include:
###
### Linux build is the only platform that builds Android here.
###
- os: linux
dist: xenial
env:
- ANDROID_TOOLS_URL="https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip"
- ANDROID_HOME="$HOME/android-sdk-linux"
- JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
- JAVA11_HOME=/usr/lib/jvm/java-11-openjdk-amd64
- CC=clang-5.0
- CXX=clang++-5.0
- PATH="$JAVA_HOME/bin:$PATH"
- TERM=dumb # to stop verbose build output
before_install:
- curl -L $ANDROID_TOOLS_URL -o $HOME/tools.zip
- unzip -q $HOME/tools.zip -d $ANDROID_HOME
# Accept all the license agreements
- yes | $ANDROID_HOME/tools/bin/sdkmanager --licenses
# sdkmanager 26.1.1 produces an enormous amount of progress info
# Append tr '\r' '\n' | uniq to all the commands to suppress it
- $ANDROID_HOME/tools/bin/sdkmanager tools | tr '\r' '\n' | uniq
- $ANDROID_HOME/tools/bin/sdkmanager platform-tools | tr '\r' '\n' | uniq
- $ANDROID_HOME/tools/bin/sdkmanager 'build-tools;28.0.3' | tr '\r' '\n' | uniq
- $ANDROID_HOME/tools/bin/sdkmanager 'platforms;android-26' | tr '\r' '\n' | uniq
- $ANDROID_HOME/tools/bin/sdkmanager 'extras;android;m2repository' | tr '\r' '\n' | uniq
- $ANDROID_HOME/tools/bin/sdkmanager 'ndk;21.3.6528147' | tr '\r' '\n' | uniq
- $ANDROID_HOME/tools/bin/sdkmanager 'cmake;3.10.2.4988404' | tr '\r' '\n' | uniq
- gimme 1.13 # Needed for BoringSSL build
- source ~/.gimme/envs/go1.13.env
addons:
apt:
sources:
- llvm-toolchain-xenial-5.0
- openjdk-r-java
- ubuntu-toolchain-r-test
packages:
- clang-5.0
- clang-format-5.0 # for style checks
- g++-multilib
- gcc-multilib
- libc6-dev-i386
- libc6-dev:i386
- linux-libc-dev
- ninja-build
- openjdk-8-jdk # for building
- openjdk-11-jre # for running tests with Java 11
before_cache:
- find $HOME/.gradle -name "*.lock" -exec rm {} \;
- rm -rf $HOME/.gradle/caches/[1-9]*
before_script:
# Get Google Java Format
- curl -L https://github.com/google/google-java-format/releases/download/google-java-format-1.1/google-java-format-${GOOGLE_JAVA_FORMAT_VERSION}-all-deps.jar -o $HOME/gjf.jar
# get BoringSSL
- mkdir $BORINGSSL_HOME
- git clone --depth 1 https://boringssl.googlesource.com/boringssl $BORINGSSL_HOME
# Build BoringSSL for 64-bit
- mkdir $BORINGSSL_HOME/build64 && pushd $BORINGSSL_HOME/build64
- cmake -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE -DCMAKE_BUILD_TYPE=Release -DCMAKE_ASM_FLAGS=-Wa,--noexecstack -GNinja ..
- ninja
- popd
# Get git-clang-format
- if [ ! -d "$HOME/bin" ]; then mkdir $HOME/bin; fi
- curl -L https://llvm.org/svn/llvm-project/cfe/trunk/tools/clang-format/git-clang-format -o $HOME/bin/git-clang-format
- chmod 0755 $HOME/bin/git-clang-format
- export PATH="$HOME/bin:$PATH"
# We need this to find the merge-base
- if [[ "$TRAVIS_OS_NAME" == "linux" && "$TRAVIS_PULL_REQUEST" != "false" ]];
then
git fetch origin +refs/heads/${TRAVIS_BRANCH}:refs/remotes/origin/${TRAVIS_BRANCH};
fi
script:
# MacOS (BSD) xargs is missing some nice features that make this easy, so skip it.
- if [[ "$TRAVIS_OS_NAME" == "linux" && "$TRAVIS_PULL_REQUEST" != "false" ]];
then
git rev-list $(git merge-base HEAD origin/master)..HEAD | xargs -i git clang-format --binary=$(which clang-format-5.0) --style=file --diff {}^ {} | ( git apply; true ) && git diff --exit-code || { git reset --hard; false; }
fi
- if [[ "$TRAVIS_OS_NAME" == "linux" && "$TRAVIS_PULL_REQUEST" != "false" ]];
then
git rev-list $(git merge-base HEAD origin/master)..HEAD | xargs -i git diff-tree --no-commit-id --name-only -r {} | grep -E '\.java$' | xargs -r git ls-files | xargs -r java -jar $HOME/gjf.jar -a -i --fix-imports-only && git diff --exit-code || { git reset --hard; false; }
fi
- ./gradlew build -PcheckErrorQueue
# Also test with Java 11 on linux
- if [[ "$TRAVIS_OS_NAME" == "linux" && "$TRAVIS_PULL_REQUEST" != "false" ]];
then
./gradlew check -DjavaExecutable64=${JAVA11_HOME}/bin/java -PcheckErrorQueue;
fi
after_script:
- "[ -f android/build/outputs/lint-results-debug.xml ] && cat android/build/outputs/lint-results-debug.xml"