Repository navigation
208 lines (180 loc) · 7.48 KB
/
Copy pathci.yml
File metadata and controls
208 lines (180 loc) · 7.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
name: CI
on:
push:
branches: [main]
pull_request:
jobs:
linux:
runs-on: ubuntu-latest
# Arch Linux has Qt 6.8 or later. Ubuntu packages are too old.
container: archlinux:latest
steps:
- name: Install build tools and Qt
run: >
pacman -Syu --noconfirm --needed
gcc make cmake clang git python qt6-base qt6-declarative tomlplusplus hunspell pkgconf poppler-qt6
# The full history lets the floor guard and the coverage check find the base commit.
- uses: actions/checkout@v5
with:
fetch-depth: 0
# The container user does not own the checkout, so git refuses it without this line.
- name: Trust the checkout
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Run all checks
env:
BASE: ${{ github.event_name == 'pull_request' && format('origin/{0}', github.base_ref) || github.event.before }}
run: sh tools/check.sh task "$BASE"
# The app on macOS: build and the tests of the app. The tooling checks
# (format, lint, floor guard, coverage) run on Linux.
macos:
runs-on: macos-latest
steps:
- name: Install build tools
run: brew install tomlplusplus hunspell pkgconf ninja
- uses: jurplel/install-qt-action@v4
with:
version: '6.12.*'
cache: true
- uses: actions/checkout@v5
- name: Build
run: |
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH="$QT_ROOT_DIR"
cmake --build build
- name: Test
env:
QT_QPA_PLATFORM: offscreen
run: ctest --test-dir build --output-on-failure -E "^check_|floor_guard|coverage_diff|tst_icons"
# The app bundle: macdeployqt copies Qt, Hunspell, and the QML files into
# it. The check fails if the bundle still links to a library outside it.
- name: Make the app bundle
run: |
"$QT_ROOT_DIR/bin/macdeployqt" build/codicier.app -qmldir=qml -dmg
! find build/codicier.app -type f -perm -u+x -exec otool -L {} + \
| grep -E "/opt/homebrew|/usr/local|$QT_ROOT_DIR"
status=0
# macOS has no timeout command. SIGALRM after 10 s gives status 142.
QT_QPA_PLATFORM=offscreen perl -e 'alarm 10; exec @ARGV' \
build/codicier.app/Contents/MacOS/codicier || status=$?
test "$status" -eq 142
- uses: actions/upload-artifact@v4
with:
name: Codicier-macOS
path: build/codicier.dmg
# The app on Windows, with the MinGW packages of MSYS2.
# MSYS2 ships Qt 6.11, and the app needs Qt 6.12. Until MSYS2 ships
# Qt 6.12, a failure of this job does not fail the run.
windows:
runs-on: windows-latest
continue-on-error: true
defaults:
run:
shell: msys2 {0}
steps:
- uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
update: true
install: >-
git
mingw-w64-ucrt-x86_64-gcc
mingw-w64-ucrt-x86_64-cmake
mingw-w64-ucrt-x86_64-ninja
mingw-w64-ucrt-x86_64-pkgconf
mingw-w64-ucrt-x86_64-qt6-base
mingw-w64-ucrt-x86_64-qt6-declarative
mingw-w64-ucrt-x86_64-tomlplusplus
mingw-w64-ucrt-x86_64-hunspell
mingw-w64-ucrt-x86_64-python
- uses: actions/checkout@v5
- name: Build
run: |
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug
cmake --build build
- name: Test
env:
QT_QPA_PLATFORM: offscreen
run: ctest --test-dir build --output-on-failure -E "^check_|floor_guard|coverage_diff|tst_icons"
- name: Show a failed test
if: failure()
env:
QT_QPA_PLATFORM: offscreen
QT_FORCE_STDERR_LOGGING: 1
run: |
pacman -Q mingw-w64-ucrt-x86_64-qt6-base
find build -name 'tst_smoke*' -o -name 'tst_roundtrip*' | head
cd build/tests
./tst_smoke.exe -o -,txt 2>&1 | head -60 || true
./tst_roundtrip.exe -o -,txt 2>&1 | head -60 || true
# The Flatpak: it builds, it starts, and it has no network permission.
flatpak:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Install Flatpak
run: |
sudo apt-get update
sudo apt-get install -y flatpak flatpak-builder
flatpak remote-add --user --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
flatpak remote-add --user --if-not-exists flathub-beta https://dl.flathub.org/beta-repo/flathub-beta.flatpakrepo
flatpak install --user -y --noninteractive flathub-beta org.kde.Sdk//6.12-beta org.kde.Platform//6.12-beta
- name: Build
run: >-
flatpak-builder --user --install --force-clean
flatpak-build packaging/flatpak/io.github.Orpheus_21.Codicier.yml
- name: Check
run: |
! grep -n network flatpak-build/metadata
status=0
timeout 10 flatpak run --user --env=QT_QPA_PLATFORM=offscreen \
io.github.Orpheus_21.Codicier || status=$?
test "$status" -eq 124
# The AppImage: built on an older glibc, then started on a clean Debian 13.
appimage:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v5
- name: Install build tools
run: |
sudo apt-get update
sudo apt-get install -y ninja-build pkg-config libhunspell-dev libtomlplusplus-dev \
libgl-dev libegl-dev libxkbcommon-dev libfuse2t64
- uses: jurplel/install-qt-action@v4
with:
version: '6.12.*'
cache: true
- name: Build
run: |
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$QT_ROOT_DIR"
cmake --build build --target codicier
DESTDIR="$PWD/AppDir" cmake --install build --prefix /usr
- name: Make the AppImage
env:
APPIMAGE_EXTRACT_AND_RUN: 1
QML_SOURCES_PATHS: qml
EXTRA_PLATFORM_PLUGINS: libqwayland.so;libqoffscreen.so
run: |
base=https://github.com/linuxdeploy
curl -sLfO "$base/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage"
curl -sLfO "$base/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage"
chmod +x linuxdeploy*.AppImage
export QMAKE="$QT_ROOT_DIR/bin/qmake"
# The index uses only SQLite. The other drivers need client libraries.
find "$QT_ROOT_DIR/plugins/sqldrivers" -type f ! -name libqsqlite.so -delete
./linuxdeploy-x86_64.AppImage --appdir AppDir --plugin qt --output appimage \
-d AppDir/usr/share/applications/codicier.desktop \
-i AppDir/usr/share/icons/hicolor/256x256/apps/codicier.png
ls -l Codicier*.AppImage
- name: Start on a clean Debian 13
run: |
docker run --rm -v "$PWD:/w" -w /w debian:13 sh -c '
apt-get update -qq
apt-get install -y -qq --no-install-recommends libgl1 libegl1 libopengl0 libglx0 \
libfontconfig1 libfreetype6 libglib2.0-0t64 libxkbcommon0 \
libcom-err2 libexpat1 libgpg-error0 > /dev/null
status=0
QT_QPA_PLATFORM=offscreen timeout 10 ./Codicier*.AppImage --appimage-extract-and-run || status=$?
test "$status" -eq 124'
- uses: actions/upload-artifact@v4
with:
name: Codicier-AppImage
path: Codicier*.AppImage