From 4b09cb199b7a91e47675175b38b01e24498c6278 Mon Sep 17 00:00:00 2001 From: Mike Bernico Date: Mon, 27 Mar 2023 23:09:50 +0000 Subject: [PATCH 1/3] Updated CI to use bazelisk and install bazel into /usr/local/bin. --- CONTRIBUTING.md | 5 +++- ci/Dockerfile.micro | 2 +- ci/{install_bazel.sh => install_bazelisk.sh} | 26 +++----------------- 3 files changed, 9 insertions(+), 24 deletions(-) rename ci/{install_bazel.sh => install_bazelisk.sh} (51%) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4b2a86f71c2..f73128a33a1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -168,6 +168,9 @@ Below are some tips that might be useful and improve the development experience. * Get a copy of [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint) or install it: +* Install Pillow and Wave. For example, [here](ci/Dockerfile.micro) is what we + do for the TFLM continuous integration Docker container. + ``` pip install cpplint ``` @@ -204,7 +207,7 @@ Below are some tips that might be useful and improve the development experience. 1. Run all the tests for x86, and any other platform that you are modifying. ``` - tensorflow/lite/micro/tools/ci_build/test_x86.sh + tensorflow/lite/micro/tools/ci_build/test_x86_default.sh ``` Please check the READMEs in the optimized kernel directories for specific diff --git a/ci/Dockerfile.micro b/ci/Dockerfile.micro index f8fe551c57d..4f7d57bf269 100644 --- a/ci/Dockerfile.micro +++ b/ci/Dockerfile.micro @@ -50,5 +50,5 @@ RUN pip install six RUN pip install pyyaml requests psutil robotframework==4.0.1 COPY ci/*.sh /install/ -RUN /install/install_bazel.sh +RUN /install/install_bazelisk.sh RUN /install/install_buildifier.sh diff --git a/ci/install_bazel.sh b/ci/install_bazelisk.sh similarity index 51% rename from ci/install_bazel.sh rename to ci/install_bazelisk.sh index a79a5910791..d2f8a13d99b 100755 --- a/ci/install_bazel.sh +++ b/ci/install_bazelisk.sh @@ -14,27 +14,9 @@ # limitations under the License. # ============================================================================== -# Select bazel version. -BAZEL_VERSION="5.1.1" - -set +e -local_bazel_ver=$(bazel version 2>&1 | grep -i label | awk '{print $3}') - -if [[ "$local_bazel_ver" == "$BAZEL_VERSION" ]]; then - exit 0 -fi - set -e +wget https://github.com/bazelbuild/bazelisk/releases/download/v1.16.0/bazelisk-linux-amd64 +mv bazelisk-linux-amd64 bazel +chmod +x bazel +sudo mv bazel /usr/local/bin -# Install bazel. -mkdir -p /bazel -cd /bazel -if [[ ! -f "bazel-$BAZEL_VERSION-installer-linux-x86_64.sh" ]]; then - curl -fSsL -O https://github.com/bazelbuild/bazel/releases/download/$BAZEL_VERSION/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh -fi -chmod +x /bazel/bazel-*.sh -/bazel/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh -rm -f /bazel/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh - -# Enable bazel auto completion. -echo "source /usr/local/lib/bazel/bin/bazel-complete.bash" >> ~/.bashrc From 0a5c4140e38cd02781bb8cc2f9860867c2f63990 Mon Sep 17 00:00:00 2001 From: Advait Jain Date: Mon, 27 Mar 2023 21:44:56 -0700 Subject: [PATCH 2/3] temporarily add install_bazel.sh (copy of install_bazelisk.sh). The reason is that any github workflow that needs access to secrets runs from the main branch and so the install_bazel.sh can not be deleted until the updated workflos get merged. --- ci/install_bazel.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 ci/install_bazel.sh diff --git a/ci/install_bazel.sh b/ci/install_bazel.sh new file mode 100755 index 00000000000..d2f8a13d99b --- /dev/null +++ b/ci/install_bazel.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +# Copyright 2021 The TensorFlow Authors. All Rights Reserved. +# +# 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 +# +# http://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. +# ============================================================================== + +set -e +wget https://github.com/bazelbuild/bazelisk/releases/download/v1.16.0/bazelisk-linux-amd64 +mv bazelisk-linux-amd64 bazel +chmod +x bazel +sudo mv bazel /usr/local/bin + From 3f5bf2495f2a8921b8b433073780f862801f9e60 Mon Sep 17 00:00:00 2001 From: Advait Jain Date: Mon, 27 Mar 2023 21:55:33 -0700 Subject: [PATCH 3/3] Update the workflows. --- .github/workflows/ci.yml | 10 +++++----- .github/workflows/sync.yml | 4 ++-- .github/workflows/tests_entry.yml | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4ae3330527c..b2b40ecf09a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,7 +33,7 @@ jobs: ref: ${{ inputs.trigger-sha }} - name: Install dependencies run: | - sudo ci/install_bazel.sh + sudo ci/install_bazelisk.sh pip3 install Pillow pip3 install Wave - name: Test @@ -53,7 +53,7 @@ jobs: ref: ${{ inputs.trigger-sha }} - name: Install dependencies run: | - sudo ci/install_bazel.sh + sudo ci/install_bazelisk.sh pip3 install Pillow pip3 install Wave - name: Test @@ -73,7 +73,7 @@ jobs: ref: ${{ inputs.trigger-sha }} - name: Install dependencies run: | - sudo ci/install_bazel.sh + sudo ci/install_bazelisk.sh pip3 install Pillow pip3 install Wave - name: Test @@ -93,7 +93,7 @@ jobs: ref: ${{ inputs.trigger-sha }} - name: Install dependencies run: | - sudo ci/install_bazel.sh + sudo ci/install_bazelisk.sh pip3 install Pillow pip3 install Wave - name: Test @@ -318,4 +318,4 @@ jobs: run: | tensorflow/lite/micro/tools/ci_build/test_makefile.sh cd ../ - tflite-micro/tensorflow/lite/micro/tools/ci_build/test_x86_no_tflite_static_memory.sh tflite-micro/ \ No newline at end of file + tflite-micro/tensorflow/lite/micro/tools/ci_build/test_x86_no_tflite_static_memory.sh tflite-micro/ diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index 3b4d323a94e..d505a9d44b5 100644 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -25,7 +25,7 @@ jobs: steps: - uses: actions/setup-python@v4 - with: + with: python-version: '3.10' - uses: actions/checkout@v2 with: @@ -33,7 +33,7 @@ jobs: - name: Install dependencies for sync run: | - sudo ./ci/install_bazel.sh + sudo ./ci/install_bazelisk.sh pip3 install numpy - name: Sync the code diff --git a/.github/workflows/tests_entry.yml b/.github/workflows/tests_entry.yml index da91212177c..5b8440218fb 100644 --- a/.github/workflows/tests_entry.yml +++ b/.github/workflows/tests_entry.yml @@ -7,14 +7,14 @@ # - If ci:ready_to_merge is on the PR and the pull_request_target type is synchronize not triggered # by the mergify[bot] user, remove label and fail job. # - If ci:ready_to_merge label is on PR and pull_request_target type is labeled, run the test scripts. -# +# # The end result is labeling ci:run or ci:ready_to_merge will run the test scripts, -# If Mergify merges to the PR, the test scripts will run. If anyone else tries to add +# If Mergify merges to the PR, the test scripts will run. If anyone else tries to add # a commit to the PR or merge , the script will fail and ci:ready_to_merge will be # removed. # -# This script runs the test scripts directly. Scheduled or manual runs use -# run_.yml as the entry point. +# This script runs the test scripts directly. Scheduled or manual runs use +# run_.yml as the entry point. name: Tests Entry Point on: