@@ -17,19 +17,24 @@ jobs:
1717 - os : macos
1818 arch : x86_64
1919 runner : macos-latest
20+ toolchain : default
2021 - os : macos
2122 arch : arm64
2223 runner : macos-latest
24+ toolchain : arm64
2325 - os : ubuntu
2426 arch : x86_64
2527 runner : ubuntu-latest
28+ toolchain : default
2629 - os : ubuntu
2730 arch : arm64
28- runner : ubuntu-latest
29- # disable now
30- # - os: windows
31- # arch: x86_64
32- # runner: windows-latest
31+ runner : ubuntu-22.04-arm
32+ toolchain : default
33+ # Windows 支持可按需取消注释
34+ # - os: windows
35+ # arch: x86_64
36+ # runner: windows-latest
37+ # toolchain: msvc
3338
3439 steps :
3540 - name : Checkout code
3944 if : matrix.os == 'ubuntu'
4045 run : |
4146 sudo apt-get update
42- sudo apt-get install -y cmake g++ gcc python3 python3-pip python3-venv
47+ sudo apt-get install -y cmake build-essential python3 python3-pip python3-venv
4348
4449 - name : Set up dependencies (macOS)
4550 if : matrix.os == 'macos'
@@ -59,50 +64,31 @@ jobs:
5964 cmake ..
6065 cmake --build . --config Release
6166
62- - name : Build (arm64, cross-compile)
63- if : matrix.arch == 'arm64' && matrix.os == 'ubuntu'
67+ - name : Configure and Build
6468 run : |
65- mkdir build
66- cd build
67- cmake ..
68- cmake --build . --config Release
69+ mkdir build && cd build
70+ if [[ "${{ matrix.os }}" == "macos" && "${{ matrix.arch }}" == "arm64" ]]; then
71+ cmake .. -DCMAKE_OSX_ARCHITECTURES=arm64
72+ else
73+ cmake ..
74+ fi
75+ cmake --build . --config Release --parallel $(nproc || sysctl -n hw.ncpu || echo 2)
6976
70- - name : Build (arm64, macOS)
71- if : matrix.arch == 'arm64' && matrix.os == 'macos'
77+ - name : Run C++ tests
7278 run : |
73- mkdir build
7479 cd build
75- cmake .. -DCMAKE_OSX_ARCHITECTURES=arm64
76- cmake --build . --config Release
80+ ctest --output-on-failure -C Release
7781
7882 - name : Run main test
79- # if: matrix.arch != 'arm64' || matrix.os != 'ubuntu'
8083 run : |
8184 bash test.sh
8285
83- # Python 绑定测试
84- - name : Set up Python venv
86+ - name : Set up Python
8587 run : |
86- python3 -m venv venv
87- source venv/bin/activate || source venv/Scripts/activate
8888 python -m pip install --upgrade pip setuptools wheel numpy pybind11
8989
90- - name : Build and install Python bindings
90+ - name : Build and test Python bindings
9191 run : |
92- source venv/bin/activate || source venv/Scripts/activate
9392 cd python_bindings
9493 pip install .
95-
96- - name : Run Python binding tests
97- run : |
98- source venv/bin/activate || source venv/Scripts/activate
99- cd python_bindings
100- # 假设有 tests 目录,且用 pytest
101- # pip install pytest
102- # pytest tests
103-
104- # 你可以在这里添加 C++ 测试步骤
105- # - name: Run C++ tests
106- # run: |
107- # cd build
108- # ctest --output-on-failure
94+ # pytest tests/
0 commit comments