Skip to content

Commit a10c16c

Browse files
update workflow
1 parent 7dc395c commit a10c16c

File tree

1 file changed

+83
-78
lines changed

1 file changed

+83
-78
lines changed

.github/workflows/cmake.yaml

Lines changed: 83 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -6,104 +6,109 @@ on:
66
pull_request:
77
branches: [ main ]
88

9-
# ──────────────── GLOBAL MATRIX ────────────────
10-
# ▸ host‑os : linux / windows
11-
# ▸ target : native / android
129
jobs:
1310
build:
1411
name: ${{ matrix.os }}‑${{ matrix.target }}
1512
runs-on: ${{ matrix.os }}
1613
strategy:
1714
matrix:
1815
include:
19-
# native builds
20-
- os: ubuntu-latest # linux‑native
16+
- os: ubuntu-latest
2117
target: native
22-
- os: windows-latest # windows‑native
18+
- os: windows-latest
2319
target: native
24-
25-
# android build (hosted on ubuntu)
2620
- os: ubuntu-latest
2721
target: android
2822

2923
steps:
30-
# ───────── checkout ─────────
31-
- uses: actions/checkout@v4
24+
- name: Checkout code
25+
uses: actions/checkout@v4
26+
27+
# Vulkan SDK (for all targets)
28+
- name: Install Vulkan SDK
29+
uses: jakoch/install-vulkan-sdk-action@v1
30+
with:
31+
vulkan_version: 1.3.280.0
32+
cache: true
33+
install_lavapipe: true
34+
35+
# Host-specific dependencies
36+
- name: Setup deps (Linux native & Android)
37+
if: matrix.os == 'ubuntu-latest'
38+
run: |
39+
sudo apt-get update
40+
sudo apt-get install -y clang ninja-build libomp-dev libpng-dev libx11-dev
3241
33-
# ───────── install Vulkan SDK (all targets) ─────────
34-
- name: Install Vulkan SDK
35-
uses: jakoch/install-vulkan-sdk-action@v1
36-
with:
37-
vulkan_version: 1.3.280.0
38-
cache: true
39-
install_lavapipe: true
42+
- name: Setup deps (Windows native)
43+
if: matrix.os == 'windows-latest'
44+
run: |
45+
choco install llvm ninja cmake -y
46+
echo "VULKAN_SDK=$Env:VULKAN_SDK" >> $env:GITHUB_ENV
47+
echo "PATH=$Env:VULKAN_SDK\\Bin;$Env:PATH" >> $env:GITHUB_ENV
4048
41-
# ───────── host‑OS‑specific dependencies ─────────
42-
- name: Setup deps (Linux native & Android)
43-
if: matrix.os == 'ubuntu-latest'
44-
run: |
45-
sudo apt-get update
46-
sudo apt-get install -y clang ninja-build libomp-dev libpng-dev libx11-dev
49+
# Android NDK Setup
50+
- name: Set up Android NDK
51+
if: matrix.target == 'android'
52+
uses: nhiroki/setup-android@v4
53+
with:
54+
ndk-version: 26.2.11394342
55+
accept-licenses: true
4756

