Skip to content

Commit e8558b9

Browse files
committed
test win ci
1 parent 1794efc commit e8558b9

1 file changed

Lines changed: 106 additions & 0 deletions

File tree

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: Build on Windows
2+
3+
on:
4+
push:
5+
branches: [ "feat/win-compilation-test" ]
6+
paths-ignore:
7+
- '**.md'
8+
merge_group:
9+
pull_request:
10+
branches: [ "main" ]
11+
paths-ignore:
12+
- '**.md'
13+
workflow_dispatch:
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || '' }}-${{ github.base_ref || '' }}-${{ github.ref != 'refs/heads/main' || github.sha }}
17+
cancel-in-progress: true
18+
19+
permissions:
20+
contents: read
21+
22+
jobs:
23+
24+
# Windows build and test matrix
25+
build-and-test-windows:
26+
name: Build & Test (${{ matrix.platform }})
27+
runs-on: ${{ matrix.os }}
28+
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
include:
33+
- os: windows-2022
34+
platform: windows-2022-x64
35+
- os: windows-2025
36+
platform: windows-2025-x64
37+
38+
steps:
39+
- name: Checkout code
40+
uses: actions/checkout@v6
41+
with:
42+
submodules: recursive
43+
44+
- name: Set up Python
45+
uses: actions/setup-python@v6
46+
with:
47+
python-version: '3.10'
48+
cache: 'pip'
49+
cache-dependency-path: 'pyproject.toml'
50+
51+
- name: Set up MSVC environment
52+
uses: ilammy/msvc-dev-cmd@v1
53+
with:
54+
arch: x64
55+
56+
- name: Set up environment variables
57+
run: |
58+
$nproc = (Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors
59+
echo "NPROC=$nproc" >> $env:GITHUB_ENV
60+
echo "Using $nproc parallel jobs for builds"
61+
shell: pwsh
62+
63+
- name: Install dependencies
64+
run: |
65+
python -m pip install --upgrade pip `
66+
pybind11==3.0 `
67+
cmake==3.30.0 `
68+
ninja==1.11.1 `
69+
pytest `
70+
scikit-build-core `
71+
setuptools_scm
72+
shell: pwsh
73+
74+
- name: Build from source
75+
run: |
76+
cd "$env:GITHUB_WORKSPACE"
77+
$env:CMAKE_GENERATOR = "Ninja"
78+
$env:CMAKE_BUILD_PARALLEL_LEVEL = "$env:NPROC"
79+
python -m pip install -v . `
80+
--no-build-isolation `
81+
--config-settings='cmake.define.BUILD_TOOLS=ON'
82+
shell: pwsh
83+
84+
- name: Run C++ Tests
85+
run: |
86+
cd "$env:GITHUB_WORKSPACE\build"
87+
cmake --build . --target unittest --config Release --parallel $env:NPROC
88+
shell: pwsh
89+
90+
- name: Run Python Tests
91+
run: |
92+
cd "$env:GITHUB_WORKSPACE"
93+
python -m pytest python/tests/
94+
shell: pwsh
95+
96+
- name: Run C++ Examples
97+
run: |
98+
cd "$env:GITHUB_WORKSPACE\examples\c++"
99+
mkdir build
100+
cd build
101+
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release
102+
cmake --build . --config Release --parallel $env:NPROC
103+
.\db-example.exe
104+
.\core-example.exe
105+
.\ailego-example.exe
106+
shell: pwsh

0 commit comments

Comments
 (0)