-
Notifications
You must be signed in to change notification settings - Fork 0
181 lines (149 loc) · 5.03 KB
/
ci.yml
File metadata and controls
181 lines (149 loc) · 5.03 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
jobs:
build-linux:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
compiler: [gcc, clang]
build_type: [Release, Debug]
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libcairo2-dev \
libjpeg-dev \
zlib1g-dev \
libzstd-dev
- name: Set up compiler
run: |
if [ "${{ matrix.compiler }}" = "clang" ]; then
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
else
echo "CC=gcc" >> $GITHUB_ENV
echo "CXX=g++" >> $GITHUB_ENV
fi
- name: Configure CMake
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DENABLE_NATIVE_ARCH=OFF \
-DENABLE_SANITIZERS=${{ matrix.build_type == 'Debug' && 'ON' || 'OFF' }}
- name: Build
run: cmake --build build -j$(nproc)
- name: Run tests
run: ctest --test-dir build --output-on-failure -j$(nproc)
build-macos:
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
build_type: [Release, Debug]
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
brew install cairo jpeg zstd pkg-config
- name: Configure CMake
run: |
export PKG_CONFIG_PATH="$(brew --prefix)/lib/pkgconfig:$PKG_CONFIG_PATH"
cmake -B build \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DENABLE_NATIVE_ARCH=OFF \
-DCMAKE_PREFIX_PATH="$(brew --prefix)"
- name: Build
run: cmake --build build -j$(sysctl -n hw.ncpu)
- name: Run tests
run: ctest --test-dir build --output-on-failure -j$(sysctl -n hw.ncpu)
build-windows:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
build_type: [Release, Debug]
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
steps:
- uses: actions/checkout@v4
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Install dependencies
shell: pwsh
run: |
# Retry logic for transient network failures
$maxRetries = 3
$retryCount = 0
$success = $false
while (-not $success -and $retryCount -lt $maxRetries) {
$retryCount++
Write-Host "Attempt $retryCount of $maxRetries"
vcpkg install cairo libjpeg-turbo zstd zlib pthreads --triplet x64-windows
if ($LASTEXITCODE -eq 0) {
$success = $true
} else {
Write-Host "vcpkg install failed, retrying in 30 seconds..."
Start-Sleep -Seconds 30
}
}
if (-not $success) {
Write-Host "vcpkg install failed after $maxRetries attempts"
exit 1
}
- name: Configure CMake
run: |
cmake -B build `
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} `
-DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" `
-DENABLE_NATIVE_ARCH=OFF
- name: Build
run: cmake --build build --config ${{ matrix.build_type }} -j $env:NUMBER_OF_PROCESSORS
- name: Run tests
run: ctest --test-dir build --output-on-failure -C ${{ matrix.build_type }}
build-macos-arm64:
runs-on: macos-14 # M1 runner
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: brew install cairo jpeg zstd pkg-config
- name: Configure CMake
run: |
export PKG_CONFIG_PATH="$(brew --prefix)/lib/pkgconfig:$PKG_CONFIG_PATH"
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DENABLE_NATIVE_ARCH=OFF \
-DCMAKE_PREFIX_PATH="$(brew --prefix)"
- name: Build
run: cmake --build build -j$(sysctl -n hw.ncpu)
- name: Run tests
run: ctest --test-dir build --output-on-failure
# Minimal build without optional dependencies
build-minimal:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install minimal dependencies
run: |
sudo apt-get update
sudo apt-get install -y zlib1g-dev libzstd-dev
- name: Configure CMake (minimal)
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DENABLE_NATIVE_ARCH=OFF \
-DWITH_CAIRO=OFF
- name: Build
run: cmake --build build -j$(nproc)
- name: Run tests
run: ctest --test-dir build --output-on-failure -j$(nproc)