From 5ddf54907cea2f725e5221067cbac454d0ca48d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20D=C3=A9camps?= Date: Sun, 30 Sep 2018 14:43:11 +0200 Subject: [PATCH] Add TEST_SUITE=bazel to run Bazel on examples In an attempt to support all build systems in the examples, run bazel test on all examples. That's also the first step towards Bazel support #204 --- .travis.yml | 17 +++++++++++++++++ jflex/examples/WORKSPACE | 1 + scripts/bazel.sh | 21 +++++++++++++++++++++ scripts/run-tests.sh | 3 +++ 4 files changed, 42 insertions(+) create mode 100644 jflex/examples/WORKSPACE create mode 100755 scripts/bazel.sh diff --git a/.travis.yml b/.travis.yml index f28c1d1c5..b318abfa1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,6 +22,23 @@ env: - TEST_SUITE=ant - TEST_SUITE=unit - TEST_SUITE=regression + - TEST_SUITE=bazel + +# Prerequisites for Bazel +addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - curl + - pkg-config + - zip + - g++ + - zlib1g-dev + - unzip + - python + +sudo: $TEST_SUITE = bazel # Empty the previously built artifacts # They cannot be deleted in the before_cache phase, diff --git a/jflex/examples/WORKSPACE b/jflex/examples/WORKSPACE new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/jflex/examples/WORKSPACE @@ -0,0 +1 @@ + diff --git a/scripts/bazel.sh b/scripts/bazel.sh new file mode 100755 index 000000000..f233e464f --- /dev/null +++ b/scripts/bazel.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# Run bazel on examples + +CWD="$PWD" +BASEDIR="$(cd "$(dirname "$0")" && pwd -P)"/.. +# Provides the logi function +source "$BASEDIR"/scripts/logger.sh +# fail on error +set -e + +logi "Install Bazel" +logi "=============" +curl -L https://github.com/bazelbuild/bazel/releases/download/0.16.1/bazel_0.16.1-linux-x86_64.deb -o tools/bazel-0.16.1.deb +sudo install tools/bazel-0.16.1.deb + +logi "Run Bazel tests on examples" +logi "===========================" +cd jflex/examples +bazel test /.. + +cd "$CWD" diff --git a/scripts/run-tests.sh b/scripts/run-tests.sh index 8f012ac51..2c7536b87 100755 --- a/scripts/run-tests.sh +++ b/scripts/run-tests.sh @@ -33,6 +33,9 @@ if [[ -z "$TEST_SUITE" || "$TEST_SUITE" == "ant" ]]; then "$BASEDIR"/scripts/ant-build.sh "$BASEDIR"/scripts/test-examples.sh fi +if [[ -z "$TEST_SUITE" || "$TEST_SUITE" == "bazel" ]]; then + "$BASEDIR"/scripts/bazel.sh +fi logi "Success" cd "$CWD"