torch-mlir/.github/workflows/buildAndTest.yml

83 lines
3.7 KiB
YAML
Raw Normal View History

name: Build and Test
on: [push, pull_request]
2020-08-07 14:51:05 +08:00
env:
LLVM: external/llvm-project
jobs:
build-llvm:
name: Build LLVM
runs-on: ubuntu-latest
steps:
- name: Configure Environment
run: echo "::add-path::$GITHUB_WORKSPACE/${LLVM}/install/bin"
- name: Get npcomp
uses: actions/checkout@v2
with:
submodules: 'true'
- name: Get LLVM Hash
id: get-llvm-hash
run: echo "::set-output name=hash::$(git submodule status)"
shell: bash
- name: Cache LLVM
id: cache-llvm
uses: actions/cache@v2
with:
2020-08-07 14:51:05 +08:00
path: ${{ env.LLVM }}
key: ${{ runner.os }}-llvm-install-${{ steps.get-llvm-hash.outputs.hash }}
- name: Rebuild and Install LLVM
if: steps.cache-llvm.outputs.cache-hit != 'true'
run: |
2020-08-07 14:51:05 +08:00
mkdir -p ${LLVM}/build
mkdir -p ${LLVM}/install
cd ${LLVM}/build
2020-08-07 14:51:05 +08:00
cmake ../llvm -DLLVM_BUILD_EXAMPLES=OFF -DLLVM_TARGETS_TO_BUILD="host" -DCMAKE_INSTALL_PREFIX=../install -DLLVM_ENABLE_PROJECTS='mlir' -DLLVM_OPTIMIZED_TABLEGEN=ON -DLLVM_ENABLE_OCAMLDOC=OFF -DLLVM_ENABLE_BINDINGS=OFF -DLLVM_INSTALL_UTILS=ON -DLLVM_BUILD_TOOLS=ON -DLLVM_INCLUDE_TESTS=ON -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DLLVM_ENABLE_LLD=ON -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_RTTI=ON
cmake --build . --target install -- -j$(nproc)
build:
name: Build and Test
needs: build-llvm
runs-on: ubuntu-latest
steps:
- name: Configure Environment
run: echo "::add-path::$GITHUB_WORKSPACE/${LLVM}/install/bin"
- name: Get npcomp
uses: actions/checkout@v2
with:
submodules: 'true'
- name: Get LLVM Hash
id: get-llvm-hash
run: echo "::set-output name=hash::$(git submodule status)"
shell: bash
- name: Cache LLVM
id: cache-llvm
uses: actions/cache@v2
with:
2020-08-07 14:51:05 +08:00
path: ${{ env.LLVM }}
key: ${{ runner.os }}-llvm-install-${{ steps.get-llvm-hash.outputs.hash }}
- name: Rebuild and Install LLVM
if: steps.cache-llvm.outputs.cache-hit != 'true'
run: |
mkdir ${LLVM}/build
mkdir ${LLVM}/install
cd ${LLVM}/build
2020-08-07 14:51:05 +08:00
cmake ../llvm -DLLVM_BUILD_EXAMPLES=OFF -DLLVM_TARGETS_TO_BUILD="host" -DCMAKE_INSTALL_PREFIX=../install -DLLVM_ENABLE_PROJECTS='mlir' -DLLVM_OPTIMIZED_TABLEGEN=ON -DLLVM_ENABLE_OCAMLDOC=OFF -DLLVM_ENABLE_BINDINGS=OFF -DLLVM_INSTALL_UTILS=ON -DLLVM_INCLUDE_TESTS=ON -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DLLVM_ENABLE_LLD=ON -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_RTTI=ON
cmake --build . --target install -- -j$(nproc)
2020-08-07 14:51:05 +08:00
- name: Install pytest
run: |
pip3 install pytest
- name: Install pybind11
run: |
sudo apt-get install python3-pybind11
- name: Build and Test npcomp (Assert)
run: |
mkdir build_assert
cd build_assert
cmake .. -DCMAKE_BUILD_TYPE=Debug -DLLVM_ENABLE_ASSERTIONS=ON -DMLIR_DIR=../${LLVM}/install/lib/cmake/mlir/ -DLLVM_DIR=../${LLVM}/install/lib/cmake/llvm/ -DCMAKE_LINKER=lld -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DPYTHON_EXECUTABLE=/usr/bin/python3 -DLLVM_EXTERNAL_LIT=`pwd`/../${LLVM}/build/bin/llvm-lit
make check-npcomp -j$(nproc)
- name: Build and Test npcomp (Release)
run: |
mkdir build_release
cd build_release
2020-08-07 14:51:05 +08:00
cmake .. -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=OFF -DMLIR_DIR=../${LLVM}/install/lib/cmake/mlir/ -DLLVM_DIR=../${LLVM}/install/lib/cmake/llvm/ -DCMAKE_LINKER=lld -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DPYTHON_EXECUTABLE=/usr/bin/python3 -DLLVM_EXTERNAL_LIT=`pwd`/../${LLVM}/build/bin/llvm-lit
make check-npcomp -j$(nproc)