48-
- name: Setup deps (Windows native)
49-
if: matrix.os == 'windows-latest'
50-
run: |
51-
choco install llvm ninja cmake -y
52-
echo "VULKAN_SDK=$Env:VULKAN_SDK" >> $env:GITHUB_ENV
53-
echo "PATH=$Env:VULKAN_SDK\Bin;$Env:PATH" >> $env:GITHUB_ENV
57+
# Cache build directory
58+
- uses: actions/cache@v4
59+
with:
60+
path: build
61+
key: build-${{ runner.os }}-${{ matrix.target }}-${{ hashFiles('**/CMakeLists.txt', '**/*.cpp', '**/*.h') }}
62+
restore-keys: |
63+
build-${{ runner.os }}-${{ matrix.target }}-
5464
55-
# ───────── Android toolchain (only target=android) ─────────
56-
- name: Set up Android NDK
57-
if: matrix.target == 'android'
58-
uses: nhiroki/setup-android@v3
59-
with:
60-
ndk-version: 26.2.11394342 # newest stable
61-
accept-licenses: true
65+
# Configure CMake
66+
- name: Configure (Linux native)
67+
if: matrix.target == 'native' && matrix.os == 'ubuntu-latest'
68+
run: |
69+
cmake -S . -B build -G Ninja \
70+
-DCMAKE_BUILD_TYPE=Release \
71+
-DCMAKE_C_COMPILER=clang \
72+
-DCMAKE_CXX_COMPILER=clang++ \
73+
-DVULKAN_SDK="$VULKAN_SDK"
6274
63-
# ───────── cache CMake build dir per‑host‑target ─────────
64-
- uses: actions/cache@v4
65-
with:
66-
path: build
67-
key: build-${{ runner.os }}-${{ matrix.target }}-${{ hashFiles('**/CMakeLists.txt', '**/*.cpp', '**/*.h') }}
68-
restore-keys: build-${{ runner.os }}-${{ matrix.target }}-
75+
- name: Configure (Windows native)
76+
if: matrix.target == 'native' && matrix.os == 'windows-latest'
77+
shell: pwsh
78+
run: |
79+
cmake -S . -B build -G Ninja `
80+
-DCMAKE_BUILD_TYPE=Release `
81+
-DCMAKE_C_COMPILER="clang.exe" `
82+
-DCMAKE_CXX_COMPILER="clang++.exe" `
83+
-DVULKAN_SDK="$Env:VULKAN_SDK"
6984
70-
# ───────── configure phase ─────────
71-
- name: Configure (Linux native)
72-
if: matrix.target == 'native' && matrix.os == 'ubuntu-latest'
73-
run: |
74-
cmake -S . -B build -G Ninja \
75-
-DCMAKE_BUILD_TYPE=Release \
76-
-DCMAKE_C_COMPILER=clang \
77-
-DCMAKE_CXX_COMPILER=clang++ \
78-
-DVULKAN_SDK="$VULKAN_SDK"
85+
- name: Configure (Android arm64‑v8a)
86+
if: matrix.target == 'android'
87+
env:
88+
ANDROID_NDK: ${{ env.ANDROID_NDK_HOME }}
89+
run: |
90+
cmake -S . -B build -G Ninja \
91+
-DCMAKE_BUILD_TYPE=Release \
92+
-DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK/build/cmake/android.toolchain.cmake" \
93+
-DANDROID_ABI=arm64-v8a \
94+
-DANDROID_PLATFORM=android-24 \
95+
-DVULKAN_SDK="$VULKAN_SDK"
7996
80-
- name: Configure (Windows native)
81-
if: matrix.target == 'native' && matrix.os == 'windows-latest'
82-
shell: pwsh
83-
run: |
84-
cmake -S . -B build -G Ninja `
85-
-DCMAKE_BUILD_TYPE=Release `
86-
-DCMAKE_C_COMPILER="clang.exe" `
87-
-DCMAKE_CXX_COMPILER="clang++.exe" `
88-
-DVULKAN_SDK="$Env:VULKAN_SDK"
97+
# Build
98+
- name: Build
99+
run: cmake --build build --config Release
89100

90-
- name: Configure (Android arm64‑v8a)
91-
if: matrix.target == 'android'
92-
env:
93-
ANDROID_NDK: ${{ env.ANDROID_NDK_HOME }}
94-
run: |
95-
cmake -S . -B build -G Ninja \
96-
-DCMAKE_BUILD_TYPE=Release \
97-
-DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK/build/cmake/android.toolchain.cmake" \
98-
-DANDROID_ABI=arm64-v8a \
99-
-DANDROID_PLATFORM=android-24 \
100-
-DVULKAN_SDK="$VULKAN_SDK"
101+
# Test only for native
102+
- name: Run tests (Linux native)
103+
if: matrix.target == 'native' && matrix.os == 'ubuntu-latest'
104+
working-directory: build
105+
run: ctest --output-on-failure
101106

102-
# ───────── build & test ─────────
103-
- name: Build
104-
run: cmake --build build --config Release
107+
- name: Run tests (Windows native)
108+
if: matrix.target == 'native' && matrix.os == 'windows-latest'
109+
working-directory: build
110+
run: ctest -C Release --output-on-failure
105111

106-
- name: Run tests (native targets only)
107-
if: matrix.target == 'native'
108-
working-directory: build
109-
run: ctest --output-on-failure
112+
- name: Skip tests (Android target)
113+
if: matrix.target == 'android'
114+
run: echo "Skipping tests for Android target."

0 commit comments

Comments
 (0)