-
Notifications
You must be signed in to change notification settings - Fork 3
67 lines (63 loc) · 2.91 KB
/
build-and-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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)