Skip to content

Commit

Permalink
Use bazelisk (tensorflow#2097)
Browse files Browse the repository at this point in the history
* Use bazelisk to install bazel
  • Loading branch information
WindQAQ authored Aug 25, 2020
1 parent e40a266 commit 6329e1a
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 24 deletions.
1 change: 1 addition & 0 deletions .bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.1.0
3 changes: 0 additions & 3 deletions .github/workflows/ci_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ on:
- master
- r*

env:
BAZEL_VERSION: 3.1.0

jobs:
flake8-test:
name: Flake8
Expand Down
9 changes: 2 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ on:
- r*

env:
BAZEL_VERSION: '3.1.0'
MIN_PY_VERSION: '3.5'
MAX_PY_VERSION: '3.8'

Expand All @@ -31,7 +30,7 @@ jobs:
- name: Build wheels
run: |
pip install --default-timeout=1000 -r tools/install_deps/pytest.txt -r tools/install_deps/tensorflow-cpu.txt -r requirements.txt
bash tools/install_deps/bazel_linux.sh
bash tools/install_deps/install_bazelisk.sh ./
python configure.py
bazel test -c opt -k --test_timeout 300,450,1200,3600 --test_output=errors //tensorflow_addons/...
release-wheel:
Expand Down Expand Up @@ -60,11 +59,7 @@ jobs:
- name: Setup Bazel
# Ubuntu bazel is run inside of the docker image
if: matrix.os != 'ubuntu-18.04'
# MacOS VMs share IP addr on GH actions. This bazel installation authenticates token to prevent api rate limiting.
uses: jwlawson/actions-setup-bazel@784af34 # Version 1.1
with:
bazel-version: ${{ env.BAZEL_VERSION}}
github-api-token: ${{ secrets.GITHUB_TOKEN }}
run: bash tools/install_deps/install_bazelisk.sh ./
- name: Build wheels
env:
OS: ${{ runner.os }}
Expand Down
4 changes: 2 additions & 2 deletions tools/docker/cpu_tests.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ ARG TF_VERSION=2.3.0
RUN pip install --default-timeout=1000 tensorflow-cpu==$TF_VERSION

RUN apt-get update && apt-get install -y sudo rsync
COPY tools/install_deps/bazel_linux.sh ./
RUN bash bazel_linux.sh
COPY tools/install_deps/install_bazelisk.sh .bazelversion ./
RUN bash install_bazelisk.sh

COPY requirements.txt ./
RUN pip install -r requirements.txt
Expand Down
8 changes: 4 additions & 4 deletions tools/docker/sanity_check.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ COPY tools/install_deps/tensorflow-cpu.txt ./
RUN pip install --default-timeout=1000 -r tensorflow-cpu.txt

RUN apt-get update && apt-get install sudo
COPY tools/install_deps/bazel_linux.sh ./
RUN bash bazel_linux.sh
COPY tools/install_deps/install_bazelisk.sh .bazelversion ./
RUN bash install_bazelisk.sh

COPY ./ /addons
WORKDIR /addons
Expand Down Expand Up @@ -109,8 +109,8 @@ COPY tools/install_deps/pytest.txt ./
RUN pip install -r pytest.txt

RUN apt-get update && apt-get install -y sudo rsync
COPY tools/install_deps/bazel_linux.sh ./
RUN bash bazel_linux.sh
COPY tools/install_deps/install_bazelisk.sh .bazelversion ./
RUN bash install_bazelisk.sh

COPY ./ /addons
WORKDIR /addons
Expand Down
8 changes: 0 additions & 8 deletions tools/install_deps/bazel_linux.sh

This file was deleted.

23 changes: 23 additions & 0 deletions tools/install_deps/install_bazelisk.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Downloads bazelisk to ${output_dir} as `bazel`.
date

output_dir=${1:-"/usr/local/bin"}

case "$(uname -s)" in
Darwin) name=bazelisk-darwin-amd64 ;;
Linux) name=bazelisk-linux-amd64 ;;
*) name=bazelisk-windows-amd64 ;;
esac

mkdir -p "${output_dir}"
curl -LO "https://github.com/bazelbuild/bazelisk/releases/download/v1.3.0/${name}"

mv "${name}" "${output_dir}/bazel"
chmod u+x "${output_dir}/bazel"

if [[ ! ":$PATH:" =~ :${output_dir}/?: ]]; then
PATH="${output_dir}:$PATH"
fi

which bazel
date

0 comments on commit 6329e1a

Please sign in to comment.