Skip to content

Update to LLVM commit c13b7485b87909fcf739f62cfa382b55407433c0 (#10) #48

Update to LLVM commit c13b7485b87909fcf739f62cfa382b55407433c0 (#10)

Update to LLVM commit c13b7485b87909fcf739f62cfa382b55407433c0 (#10) #48

name: Build and test
on: [push, pull_request, workflow_dispatch]
jobs:
lint:
name: Check formatting
runs-on: ubuntu-latest
steps:
- name: Get Template Code
uses: actions/checkout@v2
with:
path: 'mlir-standalone-template'
- name: Load .env file
uses: xom9ikk/dotenv@v2
with:
load-mode: strict
path: 'mlir-standalone-template/'
- name: Get Template Code
uses: actions/checkout@v2
- name: clang-format
uses: DoozyX/clang-format-lint-action@v0.6
with:
source: '.'
extensions: 'h,cpp'
clangFormatVersion: 9
build:
name: Build and test
runs-on: ubuntu-latest
steps:
- name: Get Template Code
uses: actions/checkout@v2
with:
path: 'mlir-standalone-template'
- name: Load .env file
uses: xom9ikk/dotenv@v2
with:
load-mode: strict
path: 'mlir-standalone-template/'
- name: Configure Environment
run: echo "$GITHUB_WORKSPACE/llvm-project/prefix/bin" >> "$GITHUB_PATH"
- name: Cache LLVM
id: cache-llvm
uses: actions/cache@v2
with:
path: llvm-project
key: ${{ runner.os }}-llvm-install-${{ env.LLVM_COMMIT }} # TODO: need to make sure LLVM_COMMIT is always a hash (not a branch name or tag name)
- name: Get LLVM
if: steps.cache-llvm.outputs.cache-hit != 'true'
uses: actions/checkout@v2
with:
repository: 'llvm/llvm-project'
ref: '${{ env.LLVM_COMMIT }}'
path: 'llvm-project'
- name: Install LLVM
if: steps.cache-llvm.outputs.cache-hit != 'true'
run: |
mkdir $GITHUB_WORKSPACE/llvm-project/build
mkdir $GITHUB_WORKSPACE/llvm-project/prefix
cd $GITHUB_WORKSPACE/llvm-project/build
cmake $GITHUB_WORKSPACE/llvm-project/llvm -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_BUILD_EXAMPLES=OFF -DLLVM_TARGETS_TO_BUILD="host" -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/llvm-project/prefix -DLLVM_ENABLE_PROJECTS='mlir' -DLLVM_ENABLE_OCAMLDOC=OFF -DLLVM_ENABLE_BINDINGS=OFF -DLLVM_INSTALL_UTILS=ON -DLLVM_ENABLE_LLD=ON
cmake --build . --target install -- -j$(nproc)
- name: Sanitizer build
run: |
mkdir $GITHUB_WORKSPACE/mlir-standalone-template/sanitizer-build
cd $GITHUB_WORKSPACE/mlir-standalone-template/sanitizer-build
cmake $GITHUB_WORKSPACE/mlir-standalone-template -DCMAKE_BUILD_TYPE=Debug -DUSE_SANITIZER='Address;Undefined' ${{ env.CMAKE_FLAGS }}
cmake --build . --target check-standalone -- -j$(nproc)
- name: Release build
run: |
mkdir $GITHUB_WORKSPACE/mlir-standalone-template/build
cd $GITHUB_WORKSPACE/mlir-standalone-template/build
cmake $GITHUB_WORKSPACE/mlir-standalone-template -DCMAKE_BUILD_TYPE=Release ${{ env.CMAKE_FLAGS }}
cmake --build . --target check-standalone -- -j$(nproc)