Skip to content

Commit 995eb25

Browse files
authored
Updated CI to use bazelisk and install bazel into /usr/local/bin. (#1853)
BUG=fixes #1852
1 parent bef8fe8 commit 995eb25

File tree

7 files changed

+42
-35
lines changed

7 files changed

+42
-35
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
ref: ${{ inputs.trigger-sha }}
3434
- name: Install dependencies
3535
run: |
36-
sudo ci/install_bazel.sh
36+
sudo ci/install_bazelisk.sh
3737
pip3 install Pillow
3838
pip3 install Wave
3939
- name: Test
@@ -53,7 +53,7 @@ jobs:
5353
ref: ${{ inputs.trigger-sha }}
5454
- name: Install dependencies
5555
run: |
56-
sudo ci/install_bazel.sh
56+
sudo ci/install_bazelisk.sh
5757
pip3 install Pillow
5858
pip3 install Wave
5959
- name: Test
@@ -73,7 +73,7 @@ jobs:
7373
ref: ${{ inputs.trigger-sha }}
7474
- name: Install dependencies
7575
run: |
76-
sudo ci/install_bazel.sh
76+
sudo ci/install_bazelisk.sh
7777
pip3 install Pillow
7878
pip3 install Wave
7979
- name: Test
@@ -93,7 +93,7 @@ jobs:
9393
ref: ${{ inputs.trigger-sha }}
9494
- name: Install dependencies
9595
run: |
96-
sudo ci/install_bazel.sh
96+
sudo ci/install_bazelisk.sh
9797
pip3 install Pillow
9898
pip3 install Wave
9999
- name: Test
@@ -318,4 +318,4 @@ jobs:
318318
run: |
319319
tensorflow/lite/micro/tools/ci_build/test_makefile.sh
320320
cd ../
321-
tflite-micro/tensorflow/lite/micro/tools/ci_build/test_x86_no_tflite_static_memory.sh tflite-micro/
321+
tflite-micro/tensorflow/lite/micro/tools/ci_build/test_x86_no_tflite_static_memory.sh tflite-micro/

.github/workflows/sync.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ jobs:
2525
2626
steps:
2727
- uses: actions/setup-python@v4
28-
with:
28+
with:
2929
python-version: '3.10'
3030
- uses: actions/checkout@v2
3131
with:
3232
token: ${{ secrets.TFLM_BOT_REPO_TOKEN }}
3333

3434
- name: Install dependencies for sync
3535
run: |
36-
sudo ./ci/install_bazel.sh
36+
sudo ./ci/install_bazelisk.sh
3737
pip3 install numpy
3838
3939
- name: Sync the code

.github/workflows/tests_entry.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
# - If ci:ready_to_merge is on the PR and the pull_request_target type is synchronize not triggered
88
# by the mergify[bot] user, remove label and fail job.
99
# - If ci:ready_to_merge label is on PR and pull_request_target type is labeled, run the test scripts.
10-
#
10+
#
1111
# The end result is labeling ci:run or ci:ready_to_merge will run the test scripts,
12-
# If Mergify merges to the PR, the test scripts will run. If anyone else tries to add
12+
# If Mergify merges to the PR, the test scripts will run. If anyone else tries to add
1313
# a commit to the PR or merge , the script will fail and ci:ready_to_merge will be
1414
# removed.
1515
#
16-
# This script runs the test scripts directly. Scheduled or manual runs use
17-
# run_<scriptname>.yml as the entry point.
16+
# This script runs the test scripts directly. Scheduled or manual runs use
17+
# run_<scriptname>.yml as the entry point.
1818

1919
name: Tests Entry Point
2020
on:

CONTRIBUTING.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,9 @@ Below are some tips that might be useful and improve the development experience.
168168
* Get a copy of [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint)
169169
or install it:
170170

171+
* Install Pillow and Wave. For example, [here](ci/Dockerfile.micro) is what we
172+
do for the TFLM continuous integration Docker container.
173+
171174
```
172175
pip install cpplint
173176
```
@@ -204,7 +207,7 @@ Below are some tips that might be useful and improve the development experience.
204207
1. Run all the tests for x86, and any other platform that you are modifying.
205208
206209
```
207-
tensorflow/lite/micro/tools/ci_build/test_x86.sh
210+
tensorflow/lite/micro/tools/ci_build/test_x86_default.sh
208211
```
209212
210213
Please check the READMEs in the optimized kernel directories for specific

ci/Dockerfile.micro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,5 @@ RUN pip install six
5050
RUN pip install pyyaml requests psutil robotframework==4.0.1
5151

5252
COPY ci/*.sh /install/
53-
RUN /install/install_bazel.sh
53+
RUN /install/install_bazelisk.sh
5454
RUN /install/install_buildifier.sh

ci/install_bazel.sh

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,9 @@
1414
# limitations under the License.
1515
# ==============================================================================
1616

17-
# Select bazel version.
18-
BAZEL_VERSION="5.1.1"
19-
20-
set +e
21-
local_bazel_ver=$(bazel version 2>&1 | grep -i label | awk '{print $3}')
22-
23-
if [[ "$local_bazel_ver" == "$BAZEL_VERSION" ]]; then
24-
exit 0
25-
fi
26-
2717
set -e
18+
wget https://github.com/bazelbuild/bazelisk/releases/download/v1.16.0/bazelisk-linux-amd64
19+
mv bazelisk-linux-amd64 bazel
20+
chmod +x bazel
21+
sudo mv bazel /usr/local/bin
2822

29-
# Install bazel.
30-
mkdir -p /bazel
31-
cd /bazel
32-
if [[ ! -f "bazel-$BAZEL_VERSION-installer-linux-x86_64.sh" ]]; then
33-
curl -fSsL -O https://github.com/bazelbuild/bazel/releases/download/$BAZEL_VERSION/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh
34-
fi
35-
chmod +x /bazel/bazel-*.sh
36-
/bazel/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh
37-
rm -f /bazel/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh
38-
39-
# Enable bazel auto completion.
40-
echo "source /usr/local/lib/bazel/bin/bazel-complete.bash" >> ~/.bashrc

ci/install_bazelisk.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
# ==============================================================================
16+
17+
set -e
18+
wget https://github.com/bazelbuild/bazelisk/releases/download/v1.16.0/bazelisk-linux-amd64
19+
mv bazelisk-linux-amd64 bazel
20+
chmod +x bazel
21+
sudo mv bazel /usr/local/bin
22+

0 commit comments

Comments
 (0)