Haskell CI #7467
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Haskell CI | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
types: [ opened, synchronize ] | |
schedule: | |
# Always regenerate once every 4 hour | |
- cron: '15 */4 * * *' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Setup Haskell Stack | |
id: setup-haskell | |
uses: haskell-actions/setup@f7d8a55550ba6c8e4fdba2f1e56e14f595218dd9 # v2.5.1 | |
with: | |
enable-stack: true | |
stack-no-global: true | |
stack-version: 'latest' | |
- name: Cache .stack-work | |
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2 | |
with: | |
path: .stack-work | |
key: stack-work-${{ runner.os }}-${{ hashFiles('stack.yaml', '**/*.cabal') }}-${{ hashFiles('src/*', 'tblgen/*', 'test/*') }} | |
restore-keys: | | |
stack-work-${{ runner.os }}-${{ hashFiles('stack.yaml', '**/*.cabal') }}- | |
stack-work-${{ runner.os }}- | |
- name: Cache ~/.stack | |
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2 | |
with: | |
path: ${{ steps.setup-haskell.outputs.stack-root }} | |
key: stack-root-${{ runner.os }}-${{ hashFiles('stack.yaml', '**/*.cabal') }} | |
restore-keys: stack-root-${{ runner.os }}- | |
- name: Install zstd | |
run: sudo apt install libzstd-dev | |
- name: Install Ninja | |
uses: llvm/actions/install-ninja@55d844821959226fab4911f96f37071c1d4c3268 | |
- name: Clone LLVM repo | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
repository: llvm/llvm-project | |
ref: 'main' | |
path: 'llvm-project' | |
- name: Ccache for C++ compilation | |
uses: hendrikmuhs/ccache-action@6d1841ec156c39a52b1b23a810da917ab98da1f4 # v1.2.10 | |
- name: Install dependencies (LLVM & MLIR) | |
run: | | |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" | |
cmake -B llvm-project/build -DLLVM_CCACHE_BUILD=ON \ | |
-DLLVM_BUILD_LLVM_DYLIB=ON -DMLIR_BUILD_MLIR_C_DYLIB=ON -DCMAKE_BUILD_TYPE=Release \ | |
-DLLVM_ENABLE_PROJECTS=mlir -DLLVM_TARGETS_TO_BUILD="host" \ | |
-DCMAKE_INSTALL_PREFIX=$HOME/mlir_shared llvm-project/llvm | |
cmake --build llvm-project/build -t install | |
echo "$HOME/mlir_shared/bin" >> $GITHUB_PATH | |
env: | |
CC: clang | |
CXX: clang++ | |
CMAKE_GENERATOR: Ninja | |
- name: Install dependencies (Haskell) | |
run: | | |
stack build --only-dependencies --test --no-run-tests | |
- name: Build mlir-hs | |
run: | | |
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/mlir_shared/lib | |
stack build --ghc-options "-Wall -Werror -fforce-recomp" --test --no-run-tests | |
- name: Run mlir-hs tests | |
run: | | |
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/mlir_shared/lib | |
stack test --ghc-options "-Wall -Werror -fforce-recomp" |