-
Notifications
You must be signed in to change notification settings - Fork 21
95 lines (81 loc) · 2.71 KB
/
ci.yml
File metadata and controls
95 lines (81 loc) · 2.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
cancel-in-progress: true
jobs:
build:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: macOS (Clang)
os: macos-latest
cmake_args: ""
build_args: ""
- name: Linux (GCC)
os: ubuntu-latest
cmake_args: "-DGGML_METAL=OFF -DSAM3_METAL=OFF"
build_args: ""
- name: Windows (MSVC)
os: windows-latest
cmake_args: "-DGGML_METAL=OFF -DSAM3_METAL=OFF -A x64 -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows"
build_args: "--config Release"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Ninja (Linux)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y ninja-build
- name: Install Ninja (macOS)
if: runner.os == 'macOS'
run: brew install ninja
- name: Install SDL2 (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: vcpkg install sdl2:x64-windows
- name: ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: ci-${{ matrix.os }}
- name: Configure
run: >
cmake -B build
${{ runner.os != 'Windows' && '-G Ninja' || '' }}
${{ matrix.cmake_args }}
${{ runner.os != 'Windows' && '-DCMAKE_BUILD_TYPE=Release' || '' }}
-DCMAKE_C_COMPILER_LAUNCHER=ccache
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
- name: Build
run: cmake --build build ${{ matrix.build_args }} --parallel
- name: Verify build artifacts
shell: bash
run: |
if [ -f build/libsam3.a ]; then
echo "Found build/libsam3.a"
elif [ -f build/Release/sam3.lib ]; then
echo "Found build/Release/sam3.lib"
elif [ -f build/sam3.lib ]; then
echo "Found build/sam3.lib"
else
echo "ERROR: sam3 library not found"
exit 1
fi
if [ "$RUNNER_OS" = "Windows" ]; then
for exe in sam3_image.exe sam3_video.exe; do
if [ -f "build/examples/Release/$exe" ]; then
echo "Found build/examples/Release/$exe"
else
echo "ERROR: $exe not built (GUI examples were silently skipped — likely SDL2 not found)"
exit 1
fi
done
fi