From 2b69d461059e7dcb93a833796e0d49993ce8d48f Mon Sep 17 00:00:00 2001 From: Victor Guerra Date: Mon, 25 Sep 2023 21:49:14 +0200 Subject: [PATCH] Adding CI for cmake build. --- .github/workflows/build_and_test.yml | 2 +- .github/workflows/build_and_test_cmake.yml | 47 ++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build_and_test_cmake.yml diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index d749cb9..5f32cbb 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -1,4 +1,4 @@ -name: Build and Test +name: Build and Test w/Bazel permissions: read-all on: push: diff --git a/.github/workflows/build_and_test_cmake.yml b/.github/workflows/build_and_test_cmake.yml new file mode 100644 index 0000000..8e0cf61 --- /dev/null +++ b/.github/workflows/build_and_test_cmake.yml @@ -0,0 +1,47 @@ +name: Build and Test w/CMake +permissions: read-all +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: seanmiddleditch/gha-setup-ninja@master + + - name: Install prerequisites + run: | + sudo apt update + sudo apt install -y uuid-dev + + - name: Cache LLVM artifact + id: cache-llvm + uses: actions/cache@v3 + with: + path: | + ./externals/llvm-project + key: ${{ runner.os }}-norm-${{ hashFiles('externals/llvm-project/llvm/CMakeLists.txt') }} + + - name: Build LLVM + if: steps.cache-llvm.outputs.cache-hit != 'true' + run: | + git submodule update --init --recursive + cd externals/llvm-project + mkdir build && cd build + cmake -G Ninja ../llvm -DLLVM_ENABLE_PROJECTS=mlir -DLLVM_BUILD_EXAMPLES=ON -DLLVM_ENABLE_ASSERTIONS=ON -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_RTTI=ON -DLLVM_TARGETS_TO_BUILD="host" + cmake --build . --target check-mlir + + - name: Build and test mlir-tutorial + run: | + mkdir build && cd build + cmake -DLLVM_DIR=$PWD/../externals/llvm-project/build/lib/cmake/llvm -DMLIR_DIR=$PWD/../externals/llvm-project/build/lib/cmake/mlir .. + cmake --build . --target MLIRAffineFullUnrollPasses + cmake --build . --target MLIRMulToAddPasses + cmake --build . --target mlir-headers + cmake --build . --target tutorial-opt + cmake --build . --target check-mlir-tutorial \ No newline at end of file