[CI] run.py improvements #1411
Workflow file for this run
This file contains 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: CI MacOS | |
on: | |
workflow_call: | |
workflow_dispatch: | |
inputs: | |
force_debug_with_tmate: | |
type: boolean | |
description: 'Run the build with tmate session' | |
required: false | |
default: false | |
debug_with_tmate: | |
type: boolean | |
description: 'Run the build with a tmate session ONLY in case of failure' | |
required: false | |
default: false | |
pull_request: | |
merge_group: | |
push: | |
branches: | |
- main | |
concurrency: | |
group: ci-build-test-cpp-macos-${{ github.event.number || github.sha }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
# force bash instead of zsh | |
shell: bash | |
jobs: | |
build_and_ctest: | |
name: Build and Test (${{ matrix.runs-on }}, ASSERTIONS) | |
runs-on: ${{ matrix.runs-on }} | |
strategy: | |
fail-fast: false | |
matrix: | |
runs-on: [ | |
macos-13, | |
# broken because of https://github.com/iree-org/iree/blob/0c6a151c65285987f5daabc7f76fe57a82b45ab1/compiler/plugins/target/LLVMCPU/ResolveCPUAndCPUFeatures.cpp#L58-L64 | |
# macos-14 | |
] | |
env: | |
CACHE_DIR: ${{ github.workspace }}/.container-cache | |
CACHE_KEY: ${{ matrix.runs-on }}-build-test-cpp-asserts-v1-${{ format('{0}-{1}', github.ref_name, github.run_number) }} | |
steps: | |
- name: Set unified TZ | |
uses: szenius/[email protected] | |
with: | |
# this is an arbitrary choice | |
timezoneLinux: "Asia/Singapore" | |
timezoneMacos: "Asia/Singapore" | |
timezoneWindows: "Singapore Standard Time" | |
- name: "Checking out repository" | |
env: | |
BRANCH_NAME: ${{ github.ref }} | |
REPO_ADDRESS: ${{ github.server_url }}/${{ github.repository }} | |
run: | | |
git init | |
git remote add origin $REPO_ADDRESS | |
git -c protocol.version=2 fetch --depth 1 origin $BRANCH_NAME | |
git reset --hard FETCH_HEAD | |
git -c submodule."third_party/torch-mlir".update=none \ | |
-c submodule."third_party/stablehlo".update=none \ | |
-c submodule."third_party/XRT".update=none \ | |
submodule update --init --recursive --depth 1 --single-branch -j 10 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Install deps | |
run: | | |
brew install ccache ninja | |
- name: Python deps | |
run: | | |
pip install -r third_party/iree/runtime/bindings/python/iree/runtime/build_requirements.txt | |
pip install pytest pybind11==2.13.6 nanobind==2.2.0 | |
- name: Enable cache | |
uses: actions/cache/restore@v3 | |
with: | |
path: ${{ env.CACHE_DIR }} | |
key: ${{ env.CACHE_KEY }} | |
restore-keys: ${{ matrix.runs-on }}-build-test-cpp- | |
- name: Build packages | |
run: | | |
export cache_dir="${{ env.CACHE_DIR }}" | |
export CCACHE_COMPILERCHECK="string:$(clang --version)" | |
bash build_tools/build_llvm.sh | |
rm -rf llvm-build | |
export llvm_install_dir=$PWD/llvm-install | |
bash build_tools/build_test_cpp.sh | |
- name: Create artifacts | |
if: ${{ !cancelled() }} | |
run: | | |
pushd third_party/iree/third_party/llvm-project && llvm_sha_short=$(git rev-parse --short HEAD) && popd | |
tar cf llvm-dist-${{ matrix.runs-on }}-$llvm_sha_short.tar llvm-install | |
tar cf iree-dist-${{ matrix.runs-on }}.tar iree-install | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
if: ${{ !cancelled() }} | |
with: | |
name: ${{ matrix.runs-on }}_llvm_packages | |
path: llvm-dist-*.tar | |
if-no-files-found: warn | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
if: ${{ !cancelled() }} | |
with: | |
name: ${{ matrix.runs-on }}_iree_packages | |
path: iree-dist-${{ matrix.runs-on }}.tar | |
if-no-files-found: warn | |
- name: Save cache | |
uses: actions/cache/save@v3 | |
if: ${{ !cancelled() && github.event_name == 'push' && github.ref_name == 'main' }} | |
with: | |
path: ${{ env.CACHE_DIR }} | |
key: ${{ env.CACHE_KEY }} | |
- name: Start tmate session | |
if: ${{ (failure() && inputs.debug_with_tmate) || inputs.force_debug_with_tmate }} | |
uses: mxschmitt/[email protected] | |
with: | |
limit-access-to-actor: true |