Add compile.sh to CI (#939) #2260
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: Cross-compile IMEX on CPUs | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
permissions: read-all | |
jobs: | |
build_linux: | |
name: Builds IMEX on Linux | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash -l -eo pipefail {0} | |
strategy: | |
matrix: | |
python: [3.9] | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- name: Setup conda | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
auto-update-conda: true | |
python-version: ${{ matrix.python }} | |
activate-environment: imex-devel | |
- name: Conda info | |
run: conda info | |
- name: Install Build tools | |
run: | | |
conda install cmake ninja conda-forge::lit conda-forge::doxygen | |
conda list | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Setup Cache Vars | |
run: | | |
echo LLVM_SHA=$(cat build_tools/llvm_version.txt) | tee -a $GITHUB_ENV | |
- name: Cache LLLVM-MLIR | |
id: cache-llvm-mlir | |
uses: actions/cache@v4 | |
env: | |
LLVM_CACHE_NUMBER: 2 # Increase to reset cache | |
with: | |
path: | | |
${{ github.workspace }}/mlir | |
key: ${{ runner.os }}-build-llvm-${{ env.LLVM_CACHE_NUMBER }}-${{ env.LLVM_SHA }} | |
- name: Build LLVM-MLIR | |
if: steps.cache-llvm-mlir.outputs.cache-hit != 'true' | |
run: | | |
git clone https://github.com/llvm/llvm-project --branch main --single-branch | |
cd llvm-project | |
git checkout $LLVM_SHA | |
git apply ../build_tools/patches/*.patch | |
echo "INFO: Need to rebuild LLVM-MLIR. Previous installation for MLIR not found" | |
cmake -G Ninja -B build -S llvm \ | |
-DCMAKE_BUILD_TYPE=MinSizeRel \ | |
-DLLVM_ENABLE_PROJECTS=mlir \ | |
-DLLVM_ENABLE_ASSERTIONS=ON \ | |
-DLLVM_USE_LINKER=gold \ | |
-DLLVM_INSTALL_UTILS=ON \ | |
-DLLVM_TARGETS_TO_BUILD=X86 \ | |
-DLLVM_ENABLE_BINDINGS=OFF \ | |
-DLLVM_ENABLE_ZSTD=OFF \ | |
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/mlir | |
cmake --build build --target install | |
- name: Build IMEX and run lit tests | |
shell: bash -le {0} | |
run: | | |
./scripts/compile.sh -DLLVM_LIT_ARGS="-a" -DLLVM_EXTERNAL_LIT=$(which lit) -DMLIR_DIR=${{ github.workspace }}/mlir/lib/cmake/mlir | |
cmake --build build --target check-imex | |
- name: Build doxygen docs | |
shell: bash -le {0} | |
run: | | |
cmake --build build --target doc_doxygen |