-
Notifications
You must be signed in to change notification settings - Fork 0
131 lines (118 loc) · 6.08 KB
/
test-appimage-linuxdeploy.yml
File metadata and controls
131 lines (118 loc) · 6.08 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
name: test-appimage-linuxdeploy
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -el {0}
steps:
- name: Setup apt-get
run: |
sudo apt-get update
sudo apt-get install cmake ninja-build
sudo apt-get install libgl1-mesa-dev libglvnd-dev libxcb-xkb-dev libxkbcommon-x11-dev libvulkan-dev
sudo apt-get install wget
- name: Download qtbase with examples
working-directory: ${{github.workspace}}
run: |
wget https://master.qt.io/archive/qt/6.10/6.10.2/submodules/qtbase-everywhere-src-6.10.2.tar.xz
tar -xf qtbase-everywhere-src-6.10.2.tar.xz
cd qtbase-everywhere-src-6.10.2
cp -R examples ../qt6-examples
- name: Setup appimagetool linuxdeploy
run: |
wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
wget https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage
wget https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage
chmod +x linuxdeploy-x86_64.AppImage
chmod +x linuxdeploy-plugin-qt-x86_64.AppImage
chmod +x appimagetool-x86_64.AppImage
mv linuxdeploy-x86_64.AppImage /usr/local/bin/linuxdeploy
mv linuxdeploy-plugin-qt-x86_64.AppImage /usr/local/bin/linuxdeploy-plugin-qt
mv appimagetool-x86_64.AppImage /usr/local/bin/appimagetool
- name: Setup miniconda
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
auto-update-conda: true
channels: conda-forge,defaults
- name: Install conda-forge packages
run: |
conda install conda-forge::qt6-main
# conda install conda-forge::qt6-wayland
- name: Replace CMakeLists.txt
working-directory: ${{github.workspace}}/qt6-examples/widgets/mainwindows/menus
run: |
# qt6-examples/widgets/mainwindows/CMakeLists.txt uses qt6 built-in deploy
mv CMakeLists.txt CMakeLists.txt.old
printf "cmake_minimum_required(VERSION 3.16)\n\nproject(menus LANGUAGES CXX)\n\n" > CMakeLists.txt
printf "find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)\n\n" >> CMakeLists.txt
printf "set(CMAKE_CXX_STANDARD 17)\nset(CMAKE_CXX_STANDARD_REQUIRED ON)\nset(CMAKE_AUTOMOC ON)\nset(CMAKE_AUTORCC ON)\n\n" >> CMakeLists.txt
printf "qt_add_executable(menus main.cpp mainwindow.cpp mainwindow.h)\n" >> CMakeLists.txt
printf "target_link_libraries(menus PRIVATE Qt6::Core Qt6::Gui Qt6::Widgets)\n\n" >> CMakeLists.txt
printf "include(GNUInstallDirs)\n" >> CMakeLists.txt
printf "install(TARGETS menus RUNTIME DESTINATION bin)\n" >> CMakeLists.txt
- name: Configure CMake
working-directory: ${{github.workspace}}/qt6-examples/widgets/mainwindows/menus
run: |
cmake \
-G Ninja \
-B build \
-DQT_DEPLOY_SUPPORT=OFF \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=RelWithDebInfo
- name: Build
working-directory: ${{github.workspace}}/qt6-examples/widgets/mainwindows/menus
run: cmake --build build --config RelWithDebInfo
- name: Deploy
working-directory: ${{github.workspace}}/qt6-examples/widgets/mainwindows/menus
continue-on-error: true
run: |
# run ninja install
DESTDIR=../AppDir ninja -C build install
# provide a manifest file xdg
mkdir -p AppDir/usr/share/metainfo
printf "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<component type=\"desktop-application\">\n<id>com.example.menus</id>\n<name>menus</name>\n<project_license>BSD-3-Clause</project_license>\n<launchable type=\"desktop-id\">com.example.menus.desktop</launchable>\n</component>\n" > "AppDir/usr/share/metainfo/com.example.menus.metainfo.xml"
# provide a desktop file xdg
mkdir -p AppDir/usr/share/applications
printf "[Desktop Entry]\nType=Application\nName=mainwindows\nExec=menus\nIcon=menus\nCategories=Utility;\n" > "AppDir/usr/share/applications/com.example.menus.desktop"
# provide an icon
mkdir -p AppDir/usr/share/icons/hicolor/32x32/apps
cp /home/runner/miniconda3/envs/test/share/doc/qt6/global/tools-doc-front-page/images/build-32x32.png AppDir/usr/share/icons/hicolor/32x32/apps/menus.png
# run linuxdeploy
export LD_LIBRARY_PATH=/home/runner/miniconda3/envs/test/lib:/home/runner/miniconda3/lib:/usr/local/lib:/usr/lib
export QMAKE=qmake6
export DISABLE_COPYRIGHT_FILES_DEPLOYMENT=1
export EXTRA_QT_MODULES="eglfsdeviceintegration;eglfskmssupport;xcbqpa"
export EXTRA_PLATFORM_PLUGINS="libqeglfs.so;libqlinuxfb.so;libqminimal.so;libqminimalegl.so;libqoffscreen.so;libqvkkhrdisplay.so;libqvnc.so;libqwayland.so;libqxcb.so"
export LDAI_NO_APPSTREAM=1
linuxdeploy --appdir AppDir --plugin qt --output appimage
export LD_LIBRARY_PATH=
# move package
mkdir -p artifacts
mv mainwindows-x86_64.AppImage artifacts/
- name: Fix artifact
working-directory: ${{github.workspace}}/qt6-examples/widgets/mainwindows/menus/artifacts
continue-on-error: true
run: |
wget https://github.com/e2se/apprunqtlinux/archive/refs/heads/main.tar.gz
mkdir -p apprunqtlinux
tar -zxvf main.tar.gz -C apprunqtlinux
cd apprunqtlinux
cmake -B . -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release
cd ..
./mainwindows-x86_64.AppImage --appimage-extract
mv squashfs-root/AppRun squashfs-root/AppRun.wrapped
cp apprunqtlinux/AppRun squashfs-root/AppRun
chmod +x squashfs-root/AppRun
mv mainwindows-x86_64.AppImage mainwindows-x86_64.AppImage.bak
appimagetool --no-appstream squashfs-root mainwindows-x86_64.AppImage
rm -R {apprunqtlinux,squashfs-root}
rm main.tar.gz
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
path: ${{github.workspace}}/qt6-examples/widgets/mainwindows/menus/artifacts