| # Copyright 2022 The IREE Authors | |
| # | |
| # Licensed under the Apache License v2.0 with LLVM Exceptions. | |
| # See https://llvm.org/LICENSE.txt for license information. | |
| # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | |
| name: CI | |
| # A few notes: | |
| # | |
| # Variables: | |
| # GitHub actions don't have variables or even support normal yaml anchors (they | |
| # are specially disabled because...reasons?): | |
| # See https://github.com/github-community/community/discussions/4501 | |
| # https://github.community/t/support-for-yaml-anchors/16128/92 | |
| # https://github.com/actions/runner/issues/1182 | |
| # Neither does it have any contexts that are available everywhere. The | |
| # top-level `env` field is available in many places, but not all. We already | |
| # have a "setup" job that every other job depends on, so we leverage that | |
| # for variables that every other job can use, since that *is* available in all | |
| # sub-fields of the job. | |
| # See https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability | |
| # and https://github.com/community/community/discussions/27370 | |
| # | |
| # Runner label ordering: | |
| # - self-hosted always has to be listed first in a runs-on block: | |
| # https://docs.github.com/en/actions/hosting-your-own-runners/using-self-hosted-runners-in-a-workflow | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| concurrency: | |
| # A PR number if a pull request and otherwise the commit hash. This cancels | |
| # queued and in-progress runs for the same PR (presubmit) or commit | |
| # (postsubmit). The workflow name is prepended to avoid conflicts between | |
| # different workflows. | |
| group: ${{ github.workflow }}-${{ github.event.number || github.sha }} | |
| cancel-in-progress: true | |
| # Jobs are organized into groups and topologically sorted by dependencies | |
| jobs: | |
| setup: | |
| uses: ./.github/workflows/setup.yml | |
| ############################################################################## | |
| # Runtime builds | |
| runtime: | |
| needs: setup | |
| name: "runtime :: ${{ matrix.name }}" | |
| if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'runtime') | |
| runs-on: ${{ matrix.runs-on }} | |
| defaults: | |
| run: | |
| shell: bash | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: ubuntu-24.04 | |
| runs-on: ubuntu-24.04 | |
| driver-options: -DIREE_HAL_DRIVER_CUDA=ON -DIREE_HAL_DRIVER_HIP=ON -DIREE_HAL_DRIVER_VULKAN=ON | |
| - name: ubuntu-24.04-arm | |
| runs-on: ubuntu-24.04-arm | |
| driver-options: -DIREE_HAL_DRIVER_CUDA=ON -DIREE_HAL_DRIVER_HIP=ON -DIREE_HAL_DRIVER_VULKAN=ON | |
| - name: windows-2022 | |
| runs-on: windows-2022 | |
| driver-options: -DIREE_HAL_DRIVER_CUDA=ON -DIREE_HAL_DRIVER_HIP=ON -DIREE_HAL_DRIVER_VULKAN=ON | |
| - name: macos-15 | |
| runs-on: macos-15 | |
| driver-options: -DIREE_HAL_DRIVER_METAL=ON -DIREE_HAL_DRIVER_VULKAN=OFF | |
| env: | |
| BUILD_DIR: build-runtime | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 | |
| with: | |
| python-version: "3.11" | |
| - name: (Linux) Install requirements | |
| if: contains(matrix.name, 'ubuntu') | |
| run: | | |
| sudo apt update | |
| sudo apt install -y ninja-build | |
| echo "CC=clang" >> $GITHUB_ENV | |
| echo "CXX=clang++" >> $GITHUB_ENV | |
| - name: (Windows) Configure MSVC | |
| if: contains(matrix.name, 'windows') | |
| uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 | |
| - name: (macOS) Install requirements | |
| if: contains(matrix.name, 'macos') | |
| run: brew install ninja ccache coreutils bash | |
| - name: Checkout runtime submodules | |
| run: bash ./build_tools/scripts/git/update_runtime_submodules.sh | |
| - name: Install Python requirements | |
| run: pip install -r ./runtime/bindings/python/iree/runtime/build_requirements.txt | |
| - name: ccache | |
| uses: hendrikmuhs/ccache-action@f09c25b45002a07be2955cbe52e8cee55643f89d # v1.2.24 | |
| with: | |
| key: ${{ github.job }}-${{ matrix.name }} | |
| save: ${{ needs.setup.outputs.write-caches == 1 }} | |
| - name: CMake - configure | |
| run: | | |
| cmake \ | |
| -G Ninja \ | |
| -B ${BUILD_DIR} \ | |
| -DCMAKE_BUILD_TYPE=RelWithDebInfo \ | |
| -DCMAKE_C_COMPILER_LAUNCHER=ccache \ | |
| -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ | |
| -DIREE_BUILD_COMPILER=OFF \ | |
| -DIREE_BUILD_PYTHON_BINDINGS=ON \ | |
| -DIREE_BUILD_SAMPLES=ON \ | |
| -DIREE_ENABLE_LLD=ON \ | |
| -DIREE_ENABLE_ASSERTIONS=ON \ | |
| ${{matrix.driver-options}} | |
| - name: CMake - build | |
| run: cmake --build ${BUILD_DIR} -- -k 0 | |
| - name: CTest | |
| run: bash ./build_tools/cmake/ctest_all.sh "${BUILD_DIR}" | |
| runtime_small: | |
| needs: setup | |
| if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'runtime_small') | |
| runs-on: ubuntu-24.04 | |
| env: | |
| BUILD_DIR: build-runtime | |
| CC: clang | |
| CXX: clang++ | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Install requirements | |
| run: sudo apt update && sudo apt install -y ninja-build | |
| - name: Checkout runtime submodules | |
| run: bash ./build_tools/scripts/git/update_runtime_submodules.sh | |
| - name: ccache | |
| uses: hendrikmuhs/ccache-action@f09c25b45002a07be2955cbe52e8cee55643f89d # v1.2.24 | |
| with: | |
| key: ${{ github.job }} | |
| save: ${{ needs.setup.outputs.write-caches == 1 }} | |
| - name: CMake - configure | |
| run: | | |
| cmake \ | |
| -G Ninja \ | |
| -B ${BUILD_DIR} \ | |
| -DCMAKE_BUILD_TYPE=MinSizeRel \ | |
| -DCMAKE_C_COMPILER_LAUNCHER=ccache \ | |
| -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ | |
| -DIREE_BUILD_COMPILER=OFF \ | |
| -DIREE_RUNTIME_OPTIMIZATION_PROFILE=size \ | |
| -DIREE_ENABLE_LLD=ON | |
| - name: CMake - build | |
| run: cmake --build ${BUILD_DIR} -- -k 0 | |
| - name: CTest | |
| run: bash ./build_tools/cmake/ctest_all.sh "${BUILD_DIR}" | |
| runtime_wasm: | |
| needs: setup | |
| name: "runtime_wasm :: wasm32" | |
| if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'runtime_wasm') | |
| runs-on: ubuntu-24.04 | |
| env: | |
| BUILD_DIR: build-runtime-wasm | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Install requirements | |
| run: sudo apt update && sudo apt install -y ninja-build | |
| - name: Checkout runtime submodules | |
| run: bash ./build_tools/scripts/git/update_runtime_submodules.sh | |
| - name: ccache | |
| uses: hendrikmuhs/ccache-action@f09c25b45002a07be2955cbe52e8cee55643f89d # v1.2.24 | |
| with: | |
| key: ${{ github.job }} | |
| save: ${{ needs.setup.outputs.write-caches == 1 }} | |
| - name: CMake - configure | |
| run: | | |
| cmake \ | |
| -G Ninja \ | |
| -B ${BUILD_DIR} \ | |
| -DCMAKE_TOOLCHAIN_FILE=build_tools/cmake/wasm32.cmake \ | |
| -DCMAKE_BUILD_TYPE=MinSizeRel \ | |
| -DCMAKE_C_COMPILER_LAUNCHER=ccache \ | |
| -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ | |
| -DIREE_RUNTIME_OPTIMIZATION_PROFILE=size \ | |
| -DIREE_ENABLE_LLD=ON | |
| - name: CMake - build wasm32 runtime smoke targets | |
| run: | | |
| cmake --build ${BUILD_DIR} \ | |
| --target \ | |
| iree_wasm_libc \ | |
| iree_samples_hal_hello_hello \ | |
| iree_async_platform_js_proactor \ | |
| iree_hal_drivers_local_sync_sync_driver \ | |
| -- -k 0 | |
| runtime_tracing: | |
| needs: setup | |
| name: "runtime_tracing :: ${{ matrix.runs-on }} :: ${{ matrix.provider }}" | |
| if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'runtime_tracing') | |
| runs-on: ${{ matrix.runs-on }} | |
| defaults: | |
| run: | |
| shell: bash | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| runs-on: [ubuntu-24.04, ubuntu-24.04-arm, windows-2022, macos-15] | |
| provider: [tracy, console] | |
| env: | |
| BUILD_DIR: build-tracing | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: (Linux) Install requirements | |
| if: contains(matrix.runs-on, 'ubuntu') | |
| run: | | |
| sudo apt update | |
| sudo apt install -y ninja-build | |
| echo "CC=clang" >> $GITHUB_ENV | |
| echo "CXX=clang++" >> $GITHUB_ENV | |
| - name: (Windows) Configure MSVC | |
| if: contains(matrix.runs-on, 'windows') | |
| uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 | |
| - name: (macOS) Install requirements | |
| if: contains(matrix.runs-on, 'macos') | |
| run: brew install ninja ccache coreutils bash | |
| - name: (Linux/Windows) Set driver options | |
| if: contains(matrix.runs-on, 'ubuntu') || contains(matrix.runs-on, 'windows') | |
| run: echo IREE_DRIVER_OPTIONS="-DIREE_HAL_DRIVER_CUDA=ON -DIREE_HAL_DRIVER_HIP=ON -DIREE_HAL_DRIVER_VULKAN=ON" >> $GITHUB_ENV | |
| - name: (macOS) Set driver options | |
| if: contains(matrix.runs-on, 'macos') | |
| run: echo IREE_DRIVER_OPTIONS="-DIREE_HAL_DRIVER_METAL=ON -DIREE_HAL_DRIVER_VULKAN=OFF" >> $GITHUB_ENV | |
| - name: Checkout runtime submodules | |
| run: bash ./build_tools/scripts/git/update_runtime_submodules.sh | |
| - name: ccache | |
| uses: hendrikmuhs/ccache-action@f09c25b45002a07be2955cbe52e8cee55643f89d # v1.2.24 | |
| with: | |
| key: ${{ github.job }}-${{ matrix.runs-on}}-${{ matrix.provider }} | |
| save: ${{ needs.setup.outputs.write-caches == 1 }} | |
| - name: CMake - configure | |
| run: | | |
| cmake \ | |
| -G Ninja \ | |
| -B ${BUILD_DIR} \ | |
| -DCMAKE_BUILD_TYPE=RelWithDebInfo \ | |
| -DCMAKE_C_COMPILER_LAUNCHER=ccache \ | |
| -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ | |
| -DIREE_BUILD_COMPILER=OFF \ | |
| -DIREE_ENABLE_LLD=ON \ | |
| -DIREE_ENABLE_RUNTIME_TRACING=ON \ | |
| -DIREE_TRACING_PROVIDER=${{ matrix.provider }} \ | |
| ${IREE_DRIVER_OPTIONS} | |
| - name: CMake - build | |
| run: cmake --build ${BUILD_DIR} -- -k 0 | |
| ############################################################################## | |
| # Full project builds | |
| linux_x64_bazel: | |
| needs: setup | |
| if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'linux_x64_bazel') | |
| uses: ./.github/workflows/ci_linux_x64_bazel.yml | |
| secrets: inherit | |
| linux_x64_clang: | |
| needs: setup | |
| if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'linux_x64_clang') | |
| uses: ./.github/workflows/ci_linux_x64_clang.yml | |
| secrets: inherit | |
| linux_x64_gcc: | |
| needs: setup | |
| if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'linux_x64_gcc') | |
| uses: ./.github/workflows/ci_linux_x64_gcc.yml | |
| secrets: inherit | |
| linux_arm64_clang: | |
| needs: setup | |
| if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'linux_arm64_clang') | |
| uses: ./.github/workflows/ci_linux_arm64_clang.yml | |
| secrets: inherit | |
| linux_x64_clang_debug: | |
| needs: setup | |
| if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'linux_x64_clang_debug') | |
| uses: ./.github/workflows/ci_linux_x64_clang_debug.yml | |
| secrets: inherit | |
| linux_x64_clang_dynamic_plugins: | |
| needs: setup | |
| if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'linux_x64_clang_dynamic_plugins') | |
| uses: ./.github/workflows/ci_linux_x64_clang_dynamic_plugins.yml | |
| secrets: inherit | |
| linux_x64_clang_asan: | |
| needs: setup | |
| if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'linux_x64_clang_asan') | |
| uses: ./.github/workflows/ci_linux_x64_clang_asan.yml | |
| secrets: inherit | |
| linux_x64_clang_ubsan: | |
| needs: setup | |
| if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'linux_x64_clang_ubsan') | |
| uses: ./.github/workflows/ci_linux_x64_clang_ubsan.yml | |
| secrets: inherit | |
| linux_x64_clang_tsan: | |
| needs: setup | |
| if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'linux_x64_clang_tsan') | |
| uses: ./.github/workflows/ci_linux_x64_clang_tsan.yml | |
| secrets: inherit | |
| linux_x64_clang_byollvm: | |
| needs: setup | |
| if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'linux_x64_clang_byollvm') | |
| uses: ./.github/workflows/ci_linux_x64_clang_byollvm.yml | |
| secrets: inherit | |
| macos_arm64_clang: | |
| needs: setup | |
| if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'macos_arm64_clang') | |
| uses: ./.github/workflows/ci_macos_arm64_clang.yml | |
| secrets: inherit | |
| windows_x64_msvc: | |
| needs: setup | |
| if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'windows_x64_msvc') | |
| uses: ./.github/workflows/ci_windows_x64_msvc.yml | |
| secrets: inherit | |
| ############################################################################## | |
| # Aggregate job status and alerting on failures. | |
| ci_summary: | |
| if: always() | |
| needs: | |
| - setup | |
| # Runtime builds. | |
| - runtime | |
| - runtime_small | |
| - runtime_wasm | |
| - runtime_tracing | |
| # Full project builds. | |
| - linux_x64_bazel | |
| - linux_x64_clang | |
| - linux_x64_gcc | |
| - linux_arm64_clang | |
| - linux_x64_clang_debug | |
| - linux_x64_clang_dynamic_plugins | |
| - linux_x64_clang_asan | |
| - linux_x64_clang_ubsan | |
| - linux_x64_clang_tsan | |
| - linux_x64_clang_byollvm | |
| - macos_arm64_clang | |
| - windows_x64_msvc | |
| uses: ./.github/workflows/workflow_summary.yml | |
| secrets: inherit | |
| with: | |
| jobs-json: ${{ toJson(needs) }} | |
| ci-deferred: ${{ needs.setup.outputs.ci-deferred == 'true' }} |