-
Notifications
You must be signed in to change notification settings - Fork 8
281 lines (251 loc) · 9.48 KB
/
Copy pathbuild.yml
File metadata and controls
281 lines (251 loc) · 9.48 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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
name: Build
on:
workflow_dispatch:
inputs:
linux_runner:
description: Linux runner label
type: string
default: ubuntu-22.04
windows_runner:
description: Windows runner label
type: string
default: windows-latest
macos_arm_runner:
description: macOS arm64 runner label
type: string
default: macos-15
macos_intel_runner:
description: macOS x86_64 runner label
type: string
default: macos-15-intel
workflow_call:
inputs:
linux_runner:
type: string
default: ubuntu-22.04
windows_runner:
type: string
default: windows-latest
macos_arm_runner:
type: string
default: macos-15
macos_intel_runner:
type: string
default: macos-15-intel
env:
QT_VERSION_LINUX: "6.11.0"
CMAKE_C_COMPILER_LAUNCHER: ccache
CMAKE_CXX_COMPILER_LAUNCHER: ccache
CCACHE_DIR: ${{ github.workspace }}/.ccache
CCACHE_MAXSIZE: 800M
jobs:
windows:
runs-on: ${{ inputs.windows_runner || 'windows-latest' }}
steps:
- uses: actions/checkout@v7
with:
submodules: recursive
- name: Set up MSYS2
if: startsWith(inputs.windows_runner || 'windows-latest', 'windows-')
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
location: C:\ci-msys2
install: >-
mingw-w64-x86_64-gcc
mingw-w64-x86_64-cmake
mingw-w64-x86_64-ninja
mingw-w64-x86_64-ccache
mingw-w64-x86_64-python
mingw-w64-x86_64-qt6-base
mingw-w64-x86_64-qt6-tools
mingw-w64-x86_64-qt6-translations
mingw-w64-x86_64-qt6-imageformats
mingw-w64-x86_64-freetype
mingw-w64-x86_64-harfbuzz
mingw-w64-x86_64-libpng
mingw-w64-x86_64-libjpeg-turbo
mingw-w64-x86_64-libwebp
mingw-w64-x86_64-fribidi
mingw-w64-x86_64-zstd
mingw-w64-x86_64-libutf8proc
mingw-w64-x86_64-libunibreak
mingw-w64-x86_64-libjxl
mingw-w64-x86_64-fontconfig
mingw-w64-x86_64-gettext-runtime
mingw-w64-x86_64-zlib
- name: Cache ccache
if: startsWith(inputs.windows_runner || 'windows-latest', 'windows-')
uses: actions/cache@v6
with:
path: .ccache
key: ccache-windows-${{ github.sha }}
restore-keys: ccache-windows-
- name: Build and package
shell: pwsh
run: |
$msysRoot = if (Test-Path 'C:\ci-msys2\msys64') { 'C:\ci-msys2\msys64' } else { 'C:\tools\msys64' }
$src = Join-Path $env:RUNNER_TEMP 'cr-conv'
New-Item -ItemType Directory -Force $src | Out-Null
.\scripts\build-dist-windows.ps1 -Build -Msys2Root $msysRoot -SourceDir $src
- uses: actions/upload-artifact@v7
with:
name: windows-portable
path: |
dist/*.zip
dist/*.7z
if-no-files-found: error
linux:
runs-on: ${{ inputs.linux_runner || 'ubuntu-22.04' }}
steps:
- uses: actions/checkout@v7
with:
submodules: recursive
- name: Install build dependencies
if: startsWith(inputs.linux_runner || 'ubuntu-22.04', 'ubuntu-')
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential cmake ccache python3-pip wget file \
libfreetype-dev libharfbuzz-dev libpng-dev libjpeg-turbo8-dev \
libwebp-dev libfribidi-dev libzstd-dev libutf8proc-dev \
libfontconfig1-dev zlib1g-dev libgl1-mesa-dev libxkbcommon-dev \
libfuse2 libxkbcommon-x11-0 libxcb-cursor0 libxcb-icccm4 \
libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 \
libxcb-shape0 libxcb-sync1 libxcb-xfixes0 libxcb-xinerama0 \
libxcb-xkb1 libxcb-glx0 libxcb-util1
- name: Build libunibreak from source (Ubuntu 22.04 packages only ancient 1.1)
if: startsWith(inputs.linux_runner || 'ubuntu-22.04', 'ubuntu-')
run: |
cd "$RUNNER_TEMP"
wget -q https://github.com/adah1972/libunibreak/releases/download/libunibreak_6_1/libunibreak-6.1.tar.gz
tar xzf libunibreak-6.1.tar.gz
cd libunibreak-6.1
./configure --prefix=/usr/local >/dev/null
make -j"$(nproc)" >/dev/null
sudo make install >/dev/null
sudo ldconfig
- name: Build libjxl from source
run: |
rm -rf "$RUNNER_TEMP/libjxl"
git clone --branch v0.7.0 --depth 1 --recursive --shallow-submodules \
https://github.com/libjxl/libjxl.git "$RUNNER_TEMP/libjxl"
cmake -S "$RUNNER_TEMP/libjxl" -B "$RUNNER_TEMP/libjxl/build" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DBUILD_TESTING=OFF \
-DJPEGXL_ENABLE_TOOLS=OFF \
-DJPEGXL_ENABLE_DOXYGEN=OFF \
-DJPEGXL_ENABLE_MANPAGES=OFF \
-DJPEGXL_ENABLE_BENCHMARK=OFF \
-DJPEGXL_ENABLE_EXAMPLES=OFF \
-DJPEGXL_ENABLE_JNI=OFF \
-DJPEGXL_ENABLE_SJPEG=OFF \
-DJPEGXL_ENABLE_OPENEXR=OFF \
-DJPEGXL_ENABLE_PLUGINS=OFF
cmake --build "$RUNNER_TEMP/libjxl/build" -j"$(nproc)"
sudo cmake --install "$RUNNER_TEMP/libjxl/build"
sudo ldconfig
- name: Cache Qt
uses: actions/cache@v6
with:
path: ${{ runner.temp }}/appimage-root/Qt
key: qt-linux-${{ env.QT_VERSION_LINUX }}
- name: Cache ccache
if: startsWith(inputs.linux_runner || 'ubuntu-22.04', 'ubuntu-')
uses: actions/cache@v6
with:
path: .ccache
key: ccache-linux-${{ github.sha }}
restore-keys: ccache-linux-
- name: Build AppImage
run: |
mkdir -p "$RUNNER_TEMP/appimage-root"
cd "$RUNNER_TEMP/appimage-root"
export APPIMAGE_EXTRACT_AND_RUN=1
export QT_VERSION="$QT_VERSION_LINUX"
"$GITHUB_WORKSPACE/scripts/create-appimage.sh" --src "$GITHUB_WORKSPACE" -j "$(nproc)"
mkdir -p "$GITHUB_WORKSPACE/dist"
cp cr2xt-*.AppImage "$GITHUB_WORKSPACE/dist/"
- uses: actions/upload-artifact@v7
with:
name: linux-appimage
path: dist/*.AppImage
if-no-files-found: error
macos:
strategy:
fail-fast: false
matrix:
include:
- arch: arm64
runner: ${{ inputs.macos_arm_runner || 'macos-15' }}
- arch: x86_64
runner: ${{ inputs.macos_intel_runner || 'macos-15-intel' }}
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v7
with:
submodules: recursive
- name: Add Homebrew and local bins to PATH (self-hosted runners have a minimal PATH)
run: |
echo "/opt/homebrew/bin" >> "$GITHUB_PATH"
echo "/usr/local/bin" >> "$GITHUB_PATH"
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- name: Install dependencies (Homebrew)
if: startsWith(matrix.runner, 'macos-')
run: |
brew untap aws/tap 2>/dev/null || true
brew install ninja ccache qt@6 freetype harfbuzz libpng jpeg-turbo webp \
fribidi zstd utf8proc libunibreak jpeg-xl fontconfig dbus
- name: Cache ccache
if: startsWith(matrix.runner, 'macos-')
uses: actions/cache@v6
with:
path: .ccache
key: ccache-macos-${{ matrix.arch }}-${{ github.sha }}
restore-keys: ccache-macos-${{ matrix.arch }}-
- name: Build ${{ matrix.arch }}
run: ./scripts/build-dist-macos.sh -a ${{ matrix.arch }} -m 15.0 --skip-dmg -j "$(sysctl -n hw.ncpu)"
- name: Tar app bundle (preserve symlinks)
run: tar -C "dist/macos-${{ matrix.arch }}" -czf "cr2xt-app-${{ matrix.arch }}.tar.gz" cr2xt.app
- uses: actions/upload-artifact@v7
with:
name: macos-app-${{ matrix.arch }}
path: cr2xt-app-${{ matrix.arch }}.tar.gz
if-no-files-found: error
macos-universal:
needs: macos
runs-on: ${{ inputs.macos_arm_runner || 'macos-15' }}
steps:
- uses: actions/checkout@v7
- name: Add Homebrew and local bins to PATH (self-hosted runners have a minimal PATH)
run: |
echo "/opt/homebrew/bin" >> "$GITHUB_PATH"
echo "/usr/local/bin" >> "$GITHUB_PATH"
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- name: Install dmgbuild
run: |
export PATH="$HOME/.local/bin:$PATH"
command -v dmgbuild >/dev/null 2>&1 || pipx install dmgbuild
- uses: actions/download-artifact@v8
with:
pattern: macos-app-*
path: apptars
merge-multiple: true
- name: Unpack per-arch bundles
run: |
mkdir -p dist/macos-arm64 dist/macos-x86_64
tar -C dist/macos-arm64 -xzf apptars/cr2xt-app-arm64.tar.gz
tar -C dist/macos-x86_64 -xzf apptars/cr2xt-app-x86_64.tar.gz
- name: Merge to universal and create DMGs
run: ./scripts/build-dist-macos.sh --merge-only -H
- name: Verify universal binary
run: |
archs=$(lipo -archs dist/macos-universal/cr2xt.app/Contents/MacOS/crqt)
echo "Architectures: $archs"
[[ "$archs" == *arm64* && "$archs" == *x86_64* ]]
- uses: actions/upload-artifact@v7
with:
name: macos-dmgs
path: dist/*.dmg
if-no-files-found: error