Skip to content

Update README.md

Update README.md #130

name: Build and test
on: [push, pull_request]
env:
LLVM_COMMIT: 9816d43cff5ad7abb94eab94dcd205285675972a
CMAKE_FLAGS: '-DCMAKE_LINKER=lld -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DMLIR_DIR=$GITHUB_WORKSPACE/llvm-project/prefix/lib/cmake/mlir/ -DLLVM_DIR=$GITHUB_WORKSPACE/llvm-project/prefix/lib/cmake/llvm/ -DLLVM_EXTERNAL_LIT=$GITHUB_WORKSPACE/llvm-project/build/bin/llvm-lit'
jobs:
lint:
name: Check formatting
runs-on: ubuntu-latest
steps:
- name: Get Project Code
uses: actions/checkout@v2
- name: clang-format
uses: DoozyX/[email protected]
with:
source: '.'
extensions: 'h,cpp'
clangFormatVersion: 9
build:
name: Build and test
runs-on: ubuntu-latest
steps:
- name: Get Project Code
uses: actions/checkout@v2
with:
path: 'mlir-standalone'
- name: Cache LLVM
id: cache-llvm
uses: actions/cache@v2
with:
path: llvm-project
key: ${{ runner.os }}-llvm-install-${{ env.LLVM_COMMIT }}
- 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_OPTIMIZED_TABLEGEN=ON -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: |
export PATH=$PATH:$GITHUB_WORKSPACE/llvm-project/prefix/bin
cd $GITHUB_WORKSPACE/mlir-standalone/
git submodule init && git submodule update
mkdir sanitizer-build && cd sanitizer-build
cmake $GITHUB_WORKSPACE/mlir-standalone -DCMAKE_BUILD_TYPE=Debug -DUSE_SANITIZER='Address;Undefined' ${{ env.CMAKE_FLAGS }}
cmake --build . --target check-quantum-opt -- -j$(nproc)
- name: Release build
run: |
export PATH=$PATH:$GITHUB_WORKSPACE/llvm-project/prefix/bin
cd $GITHUB_WORKSPACE/mlir-standalone/
git submodule init && git submodule update
mkdir build && cd sanitizer-build
cmake $GITHUB_WORKSPACE/mlir-standalone -DCMAKE_BUILD_TYPE=Release ${{ env.CMAKE_FLAGS }}
cmake --build . --target check-quantum-opt -- -j$(nproc)