Skip to content

Commit 6983bd7

Browse files
authored
Create cmake-multi-platform.yml
1 parent d295dd7 commit 6983bd7

1 file changed

Lines changed: 58 additions & 0 deletions

File tree

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: CMake Build and Test (Multiplatform)
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build-and-test:
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
matrix:
16+
os: [ubuntu-latest, windows-latest, macos-latest]
17+
18+
steps:
19+
# 1. Checkout repository
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
23+
# 2. Install CMake and build tools
24+
- name: Setup build tools
25+
run: |
26+
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
27+
sudo apt-get update
28+
sudo apt-get install -y cmake build-essential
29+
elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then
30+
brew update
31+
brew install cmake
32+
else
33+
choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' -y
34+
fi
35+
shell: bash
36+
37+
# 3. Create build directory
38+
- name: Create build directory
39+
run: mkdir -p build
40+
41+
# 4. Configure with CMake
42+
- name: Configure CMake
43+
run: cmake -S . -B build
44+
45+
# 5. Build the project
46+
- name: Build with CMake
47+
run: cmake --build build --config Release -- -j$(nproc)
48+
shell: bash
49+
50+
# 6. Run unit tests
51+
- name: Run unit tests
52+
run: |
53+
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
54+
build\Release\leanui_test.exe
55+
else
56+
./build/leanui_test
57+
fi
58+
shell: bash

0 commit comments

Comments
 (0)