2021-01-13 13:35:12 +08:00
|
|
|
name: Windows build and test
|
|
|
|
|
|
|
|
# Run on request and every day at 12 noon UTC
|
|
|
|
on:
|
2021-08-14 04:32:13 +08:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
2021-01-13 13:35:12 +08:00
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
# Build CIRCT and run its tests.
|
|
|
|
build-circt:
|
|
|
|
name: Build and Test
|
2022-02-25 05:08:30 +08:00
|
|
|
runs-on: windows-2019
|
2021-01-13 13:35:12 +08:00
|
|
|
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
|
2023-05-26 08:21:32 +08:00
|
|
|
uses: actions/checkout@v3
|
2021-01-13 13:35:12 +08:00
|
|
|
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
|
2023-05-26 08:15:13 +08:00
|
|
|
run: echo "hash=$(git rev-parse @:./llvm)" >> $GITHUB_OUTPUT
|
2021-01-13 13:35:12 +08:00
|
|
|
shell: bash
|
|
|
|
|
|
|
|
# Try to fetch LLVM from the cache.
|
|
|
|
- name: Cache LLVM
|
|
|
|
id: cache-llvm
|
2023-05-26 08:21:32 +08:00
|
|
|
uses: actions/cache@v3
|
2021-01-13 13:35:12 +08:00
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
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: |
|
2022-02-19 13:08:11 +08:00
|
|
|
./utils/find-vs.ps1
|
2021-01-13 13:35:12 +08:00
|
|
|
mkdir llvm/build
|
|
|
|
cd llvm/build
|
2022-02-19 13:08:11 +08:00
|
|
|
cmake ..\llvm -GNinja `
|
2021-01-13 13:35:12 +08:00
|
|
|
-DLLVM_ENABLE_PROJECTS=mlir -DLLVM_BUILD_EXAMPLES=OFF `
|
2022-02-19 13:08:11 +08:00
|
|
|
-DLLVM_TARGETS_TO_BUILD="host" `
|
2022-10-18 15:27:37 +08:00
|
|
|
-DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON `
|
2023-08-09 00:44:21 +08:00
|
|
|
-DLLVM_INSTALL_GTEST=ON -DLLVM_INSTALL_UTILS=ON `
|
|
|
|
-DCMAKE_INSTALL_PREFIX="$(pwd)/../install"
|
2022-10-18 15:27:37 +08:00
|
|
|
cmake --build . --target install --config Release
|
2023-06-22 05:44:01 +08:00
|
|
|
# Grab llvm-lit.py from build tree, we need it.
|
|
|
|
cp -v bin/llvm-lit.py ../install/bin/
|
|
|
|
# Nuke build tree to save disk space.
|
|
|
|
cd ..
|
|
|
|
rm -r -fo build
|
|
|
|
|
2021-01-13 13:35:12 +08:00
|
|
|
|
|
|
|
# --------
|
|
|
|
# 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: |
|
2022-02-19 13:08:11 +08:00
|
|
|
./utils/find-vs.ps1
|
2021-01-13 13:35:12 +08:00
|
|
|
mkdir build_release
|
|
|
|
cd build_release
|
2022-02-19 13:08:11 +08:00
|
|
|
cmake ../ -GNinja `
|
2021-01-13 13:35:12 +08:00
|
|
|
-DLLVM_ENABLE_ASSERTIONS=ON `
|
2022-08-27 02:37:57 +08:00
|
|
|
-DMLIR_DIR="$(pwd)/../llvm/install/lib/cmake/mlir/" `
|
|
|
|
-DLLVM_DIR="$(pwd)/../llvm/install/lib/cmake/llvm/" `
|
2023-06-22 05:44:01 +08:00
|
|
|
-DLLVM_EXTERNAL_LIT="$(pwd)/../llvm/install/bin/llvm-lit.py" `
|
2023-03-22 00:26:10 +08:00
|
|
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo `
|
2023-03-21 23:58:54 +08:00
|
|
|
-DLLVM_LIT_ARGS="-v"
|
2022-10-14 07:29:28 +08:00
|
|
|
cmake --build . --config RelWithDebInfo
|
2022-10-20 05:58:03 +08:00
|
|
|
cmake --build . --target check-circt
|
2021-01-13 13:35:12 +08:00
|
|
|
|
|
|
|
# --- end of build-circt job.
|