Skip to content

linux_x86_64

linux_x86_64 #4709

Workflow file for this run

name: "linux_x86_64"
on:
push:
tags:
- v*.*.*
pull_request:
branches:
- main
schedule:
- cron: "0 10 * * *" # Run at 2am PST (10am UTC) every day to refresh the cache.
workflow_dispatch:
inputs:
REFRESH_CACHE:
description: 'Refresh cache to remove unused files'
type: boolean
default: true
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
presubmit:
name: "Presubmit-Linux"
runs-on: LiteRT_Linux_x64 # Latest high spec runner (96 cores and 384GB RAM).
permissions:
actions: write
contents: write
env:
GH_TOKEN: ${{ github.token }}
REFRESH_CACHE: ${{ github.event_name == 'schedule' ||
(github.event_name == 'workflow_dispatch' && inputs.REFRESH_CACHE) }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install System Dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libc++-dev \
libc++abi-dev \
clang \
- name: Configure tensorflow & python path
run: |
chmod +x configure.py
export PYTHON_BIN_PATH=$(which python3)
export PYTHON_LIB_PATH=$(python3 -c 'import site; print(site.getsitepackages()[0])')
export TF_NEED_ROCM=0
export TF_NEED_CUDA=0
export TF_SET_ANDROID_WORKSPACE=0
export CC_OPT_FLAGS='-Wno-sign-compare'
python3 configure.py
- name: Set up cache keys
id: cache-keys
run: |
CACHE_RESTORE_KEY_2="${{ github.workflow }}"
CACHE_RESTORE_KEY_1="$CACHE_RESTORE_KEY_2-${{ hashFiles('**/WORKSPACE', '**/.bazelrc') }}"
CACHE_RESTORE_KEY_0="$CACHE_RESTORE_KEY_1-${{ hashFiles('**/BUILD*') }}"
CACHE_RESTORE_KEY_HEAD="$CACHE_RESTORE_KEY_0-${{ github.event.pull_request.base.sha }}"
CACHE_KEY="$CACHE_RESTORE_KEY_0-${{ github.sha }}"
echo "CACHE_RESTORE_KEY_2=$CACHE_RESTORE_KEY_2" >> "$GITHUB_OUTPUT"
echo "CACHE_RESTORE_KEY_1=$CACHE_RESTORE_KEY_1" >> "$GITHUB_OUTPUT"
echo "CACHE_RESTORE_KEY_0=$CACHE_RESTORE_KEY_0" >> "$GITHUB_OUTPUT"
echo "CACHE_RESTORE_KEY_HEAD=$CACHE_RESTORE_KEY_HEAD" >> "$GITHUB_OUTPUT"
echo "CACHE_KEY=$CACHE_KEY" >> "$GITHUB_OUTPUT"
- name: Clean build outputs if cache is being refreshed.
if: env.REFRESH_CACHE == 'true'
run: bazel clean --expunge
- name: Restore bazel cache if cache is not being refreshed.
id: bazel-cache
if: env.REFRESH_CACHE != 'true'
uses: actions/cache/restore@v4
with:
path: |
~/.cache/bazel-linux
~/.cache/bazel-android
key: ${{ steps.cache-keys.outputs.CACHE_KEY }}
restore-keys: |
${{ steps.cache-keys.outputs.CACHE_RESTORE_KEY_HEAD }}
${{ steps.cache-keys.outputs.CACHE_RESTORE_KEY_0 }}-
${{ steps.cache-keys.outputs.CACHE_RESTORE_KEY_1 }}-
${{ steps.cache-keys.outputs.CACHE_RESTORE_KEY_2 }}-
- name: Check cache hit
run: |
echo "Cache Hit: ${{ steps.bazel-cache.outputs.cache-hit }}"
echo "Cache Primary Key: ${{ steps.bazel-cache.outputs.cache-primary-key }}"
echo "Cache Matched Key: ${{ steps.bazel-cache.outputs.cache-matched-key }}"
- name: Run bazel build on Linux
env:
TEST_LANG_FILTERS: cc,py
run: |
BUILD_FLAGS=(
"--config=bulk_test_cpu"
"--test_lang_filters=${TEST_LANG_FILTERS}"
"--keep_going"
"--repo_env=USE_PYWRAP_RULES=True"
)
LITERT_EXCLUDED_TARGETS=(
"-//litert/c:litert_compiled_model_shared_lib_test"
"-//litert/c:litert_compiled_model_test"
"-//litert/cc:litert_compiled_model_test"
"-//litert/cc:litert_environment_test"
"-//litert/python/tools/model_utils/test/..."
"-//litert/runtime:compiled_model_test"
"-//litert/tools:tool_display_test"
"-//litert/tools:dump_test"
"-//litert/tools:apply_plugin_test"
"-//litert/vendors/intel_openvino/..."
)
bazel test --disk_cache=~/.cache/bazel-linux "${BUILD_FLAGS[@]}" -- //litert/... "${LITERT_EXCLUDED_TARGETS[@]}"
- name: Remove cache if cache is being refreshed.
if: env.REFRESH_CACHE == 'true'
continue-on-error: true
run: gh cache delete ${{ steps.cache-keys.outputs.CACHE_KEY }}
- name: Save bazel cache if it's new or being refreshed.
uses: actions/cache/save@v4
if: env.REFRESH_CACHE == 'true' || steps.bazel-cache.outputs.cache-hit != 'true'
with:
path: |
~/.cache/bazel-linux
~/.cache/bazel-android
key: ${{ steps.cache-keys.outputs.CACHE_KEY }}