ci: build and test on Windows for every pull request
Server 端此前没有 CI。tests/ 下已有几十个测试文件并通过 add_test 注册,但从来没有在 PR 上跑过,回归只能靠人工在本机复现。 workflow 不走 preset:preset 指定 Visual Studio 18 2026 生成器和 C:/Users/sonnycalcr 的 vcpkg 路径,在 runner 上都不成立。Boost 也不能来自 manifest——CMakeLists.txt 要求 Boost locale 和 json 且按静态链接,但 vcpkg.json 里没有声明它,README 让用 Scoop 单独安装。这里改用 classic 模式装静态 Boost,再通过 CMakeLists.txt 已经支持的 BOOST_ROOT 环境变量指过去,不改动 vcpkg.json。
This commit is contained in:
1 parent
b0156540c0
commit
60cbd2de1f
1 file changed
+42
Vendored
+42
@@ -0,0 +1,42 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
pull_request:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Windows x64
|
||||
runs-on: windows-2025
|
||||
steps:
|
||||
- name: Check out source
|
||||
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Install Boost
|
||||
shell: pwsh
|
||||
# CMakeLists.txt links Boost statically but does not declare it in
|
||||
# vcpkg.json, so it cannot come from the manifest. Install it in classic
|
||||
# mode from the vcpkg installation root and point BOOST_ROOT at it, which
|
||||
# is the override CMakeLists.txt already supports.
|
||||
run: |
|
||||
Push-Location $env:VCPKG_INSTALLATION_ROOT
|
||||
./vcpkg install boost-locale:x64-windows-static boost-json:x64-windows-static
|
||||
Pop-Location
|
||||
"BOOST_ROOT=$env:VCPKG_INSTALLATION_ROOT/installed/x64-windows-static" >> $env:GITHUB_ENV
|
||||
- name: Configure
|
||||
shell: pwsh
|
||||
run: >
|
||||
cmake -S . -B build -A x64
|
||||
-DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake"
|
||||
-DVCPKG_TARGET_TRIPLET=x64-windows
|
||||
- name: Build
|
||||
shell: pwsh
|
||||
run: cmake --build build --config Release --parallel
|
||||
- name: Test
|
||||
shell: pwsh
|
||||
run: ctest --test-dir build -C Release --output-on-failure --timeout 120
|
||||
Reference in new issue
Block a user