Skip to content

Commit 6329e1a

Browse files
authored
Use bazelisk (#2097)
* Use bazelisk to install bazel
1 parent e40a266 commit 6329e1a

File tree

7 files changed

+32
-24
lines changed

7 files changed

+32
-24
lines changed

Diff for: .bazelversion

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.1.0

Diff for: .github/workflows/ci_test.yml

-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ on:
1010
- master
1111
- r*
1212

13-
env:
14-
BAZEL_VERSION: 3.1.0
15-
1613
jobs:
1714
flake8-test:
1815
name: Flake8

Diff for: .github/workflows/release.yml

+2-7
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ on:
1515
- r*
1616

1717
env:
18-
BAZEL_VERSION: '3.1.0'
1918
MIN_PY_VERSION: '3.5'
2019
MAX_PY_VERSION: '3.8'
2120

@@ -31,7 +30,7 @@ jobs:
3130
- name: Build wheels
3231
run: |
3332
pip install --default-timeout=1000 -r tools/install_deps/pytest.txt -r tools/install_deps/tensorflow-cpu.txt -r requirements.txt
34-
bash tools/install_deps/bazel_linux.sh
33+
bash tools/install_deps/install_bazelisk.sh ./
3534
python configure.py
3635
bazel test -c opt -k --test_timeout 300,450,1200,3600 --test_output=errors //tensorflow_addons/...
3736
release-wheel:
@@ -60,11 +59,7 @@ jobs:
6059
- name: Setup Bazel
6160
# Ubuntu bazel is run inside of the docker image
6261
if: matrix.os != 'ubuntu-18.04'
63-
# MacOS VMs share IP addr on GH actions. This bazel installation authenticates token to prevent api rate limiting.
64-
uses: jwlawson/actions-setup-bazel@784af34 # Version 1.1
65-
with:
66-
bazel-version: ${{ env.BAZEL_VERSION}}
67-
github-api-token: ${{ secrets.GITHUB_TOKEN }}
62+
run: bash tools/install_deps/install_bazelisk.sh ./
6863
- name: Build wheels
6964
env:
7065
OS: ${{ runner.os }}

Diff for: tools/docker/cpu_tests.Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ ARG TF_VERSION=2.3.0
55
RUN pip install --default-timeout=1000 tensorflow-cpu==$TF_VERSION
66

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

1111
COPY requirements.txt ./
1212
RUN pip install -r requirements.txt

Diff for: tools/docker/sanity_check.Dockerfile

+4-4
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ COPY tools/install_deps/tensorflow-cpu.txt ./
4040
RUN pip install --default-timeout=1000 -r tensorflow-cpu.txt
4141

4242
RUN apt-get update && apt-get install sudo
43-
COPY tools/install_deps/bazel_linux.sh ./
44-
RUN bash bazel_linux.sh
43+
COPY tools/install_deps/install_bazelisk.sh .bazelversion ./
44+
RUN bash install_bazelisk.sh
4545

4646
COPY ./ /addons
4747
WORKDIR /addons
@@ -109,8 +109,8 @@ COPY tools/install_deps/pytest.txt ./
109109
RUN pip install -r pytest.txt
110110

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

115115
COPY ./ /addons
116116
WORKDIR /addons

Diff for: tools/install_deps/bazel_linux.sh

-8
This file was deleted.

Diff for: tools/install_deps/install_bazelisk.sh

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Downloads bazelisk to ${output_dir} as `bazel`.
2+
date
3+
4+
output_dir=${1:-"/usr/local/bin"}
5+
6+
case "$(uname -s)" in
7+
Darwin) name=bazelisk-darwin-amd64 ;;
8+
Linux) name=bazelisk-linux-amd64 ;;
9+
*) name=bazelisk-windows-amd64 ;;
10+
esac
11+
12+
mkdir -p "${output_dir}"
13+
curl -LO "https://github.com/bazelbuild/bazelisk/releases/download/v1.3.0/${name}"
14+
15+
mv "${name}" "${output_dir}/bazel"
16+
chmod u+x "${output_dir}/bazel"
17+
18+
if [[ ! ":$PATH:" =~ :${output_dir}/?: ]]; then
19+
PATH="${output_dir}:$PATH"
20+
fi
21+
22+
which bazel
23+
date

0 commit comments

Comments
 (0)