Configure Openvino prebuilt SDKs for multiple platforms #5384
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "macos-arm64" | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| schedule: | |
| - cron: "0 10 * * *" # Run at 2am PST (10am UTC) every day to refresh the cache. | |
| workflow_dispatch: # Manual trigger | |
| 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-Mac" | |
| runs-on: macos-15-xlarge | |
| permissions: | |
| actions: write # For gh cache delete. | |
| contents: write # For gh release upload. | |
| env: | |
| GH_TOKEN: ${{ github.token }} # For gh release upload. | |
| 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: 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*') }}" | |
| # If it's not a pull request, then it will be the same as $CACHE_RESTORE_KEY_1-. | |
| 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-macos | |
| ~/.cache/bazel-ios | |
| 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: Build LiteRT targets | |
| run: | | |
| # TODO(b/446718368): Re-enable the tests once we update our workflow with a custom runner. | |
| bazel build --disk_cache=~/.cache/bazel-macos \ | |
| -c opt \ | |
| -s \ | |
| --cxxopt=-std=c++17 \ | |
| --verbose_failures \ | |
| //litert/core/... | |
| - name: Run LiteRT tests | |
| run: | | |
| bazel test --disk_cache=~/.cache/bazel-macos \ | |
| -c opt \ | |
| -s \ | |
| --cxxopt=-std=c++17 \ | |
| --verbose_failures \ | |
| //litert/core/... | |
| - name: Remove cache if cache is being refreshed. | |
| if: env.REFRESH_CACHE == 'true' | |
| continue-on-error: true # Ignore errors when cache is not found. | |
| 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-macos | |
| ~/.cache/bazel-ios | |
| key: ${{ steps.cache-keys.outputs.CACHE_KEY }} |