summaryrefslogtreecommitdiff
path: root/.travis/bazel-linux
blob: e76f3f86231e8fe09edd154f78754439cf817b34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh

ACTION="$1"

set -eu

travis_install() {
  # Get bazel.
  wget https://github.com/bazelbuild/bazel/releases/download/2.2.0/bazel-2.2.0-installer-linux-x86_64.sh
  chmod +x bazel-2.2.0-installer-linux-x86_64.sh
  ./bazel-2.2.0-installer-linux-x86_64.sh --user
  echo 'build --jobs=4 --curses=no --verbose_failures' >> $HOME/.bazelrc
  echo 'build --config=linux' >> $HOME/.bazelrc
  echo "build --config=$CC" >> $HOME/.bazelrc
  echo "build --config=remote" >> $HOME/.bazelrc
  pip install --user yamllint
}

travis_script() {
  yamllint -c ../tools/project/yamllint.rc .
  bazel test \
    //c-toxcore:license_test \
    //c-toxcore:readme_test

  # TODO(iphydf): Make tests have a chance to succeed.
  # Run the tests, but if they fail, at least we should be able to build.
  # bazel test //c-toxcore/... || bazel build //c-toxcore/...
  bazel build //c-toxcore/...
}

if [ "-z" "$ACTION" ]; then
  "travis_script"
else
  "travis_$ACTION"
fi