Skip to content

Add build matrix to CI. (#3) #48

Add build matrix to CI. (#3)

Add build matrix to CI. (#3) #48

# 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: IREE Runtime Template
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
cancel-in-progress: true
jobs:
build_and_test:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: ubuntu-20.04 - clang
os: ubuntu-20.04
cc_compiler: clang
cxx_compiler: clang++
- name: ubuntu-22.04 - clang
os: ubuntu-22.04
cc_compiler: clang
cxx_compiler: clang++
- name: ubuntu-20.04 - gcc
os: ubuntu-20.04
cc_compiler: gcc
cxx_compiler: g++
- name: ubuntu-22.04 - gcc
os: ubuntu-22.04
cc_compiler: gcc
cxx_compiler: g++
- name: windows-2019 - msvc
os: windows-2019
compiler: msvc
- name: windows-2022 - msvc
os: windows-2022
compiler: msvc
# As of IREE commit 44c93468, Windows only reliably supports MSVC and
# clang-cl. clang and gcc builds could be added with a few changes.
# - name: windows-2019 - clang
# os: windows-2019
# compiler: clang
# - name: windows-2022 - clang
# os: windows-2022
# compiler: clang
# - name: windows-2019 - gcc
# os: windows-2019
# compiler: gcc
# - name: windows-2022 - gcc
# os: windows-2022
# compiler: gcc
defaults:
run:
shell: bash
steps:
###########################################################################
# OS specific setup
###########################################################################
- name: Install dependencies (Linux)
if: contains(matrix.os, 'ubuntu')
run: |
sudo apt update
sudo apt install cmake clang ninja-build
export CC=${{ matrix.cc_compiler }}
export CXX=${{ matrix.cxx_compiler }}
- name: Configure MSVC (Windows)
if: contains(matrix.os, 'windows') && contains(matrix.compiler, 'msvc')
uses: ilammy/[email protected]
- name: Configure clang (Windows)
if: contains(matrix.os, 'windows') && contains(matrix.compiler, 'clang')
run: |
choco install ninja --yes
echo "CC='C:\Program Files\LLVM\bin\clang.exe'" >> $GITHUB_ENV
echo "CXX='C:\Program Files\LLVM\bin\clang++.exe'" >> $GITHUB_ENV
- name: Configure GCC (Windows)
if: contains(matrix.os, 'windows') && contains(matrix.compiler, 'gcc')
uses: egor-tensin/setup-mingw@v2
with:
version: 12.2.0
###########################################################################
# General setup
###########################################################################
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install IREE compiler
run: |
python -m pip install iree-compiler
- name: Checkout repository
uses: actions/checkout@v2
- name: Initialize submodules
run : |
git \
-c submodule."third_party/llvm-project".update=none \
-c submodule."third_party/stablehlo".update=none \
-c submodule."third_party/torch-mlir".update=none \
submodule update --init --recursive
###########################################################################
# Build and test
###########################################################################
- name: Build sample
run: |
cmake -B build/ -G Ninja
cmake --build build/ --target hello_world
- name: Compile sample module
run: |
iree-compile \
--iree-hal-target-backends=llvm-cpu \
simple_mul.mlir \
-o build/simple_mul.vmfb
- name: Test execution
run: |
./build/hello_world local-sync build/simple_mul.vmfb