[nfc] add badge on README and format yaml #102
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: 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 | |
- 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: Verify Installation | |
run: | | |
${{ steps.msys2.outputs.msys2-location }}/msys2 --version | |
dir ${{ steps.msys2.outputs.msys2-location }}/mingw64/lib/cmake/llvm/ | |
pacman -Ql mingw-w64-x86_64-gmp | |
pacman -Ql mingw-w64-x86_64-llvm | |
pacman -Ql mingw-w64-x86_64-llvm-libs | |
pacman -Ql mingw-w64-x86_64-clang | |
pacman -Ql mingw-w64-x86_64-clang-libs | |
pacman -Ql mingw-w64-x86_64-clang-tools-extra | |
- name: install DIA SDK | |
shell: bash | |
run: | | |
set -x | |
mkdir -p ${{ runner.temp }}/workspace | |
mkdir -p "C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional" || true | |
cp -rv "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/DIA SDK" "C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/DIA SDK" | |
- 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 -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' | |
${{ steps.msys2.outputs.msys2-location }}/msys2 -c 'knight --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.exe" run test/testcase/' |