Repository navigation
248 lines (227 loc) · 9.41 KB
/
Copy pathrelease.yml
File metadata and controls
248 lines (227 loc) · 9.41 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
name: Release
on:
push:
tags: ["v*"]
jobs:
package:
name: package ${{ matrix.os }}
runs-on: ${{ matrix.os }}
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
preset: release-macos
- os: ubuntu-latest
preset: release-linux
- os: windows-latest
preset: release-windows
steps:
- uses: actions/checkout@v4
- name: Install Ninja + CMake
uses: lukka/get-cmake@latest
- name: Linux Qt runtime deps
if: runner.os == 'Linux'
run: >
sudo apt-get update && sudo apt-get install -y
libgl1-mesa-dev libegl1 libfontconfig1 libxkbcommon-x11-0
libdbus-1-3 libglib2.0-0t64
libxcb-cursor0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1
libxcb-randr0 libxcb-render-util0 libxcb-shape0
libxcb-xinerama0 libxcb-xkb1 libfuse2
- name: MSVC environment
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
- name: Cache Qt
uses: actions/cache@v4
with:
path: |
.qt
!.qt/venv
key: qt-${{ runner.os }}-${{ hashFiles('cmake/QtVersion.cmake', 'scripts/setup_qt.py') }}
- name: Provision Qt
run: python3 scripts/setup_qt.py
# gtest_discover_tests runs the editor test exe during the build; the
# dynamically linked Qt DLLs must be loadable (same fix as ci.yml).
- name: Qt DLLs on PATH (Windows test discovery)
if: runner.os == 'Windows'
shell: pwsh
run: Resolve-Path .qt/*/msvc*/bin | ForEach-Object { Add-Content $env:GITHUB_PATH $_.Path }
- name: Cache FetchContent downloads
uses: actions/cache@v4
with:
path: build/*/_deps/*-subbuild/*-populate-prefix/src/*.tar.gz
key: deps-${{ matrix.os }}-${{ hashFiles('cmake/deps.cmake') }}
# The offline manual (ADR-0009 / docs-s2). Built with Node HERE and handed
# to CMake as a finished directory below — CMake never invokes npm, so a
# developer build stays Node-free.
- uses: actions/setup-node@v4
with:
node-version-file: docs-site/.nvmrc
cache: npm
cache-dependency-path: docs-site/package-lock.json
- name: Build the offline manual
working-directory: docs-site
run: |
npm ci
npm run build:local
- name: Configure
run: >
cmake --preset ${{ matrix.preset }}
-DROADMAKER_BUNDLE_MANUAL=ON
-DROADMAKER_MANUAL_DIR=${{ github.workspace }}/docs-site/dist
- name: Build
run: cmake --build --preset ${{ matrix.preset }}
- name: Test
run: ctest --preset ${{ matrix.preset }}
# windows-latest runners no longer ship NSIS; CPack's NSIS generator
# locates makensis through the registry, which choco sets up.
- name: Install NSIS
if: runner.os == 'Windows'
run: choco install nsis -y --no-progress
- name: Package (CPack)
run: cpack --config build/${{ matrix.preset }}/CPackConfig.cmake -B ${{ github.workspace }}/dist
# The AppImage is Linux's real "user installs nothing" artifact; CPack's
# TGZ above is the plain-archive fallback.
- name: Build AppImage (linuxdeploy)
if: runner.os == 'Linux'
run: |
cmake --install build/${{ matrix.preset }} --prefix appdir/usr
curl -sSfL -o linuxdeploy https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
curl -sSfL -o linuxdeploy-plugin-qt https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage
chmod +x linuxdeploy linuxdeploy-plugin-qt
cat > roadmaker-editor.desktop <<'EOF'
[Desktop Entry]
Type=Application
Name=RoadMaker
Exec=roadmaker-editor
Icon=roadmaker-editor
Categories=Development;
EOF
# Placeholder icon until branding — linuxdeploy requires a standard
# resolution (a 1x1 pixel is rejected), so generate a solid 256x256.
python3 - <<'PYEOF'
import struct, zlib, pathlib
def chunk(tag, data):
return struct.pack(">I", len(data)) + tag + data + struct.pack(">I", zlib.crc32(tag + data))
size = 256
row = b"\x00" + b"\x2e\x64\x8e\xff" * size # filter byte + solid RGBA rows
png = (b"\x89PNG\r\n\x1a\n"
+ chunk(b"IHDR", struct.pack(">IIBBBBB", size, size, 8, 6, 0, 0, 0))
+ chunk(b"IDAT", zlib.compress(row * size))
+ chunk(b"IEND", b""))
pathlib.Path("roadmaker-editor.png").write_bytes(png)
PYEOF
export QMAKE=${{ github.workspace }}/.qt/6.8.3/gcc_64/bin/qmake
# linuxdeploy resolves the installed binary's dependencies with ldd,
# which needs the provisioned Qt libs on the search path.
export LD_LIBRARY_PATH=${{ github.workspace }}/.qt/6.8.3/gcc_64/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
export QT_QPA_PLATFORM=offscreen
./linuxdeploy --appdir appdir \
--executable appdir/usr/bin/roadmaker-editor \
--desktop-file roadmaker-editor.desktop \
--icon-file roadmaker-editor.png \
--plugin qt --output appimage
mv RoadMaker*.AppImage dist/
env:
# linuxdeploy's Qt plugin locates Qt through qmake; the glob path
# above must match cmake/QtVersion.cmake's pin.
NO_STRIP: "1"
- name: Smoke test packaged binary (--version + bundled help + manual)
shell: bash
env:
QT_QPA_PLATFORM: offscreen
run: |
set -euo pipefail
# The in-app help viewer needs the compiled collection plus QtSql and
# its qsqlite driver (QHelpEngine is SQLite-backed). macdeployqt /
# windeployqt / linuxdeploy pull QtSql in via Qt6::Help; assert every
# piece actually shipped in the packaged artifact.
#
# The manual is asserted alongside it, at the layout manual_locator.cpp
# resolves for this platform — the two must agree or Help ▸ Open Manual
# silently falls back to the online pointer in a build that HAS one.
# A page under it is checked too: an empty manual/ directory would pass
# an index-only check while opening to nothing.
case "${{ runner.os }}" in
macOS)
hdiutil attach dist/roadmaker-*-Darwin-*.dmg -mountpoint /tmp/rmdmg -nobrowse
app=/tmp/rmdmg/roadmaker-editor.app
"$app/Contents/MacOS/roadmaker-editor" --version
test -f "$app/Contents/Resources/help/roadmaker.qch"
test -f "$app/Contents/Resources/help/roadmaker.qhc"
test -e "$app/Contents/Frameworks/QtSql.framework"
ls "$app/Contents/PlugIns/sqldrivers/"libqsqlite*.dylib
test -f "$app/Contents/Resources/manual/index.html"
test -f "$app/Contents/Resources/manual/tutorials/getting-around.html"
hdiutil detach /tmp/rmdmg
;;
Linux)
./dist/RoadMaker*.AppImage --appimage-extract > /dev/null
root=squashfs-root
"$root/AppRun" --version
test -f "$root/usr/bin/help/roadmaker.qch"
test -f "$root/usr/bin/help/roadmaker.qhc"
ls "$root"/usr/lib/libQt6Sql.so*
ls "$root"/usr/plugins/sqldrivers/libqsqlite.so
test -f "$root/usr/share/roadmaker/manual/index.html"
test -f "$root/usr/share/roadmaker/manual/tutorials/getting-around.html"
;;
Windows)
7z x dist/roadmaker-*-Windows-*.zip -osmoke -y > /dev/null
root=$(dirname "$(ls smoke/*/bin/roadmaker-editor.exe)")
"$root/roadmaker-editor.exe" --version
test -f "$root/help/roadmaker.qch"
test -f "$root/help/roadmaker.qhc"
ls "$root"/Qt6Sql.dll
ls "$root"/sqldrivers/qsqlite.dll
test -f "$root/manual/index.html"
test -f "$root/manual/tutorials/getting-around.html"
;;
esac
- uses: actions/upload-artifact@v4
with:
name: installers-${{ runner.os }}
path: |
dist/*.dmg
dist/*.exe
dist/*.zip
dist/*.tar.gz
dist/*.AppImage
wheels:
name: Python wheel
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: lukka/get-cmake@latest
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Build wheel
run: pip wheel python/ -w dist -v
- name: Test wheel
run: |
pip install dist/roadmaker-*.whl pytest
pytest python/tests -q
- uses: actions/upload-artifact@v4
with:
name: wheels
path: dist/roadmaker-*.whl
publish:
name: GitHub release
needs: [package, wheels]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- uses: softprops/action-gh-release@v2
with:
draft: true
generate_release_notes: true
files: artifacts/*