Skip to content

Commit

Permalink
Add TEST_SUITE=bazel to run Bazel on examples
Browse files Browse the repository at this point in the history
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
  • Loading branch information
regisd committed Sep 30, 2018
1 parent 928ca91 commit 5ddf549
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions jflex/examples/WORKSPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

21 changes: 21 additions & 0 deletions scripts/bazel.sh
Original file line number Diff line number Diff line change
@@ -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"
3 changes: 3 additions & 0 deletions scripts/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit 5ddf549

Please sign in to comment.