Repository navigation
181 lines (175 loc) · 6.51 KB
/
Copy pathpackage.yml
File metadata and controls
181 lines (175 loc) · 6.51 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: Package
on:
workflow_dispatch:
push:
tags:
- "v*"
jobs:
linux:
name: Linux .deb and .rpm
runs-on: ubuntu-24.04
# Build against the oldest supported glibc, independent of the runner OS.
container: ubuntu:22.04
env:
DEBIAN_FRONTEND: noninteractive
steps:
- uses: actions/checkout@v4
- name: Install build tools
run: |
apt-get update
apt-get install -y cmake ninja-build pkg-config \
qt6-base-dev qt6-wayland libgl1-mesa-dev libpulse-dev libssl-dev dpkg-dev rpm \
python3 patchelf g++ file
- name: Package
run: bash scripts/package.sh
- uses: actions/upload-artifact@v4
with:
name: linux-packages
path: |
dist/*.deb
dist/*.rpm
if-no-files-found: error
linux-install-test:
name: Install Linux package (${{ matrix.image }})
needs: linux
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
image: ["ubuntu:22.04", "ubuntu:24.04", "debian:12", "fedora:43"]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: linux-packages
path: dist
- name: Install and exercise packaged programs without system Qt
run: |
docker run --rm -v "$PWD:/work:ro" "${{ matrix.image }}" \
bash /work/scripts/test-linux-package.sh
windows:
name: Windows .exe
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: jurplel/install-qt-action@v4
with:
version: "6.7.3"
archives: qtbase qttools
- name: Install NSIS
run: choco install nsis -y
- name: Configure
run: cmake -S . -B build-package -DCMAKE_BUILD_TYPE=Release -DNG_BUNDLE_RUNTIME=ON
- name: Build
run: cmake --build build-package --config Release -j 4
- name: Package
working-directory: build-package
run: |
cpack -C Release -G NSIS
cpack -C Release -G ZIP
- name: Verify ZIP and installed EXE with Qt removed from PATH
timeout-minutes: 5
shell: pwsh
run: |
$env:PATH = "$env:SystemRoot\System32;$env:SystemRoot"
$env:QT_COMMAND_LINE_PARSER_NO_GUI_MESSAGE_BOXES = '1'
Remove-Item Env:QT_PLUGIN_PATH -ErrorAction SilentlyContinue
Remove-Item Env:QT_QPA_PLATFORM_PLUGIN_PATH -ErrorAction SilentlyContinue
Expand-Archive (Get-Item dist/*.zip).FullName "$env:RUNNER_TEMP/zip-test"
$bins = Get-ChildItem "$env:RUNNER_TEMP/zip-test" -Filter netgreeting.exe -Recurse
if ($bins.Count -ne 1) { throw "Expected one packaged executable" }
function Test-Bundle($bin) {
foreach ($file in @('Qt6Core.dll', 'Qt6Gui.dll', 'Qt6Widgets.dll', 'Qt6Network.dll', 'platforms/qwindows.dll', 'vcruntime140.dll', 'msvcp140.dll')) {
if (!(Test-Path "$bin/$file")) { throw "Missing runtime: $file" }
}
foreach ($app in @('netgreeting', 'greetingpost')) {
Write-Host "Checking $bin/$app.exe"
$p = Start-Process "$bin/$app.exe" -ArgumentList '--version' -PassThru -RedirectStandardOutput "$env:RUNNER_TEMP/$app-version.txt" -RedirectStandardError "$env:RUNNER_TEMP/$app-error.txt"
if (!$p.WaitForExit(30000)) { $p.Kill(); throw "$app startup timed out" }
Get-Content "$env:RUNNER_TEMP/$app-version.txt"
Get-Content "$env:RUNNER_TEMP/$app-error.txt"
if ($p.ExitCode -ne 0) { throw "$app failed: $($p.ExitCode)" }
}
}
Test-Bundle $bins[0].DirectoryName
$install = Join-Path $env:RUNNER_TEMP 'installer-test'
$p = Start-Process (Get-Item dist/*.exe).FullName -ArgumentList '/S', "/D=$install" -Wait -PassThru
if ($p.ExitCode -ne 0) { throw "Installer failed" }
if (!(Test-Path "$install/bin/netgreeting.exe")) { throw "Installer did not create $install/bin/netgreeting.exe" }
Test-Bundle "$install/bin"
- uses: actions/upload-artifact@v4
with:
name: windows-packages
path: |
dist/*.exe
dist/*.zip
if-no-files-found: error
macos:
name: macOS .dmg
runs-on: macos-15
env:
DEVELOPER_DIR: /Applications/Xcode_16.4.app/Contents/Developer
steps:
- uses: actions/checkout@v4
- uses: jurplel/install-qt-action@v4
with:
version: "6.7.3"
archives: qtbase qttools
- name: Configure
run: |
cmake -S . -B build-package -DCMAKE_BUILD_TYPE=Release \
-DNG_BUNDLE_RUNTIME=ON
- name: Build
run: cmake --build build-package -j 4
- name: Package
working-directory: build-package
run: cpack -G DragNDrop
- name: Verify application from disk image
run: |
printf 'Y\n' | hdiutil attach dist/*.dmg -mountpoint "$RUNNER_TEMP/netgreeting-dmg"
cp -R "$RUNNER_TEMP/netgreeting-dmg/netgreeting.app" "$RUNNER_TEMP/netgreeting.app"
hdiutil detach "$RUNNER_TEMP/netgreeting-dmg"
python3 scripts/test-macos-package.py "$RUNNER_TEMP/netgreeting.app"
- uses: actions/upload-artifact@v4
with:
name: macos-packages
path: dist/*.dmg
if-no-files-found: error
release:
name: Publish GitHub Release
needs: [linux, linux-install-test, windows, macos]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
with:
pattern: "*-packages"
merge-multiple: true
path: dist
- name: Create stable download aliases
run: |
set -euo pipefail
ls -lh dist
DEB="$(ls dist/*.deb | head -n 1)"
RPM="$(ls dist/*.rpm | head -n 1)"
EXE="$(ls dist/*.exe | head -n 1)"
ZIP="$(ls dist/*.zip | head -n 1)"
DMG="$(ls dist/*.dmg | head -n 1)"
cp "$DEB" dist/netgreeting-amd64.deb
cp "$RPM" dist/netgreeting-x86_64.rpm
cp "$EXE" dist/netgreeting-win64.exe
cp "$ZIP" dist/netgreeting-win64.zip
cp "$DMG" dist/netgreeting-macos.dmg
ls -lh dist
- name: Publish release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: |
dist/*.deb
dist/*.rpm
dist/*.exe
dist/*.zip
dist/*.dmg