Skip to content

[fix] add cg link common library and fix win ci #122

[fix] add cg link common library and fix win ci

[fix] add cg link common library and fix win ci #122

Workflow file for this run

name: Build on Windows
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
build-win:
runs-on: windows-2022
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Install Choco Tools
run: |
choco install 7zip.install wget -y
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install MSYS2
uses: msys2/setup-msys2@v2
id: msys2
with:
update: true
install: >
mingw-w64-x86_64-toolchain
mingw-w64-x86_64-cmake
mingw-w64-x86_64-gmp
mingw-w64-x86_64-llvm
mingw-w64-x86_64-llvm-libs
mingw-w64-x86_64-clang
mingw-w64-x86_64-clang-libs
mingw-w64-x86_64-clang-tools-extra
mingw-w64-x86_64-lld
mingw-w64-x86_64-ncurses
mingw-w64-x86_64-sqlite3
mingw-w64-x86_64-gtest
- name: Verify MSYS2
run: |
dir ${{ steps.msys2.outputs.msys2-location }}
dir ${{ steps.msys2.outputs.msys2-location }}/usr
dir ${{ steps.msys2.outputs.msys2-location }}/usr/include
dir ${{ steps.msys2.outputs.msys2-location }}/usr/bin
dir ${{ steps.msys2.outputs.msys2-location }}/mingw64
dir ${{ steps.msys2.outputs.msys2-location }}/mingw64/include
dir ${{ steps.msys2.outputs.msys2-location }}/mingw64/lib
dir ${{ steps.msys2.outputs.msys2-location }}/mingw64/bin
echo '${{ steps.msys2.outputs.msys2-location }}' | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo '${{ steps.msys2.outputs.msys2-location }}/mingw64' | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo '${{ steps.msys2.outputs.msys2-location }}/mingw64/bin' | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo '${{ steps.msys2.outputs.msys2-location }}/usr/bin' | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
which cmake
which gcc
which g++
which clang
which clang++
- name: Install Google Test
run: |
pacman -S mingw-w64-x86_64-gtest --noconfirm
ls ${{ steps.msys2.outputs.msys2-location }}/mingw64/lib/cmake/GTest
- name: Configure CMake
run: |
cmake -G "MSYS Makefiles" -DLINK_CLANG_DYLIB=on -DLINK_LLVM_DYLIB=on -DCMAKE_BUILD_TYPE:STRING=Release -DGMP_ROOT:STRING=${{ steps.msys2.outputs.msys2-location }}/mingw64 -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DLLVM_BUILD_DIR=${{ steps.msys2.outputs.msys2-location }}/mingw64 -DGTest_DIR=${{ steps.msys2.outputs.msys2-location }}/mingw64/lib/cmake/GTest -B build
- name: Build Knight
run: |
cmake --build build -j16
- name: Add Knight Binary to PATH
run: |
echo "$(pwd)/build/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Test Binary
shell: cmd
run: |
${{ steps.msys2.outputs.msys2-location }}/msys2 -c 'which knight-analyzer'
${{ steps.msys2.outputs.msys2-location }}/msys2 -c 'knight-analyzer --version'
- name: Unit Tests
shell: cmd
run: |
${{ steps.msys2.outputs.msys2-location }}/msys2 -c 'python3 scripts/unittest -v p test/testcase/'
${{ steps.msys2.outputs.msys2-location }}/msys2 -c 'python3 scripts/unittest -v -a "knight-analyzer.exe" run test/testcase/'