| # Copyright 2019 Google LLC |
| # |
| # Licensed 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 |
| # |
| # https://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. |
| |
| name: Bazel Build |
| |
| on: |
| push: |
| branches: |
| - master |
| - ci-test # A branch specifically for testing CI |
| |
| jobs: |
| linux: |
| runs-on: ubuntu-18.04 |
| env: |
| CXX: clang++ |
| CC: clang |
| PYTHON_BIN: /usr/bin/python3 |
| # Install a specific version of Bazel that is supported by TensorFlow |
| # (see https://www.tensorflow.org/install/source#install_bazel). |
| BAZEL_VERSION: 1.1.0 |
| steps: |
| - name: Installing bazel |
| run: | |
| # https://docs.bazel.build/versions/master/install-ubuntu.html |
| sudo apt-get install unzip zip |
| wget https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION?}/bazel-${BAZEL_VERSION?}-installer-linux-x86_64.sh |
| chmod +x bazel-${BAZEL_VERSION?}-installer-linux-x86_64.sh |
| ./bazel-${BAZEL_VERSION?}-installer-linux-x86_64.sh --user |
| rm bazel-${BAZEL_VERSION?}-installer-linux-x86_64.sh |
| echo "::add-path::${HOME?}/bin" |
| - name: Installing dependencies |
| run: | |
| sudo apt-get update |
| sudo apt-get install clang libsdl2-dev python3 python3-pip python3-setuptools |
| # Update pip before using it so it picks up the latest versions of our dependencies. |
| sudo python3 -m pip install --upgrade pip |
| sudo python3 -m pip install numpy tf-nightly |
| - name: Checking out latest version and all submodules |
| run: | |
| git config --global remote.origin.fetch '+refs/pull/*:refs/remotes/origin/pull/*' |
| git clone https://github.com/${GITHUB_REPOSITORY?} ${GITHUB_WORKSPACE?} --no-checkout --no-tags |
| git checkout ${GITHUB_SHA?} |
| git submodule update --init --depth 1000 --jobs 8 |
| - name: Building and testing with bazel |
| run: | |
| # Build and test everything not explicitly marked as excluded from CI |
| # (using the tag "notap", "Test Automation Platform"). |
| # Note that somewhat contrary to its name `bazel test` will also build |
| # any non-test targets specified. |
| # We use `bazel query //...` piped to `bazel test` rather than the |
| # simpler `bazel test //...` because the latter excludes targets |
| # tagged "manual". The "manual" tag allows targets to be excluded from |
| # human wildcard builds, but we want them built by CI unless they are |
| # excluded with "notap". |
| # TODO(gcmn) Enable all tests except notap once we can run them on the CI |
| bazel query '//... except attr("tags", "notap", //...) except //integrations/tensorflow/e2e:vulkan_conv_test except //iree/hal/vulkan:dynamic_symbols_test except //iree/samples/rt:bytecode_module_api_test except //iree/samples/simple_embedding:simple_embedding_test' | xargs bazel test --test_env=IREE_VULKAN_DISABLE=1 --define=iree_tensorflow=true --test_output=errors |