Skip to content

2025-03-07

2025-03-07 #19

Workflow file for this run

name: Build MLIR and Upload to Release
on:
release:
types: [published]
workflow_dispatch:
pull_request:
jobs:
build-mlir:
name: Build MLIR from Source
runs-on: ubuntu-latest
container:
image: quay.io/condaforge/linux-anvil-x86_64:alma9
defaults:
run:
shell: bash -el {0}
steps:
- name: Activate conda explicitly
run: |
echo "/opt/conda/bin" >> $GITHUB_PATH
echo "CONDA_PREFIX=/opt/conda" >> $GITHUB_ENV
echo "source /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc
- name: Clone LLVM and MLIR repository
run: |
git clone https://github.com/llvm/llvm-project.git
cd llvm-project
git checkout d401987fe349a87c53fe25829215b080b70c0c1a
cd ..
- name: Install dependencies
run: |
conda install -y cmake ninja clangxx
- name: Build MLIR
run: |
mkdir build
cd build
cmake -G Ninja \
-DLLVM_ENABLE_PROJECTS="mlir" \
-DLLVM_TARGETS_TO_BUILD="X86" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \
-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON \
-DCMAKE_INSTALL_RPATH="/opt/conda/lib" \
../llvm-project/llvm
ninja
- name: Archive build results
run: |
tar -czvf mlir.tar.gz build/
if: success()
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: mlir
path: mlir.tar.gz
upload-to-release:
name: Upload to GitHub Release
needs: build-mlir
runs-on: ubuntu-latest
if: github.event_name == 'release'
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: mlir
- name: Upload MLIR build to GitHub Release
uses: softprops/action-gh-release@v1
with:
files: mlir.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}