circt/.github/workflows/buildAndTestWindows.yml

85 lines
2.7 KiB
YAML

name: Windows build and test
# Run on request and every day at 12 noon UTC
on:
push:
branches:
- main
workflow_dispatch:
jobs:
# Build CIRCT and run its tests.
build-circt:
name: Build and Test
runs-on: windows-2019
steps:
- name: Configure Environment
run: echo "$GITHUB_WORKSPACE/llvm/install/bin" >> $GITHUB_PATH
# Clone the CIRCT repo and its submodules. Do shallow clone to save clone
# time.
- name: Get CIRCT
uses: actions/checkout@v2
with:
fetch-depth: 2
submodules: "true"
# --------
# Restore LLVM from cache and build if it's not in there.
# --------
# Extract the LLVM submodule hash for use in the cache key.
- name: Get LLVM Hash
id: get-llvm-hash
run: echo "::set-output name=hash::$(git rev-parse @:./llvm)"
shell: bash
# Try to fetch LLVM from the cache.
- name: Cache LLVM
id: cache-llvm
uses: actions/cache@v2
with:
path: |
llvm/build
llvm/install
key: ${{ runner.os }}-llvm-relobj-${{ steps.get-llvm-hash.outputs.hash }}
# Build LLVM if we didn't hit in the cache. Even though we build it in
# the previous job, there is a low chance that it'll have been evicted by
# the time we get here.
- name: Rebuild and Install LLVM
if: steps.cache-llvm.outputs.cache-hit != 'true'
shell: pwsh
run: |
./utils/find-vs.ps1
mkdir llvm/build
cd llvm/build
cmake ..\llvm -GNinja `
-DLLVM_ENABLE_PROJECTS=mlir -DLLVM_BUILD_EXAMPLES=OFF `
-DLLVM_TARGETS_TO_BUILD="host" `
-DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON `
-DLLVM_INSTALL_UTILS=ON -DCMAKE_INSTALL_PREFIX="$(pwd)/../install"
cmake --build . --target install --config Release
# --------
# Build and test CIRCT in both debug and release mode.
# --------
# Build the CIRCT test target in release mode. The cmake scripts on
# Windows only support building with the same configuration as MLIR.
- name: Build and test CIRCT (release)
shell: pwsh
run: |
./utils/find-vs.ps1
mkdir build_release
cd build_release
cmake ../ -GNinja `
-DLLVM_ENABLE_ASSERTIONS=ON `
-DMLIR_DIR="$(pwd)/../llvm/build/lib/cmake/mlir/" `
-DLLVM_DIR="$(pwd)/../llvm/build/lib/cmake/llvm/" `
-DLLVM_EXTERNAL_LIT="$(pwd)/../llvm/build/Release/bin/llvm-lit.py" `
-DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release
# --- end of build-circt job.