Skip to content

Commit 3d11f6f

Browse files
chore: add Qt6 ci
1 parent c01fa50 commit 3d11f6f

File tree

4 files changed

+330
-1
lines changed

4 files changed

+330
-1
lines changed

.github/workflows/appimage-qt6.yml

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
name: Lemon build matrix - AppImage
2+
3+
on:
4+
# push代码时触发workflow
5+
push:
6+
# 忽略README.md
7+
paths-ignore:
8+
- 'README.md'
9+
- 'LICENSE'
10+
- 'BUILD.md'
11+
# pull_request时触发workflow
12+
pull_request:
13+
# 忽略README.md
14+
paths-ignore:
15+
- 'README.md'
16+
- 'LICENSE'
17+
- 'BUILD.md'
18+
release:
19+
types: [published]
20+
21+
jobs:
22+
check_commit_msg:
23+
outputs:
24+
commit_message: ${{ steps.get_message.outputs.message }}
25+
name: Check if the workflow has been disabled.
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v2
29+
- name: Get commit message
30+
id: get_message
31+
run: |
32+
echo "::set-output name=message::$(git log --format=%B -n 1 ${{ github.event.after }})"
33+
build:
34+
needs: check_commit_msg
35+
if: ${{ !contains( needs.check_commit_msg.outputs.commit_message, 'NO_MAIN') }}
36+
strategy:
37+
matrix:
38+
qt_version: [6.0.0]
39+
platform: [ubuntu-16.04]
40+
arch: [x64]
41+
fail-fast: false
42+
43+
runs-on: ${{ matrix.platform }}
44+
steps:
45+
- name: Get the version
46+
id: get_version
47+
shell: bash
48+
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)
49+
- name: Checking out sources
50+
uses: actions/checkout@v2
51+
with:
52+
submodules: 'recursive'
53+
- name: Install Python 3.7 version
54+
uses: actions/setup-python@v2
55+
with:
56+
python-version: '3.7'
57+
architecture: ${{ matrix.arch }}
58+
- name: Restoring submodules
59+
run: git submodule update --init
60+
- name: Cache Qt
61+
id: cache-qt
62+
uses: actions/cache@v1
63+
with:
64+
path: ../Qt
65+
key: QtCache-${{ matrix.platform }}-${{ matrix.arch }}-${{ matrix.qt_version }}
66+
- name: Installing Qt - ${{ matrix.arch }}
67+
uses: jurplel/install-qt-action@v2
68+
with:
69+
version: ${{ matrix.qt_version }}
70+
arch: ${{ matrix.qtarch }}
71+
mirror: "http://mirrors.ocf.berkeley.edu/qt/"
72+
cached: ${{ steps.cache-qt.outputs.cache-hit }}
73+
- name: Linux - ${{ matrix.qt_version }} - Build preparation - Install Packages
74+
run: |
75+
sudo apt update
76+
sudo apt install -y build-essential ninja-build cmake pkgconf fcitx-frontend-qt5 libxcb-xinerama0 libgl-dev libx11-dev libxkbcommon-x11-dev libxcb-image0-dev libxcb-icccm4-dev libssl-dev libxcb-keysyms1 libxcb-render-util0
77+
# ========================================================================================================= Generate MakeFile and Build
78+
- name: Linux - ${{ matrix.qt_version }} - Generate Dependencies and Build
79+
shell: bash
80+
env:
81+
CC: /usr/bin/gcc-7
82+
CXX: /usr/bin/g++-7
83+
run: |
84+
mkdir build
85+
cd build
86+
cmake .. -GNinja -DCMAKE_INSTALL_PREFIX=./AppDir/usr -DCMAKE_BUILD_TYPE=Release -DLEMON_BUILD_INFO="Build for AppImage" -DLEMON_BUILD_EXTRA_INFO="Build on $(uname -sr)"
87+
cmake --build . --parallel $(nproc)
88+
cmake --install .
89+
# ========================================================================================================= Deployments
90+
- name: Linux - ${{ matrix.qt_version }} - Generating AppImage
91+
run: |
92+
cd build
93+
wget https://github.com/probonopd/linuxdeployqt/releases/download/7/linuxdeployqt-7-x86_64.AppImage
94+
chmod +x ./linuxdeployqt-7-x86_64.AppImage
95+
cd AppDir
96+
wget -c https://github.com/darealshinji/AppImageKit-checkrt/releases/download/continuous/AppRun-patched-x86_64 -O AppRun
97+
chmod a+x AppRun
98+
mkdir -p ./usr/{lib,optional}/
99+
wget -c https://github.com/darealshinji/AppImageKit-checkrt/releases/download/continuous/exec-x86_64.so -O ./usr/optional/exec.so
100+
mkdir -p ./usr/optional/libstdc++/
101+
cp -fv /usr/lib/x86_64-linux-gnu/libstdc++.so.6 ./usr/optional/libstdc++/
102+
mkdir -p ./usr/optional/libgcc_s/
103+
cp -fv /lib/x86_64-linux-gnu/libgcc_s.so.1 ./usr/optional/libgcc_s/
104+
cp -fv /usr/lib/x86_64-linux-gnu/{libssl.so.1.1,libcrypto.so.1.1} ./usr/lib/
105+
mkdir -p ./usr/plugins/platforminputcontexts/
106+
cp -fv /usr/lib/x86_64-linux-gnu/qt5/plugins/platforminputcontexts/libfcitxplatforminputcontextplugin.so ./usr/plugins/platforminputcontexts/
107+
cd ..
108+
./linuxdeployqt-7-x86_64.AppImage AppDir/usr/share/applications/lemon-lime.desktop -appimage -no-strip -always-overwrite -extra-plugins=iconengines,imageformats,platforminputcontexts
109+
mv ./Lemon*.AppImage ./Lemon.AppImage
110+
- name: Linux - ${{ matrix.qt_version }} - Uploading artifact
111+
uses: actions/upload-artifact@v2
112+
with:
113+
name: Lemon-${{ github.sha }}.linux-${{ matrix.arch }}.qt${{ matrix.qt_version }}.AppImage
114+
path: build/Lemon.AppImage
115+
- name: Linux - ${{ matrix.qt_version }} - Upload binaries to release
116+
uses: svenstaro/upload-release-action@v1-release
117+
if: github.event_name == 'release' && matrix.platform == 'ubuntu-16.04' && matrix.qt_version == '5.15.0'
118+
with:
119+
repo_token: ${{ secrets.GITHUB_TOKEN }}
120+
file: build/Lemon.AppImage
121+
asset_name: Lemon.${{ steps.get_version.outputs.VERSION }}.linux-qt6-${{ matrix.arch }}.AppImage
122+
tag: ${{ github.ref }}
123+
overwrite: true

.github/workflows/macos-qt6.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: MacOS Qt6
2+
on:
3+
push:
4+
paths-ignore:
5+
- 'README.md'
6+
- 'LICENSE'
7+
- 'BUILD.md'
8+
pull_request:
9+
paths-ignore:
10+
- 'README.md'
11+
- 'LICENSE'
12+
- 'BUILD.md'
13+
release:
14+
types: [published]
15+
jobs:
16+
build:
17+
name: Build
18+
runs-on: ${{ matrix.os }}
19+
strategy:
20+
matrix:
21+
os: [macos-latest]
22+
qt_ver: [6.0.0]
23+
qt_arch: [clang_64]
24+
env:
25+
targetName: lemon-qt6
26+
steps:
27+
- name: cacheQt
28+
id: MacosCacheQt
29+
uses: actions/cache@v1
30+
with:
31+
path: ../Qt/${{matrix.qt_ver}}/${{matrix.qt_arch}}
32+
key: ${{ runner.os }}-Qt/${{matrix.qt_ver}}/${{matrix.qt_arch}}
33+
# - name: setupQt
34+
# if: steps.MacosCacheQt.outputs.cache-hit == 'true'
35+
# shell: bash
36+
# env:
37+
# QtPath: ../Qt/${{matrix.qt_ver}}/${{matrix.qt_arch}}
38+
# run: |
39+
# qt_Path=${env:QtPath}
40+
# echo "Qt5_DIR=\"$QtPath\"" >> $GITHUB_ENV
41+
# echo "${qt_Path}/bin" >> $GITHUB_PATH
42+
- name: Install Qt
43+
if: steps.MacosCacheQt.outputs.cache-hit != 'true'
44+
uses: jurplel/install-qt-action@v2
45+
with:
46+
version: ${{ matrix.qt_ver }}
47+
48+
- uses: actions/checkout@v2
49+
with:
50+
submodules: true
51+
- name: macOS - ${{ matrix.qt_version }} - Build preparation - Install Packages
52+
run: |
53+
brew install ninja pkg-config
54+
- name: build macos
55+
env:
56+
Qt5_DIR: ../Qt/${{matrix.qt_ver}}/${{matrix.qt_arch}}
57+
run: |
58+
cmake . \
59+
-GNinja \
60+
-DCMAKE_BUILD_TYPE=Release \
61+
-DLEMON_QT6=ON \
62+
-DLEMON_BUILD_INFO="Build for macOS" \
63+
-DLEMON_BUILD_EXTRA_INFO="Build on $(uname -sr)" \
64+
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.13
65+
cmake --build . --parallel $(sysctl -n hw.logicalcpu)
66+
# tag 打包
67+
- name: package
68+
env:
69+
Qt5_DIR: ../Qt/${{matrix.qt_ver}}/${{matrix.qt_arch}}
70+
run: |
71+
# 拷贝依赖
72+
#mv ${targetName} ${targetName}.app
73+
export PATH=$Qt5_DIR/bin:$PATH
74+
macdeployqt ${targetName}.app -qmldir=. -verbose=1 -dmg
75+
- name: Upload artifact
76+
uses: actions/upload-artifact@v2-preview
77+
with:
78+
name: ${{ env.targetName }}.dmg
79+
path: ${{ env.targetName }}.dmg
80+
- name: uploadRelease
81+
if: startsWith(github.event.ref, 'refs/tags/')
82+
uses: svenstaro/upload-release-action@v1-release
83+
with:
84+
repo_token: ${{ secrets.GITHUB_TOKEN }}
85+
file: ./${{ env.targetName }}.dmg
86+
asset_name: ${{ env.targetName }}.dmg
87+
tag: ${{ github.ref }}

.github/workflows/windows-qt6.yml

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
name: Windows Qt6
2+
on:
3+
# push代码时触发workflow
4+
push:
5+
# 忽略README.md
6+
paths-ignore:
7+
- 'README.md'
8+
- 'LICENSE'
9+
- 'BUILD.md'
10+
# pull_request时触发workflow
11+
pull_request:
12+
# 忽略README.md
13+
paths-ignore:
14+
- 'README.md'
15+
- 'LICENSE'
16+
- 'BUILD.md'
17+
release:
18+
types: [published]
19+
jobs:
20+
build:
21+
name: Build
22+
strategy:
23+
matrix:
24+
qt_version: [6.0.0]
25+
platform: [windows-latest]
26+
include:
27+
- platform: windows-latest
28+
arch: x64
29+
qtarch: win64_msvc2019_64
30+
fail-fast: false
31+
32+
runs-on: ${{ matrix.platform }}
33+
env:
34+
targetName: lemon.exe
35+
# 步骤
36+
steps:
37+
- name: Get the version
38+
id: get_version
39+
shell: bash
40+
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)
41+
- name: Checking out sources
42+
uses: actions/checkout@v2
43+
with:
44+
submodules: 'recursive'
45+
- name: Install Python 3.9 version
46+
uses: actions/setup-python@v1
47+
with:
48+
python-version: '3.9'
49+
architecture: x64
50+
- name: Restoring submodules
51+
run: git submodule update --init
52+
# =========================================================================================================
53+
- name: Install MSVC compiler
54+
uses: ilammy/msvc-dev-cmd@v1
55+
with:
56+
# 14.1 is for vs2017, 14.2 is vs2019, following the upstream vcpkg build from Qv2ray-deps repo
57+
toolset: 14.2
58+
arch: x64
59+
- name: Cache Qt
60+
id: cache-qt
61+
uses: actions/cache@v1
62+
with:
63+
path: ../Qt
64+
key: QtCache-${{ matrix.platform }}-x64-${{ matrix.qt_version }}
65+
- name: Installing Qt - x64
66+
uses: jurplel/install-qt-action@v2
67+
with:
68+
version: ${{ matrix.qt_version }}
69+
arch: ${{ matrix.qtarch }}
70+
mirror: 'http://mirrors.ocf.berkeley.edu/qt/'
71+
cached: ${{ steps.cache-qt.outputs.cache-hit }}
72+
setup-python: 'false'
73+
74+
- name: Win-x64 - ${{ matrix.qt_version }} - Generate Dependencies and Build
75+
shell: bash
76+
env:
77+
CC: cl.exe
78+
CXX: cl.exe
79+
run: |
80+
cmake . \
81+
-GNinja \
82+
-DCMAKE_BUILD_TYPE=Release \
83+
-DLEMON_QT6=ON \
84+
-DLEMON_BUILD_INFO="Build for Windows" \
85+
-DLEMON_BUILD_EXTRA_INFO="Build on Windows x64" \
86+
-DENABLE_XLS_EXPORT=ON
87+
cmake --build . --parallel $(nproc)
88+
- name: package
89+
env:
90+
archiveName: lemon.${{ steps.get_version.outputs.VERSION }}.Windows-${{ matrix.arch }}
91+
shell: pwsh
92+
run: |
93+
# 创建文件夹
94+
New-Item -ItemType Directory ${env:archiveName}
95+
# 拷贝exe
96+
Copy-Item ${env:targetName} ${env:archiveName}\
97+
# 拷贝依赖
98+
windeployqt --qmldir . ${env:archiveName}\${env:targetName}
99+
# 打包zip
100+
Compress-Archive -Path ${env:archiveName} ${env:archiveName}'.zip'
101+
# 记录环境变量packageName给后续step
102+
$name = ${env:archiveName}
103+
echo "packageName=\"$name\"" >> $GITHUB_ENV
104+
# 打印环境变量packageName
105+
Write-Host 'packageName:'${env:packageName}
106+
- name: Upload artifact
107+
uses: actions/upload-artifact@v2-preview
108+
with:
109+
name: lemon-win-qt6-x64.zip
110+
path: ${{ env.packageName }}.zip
111+
- name: uploadRelease
112+
if: startsWith(github.event.ref, 'refs/tags/')
113+
uses: svenstaro/upload-release-action@v1-release
114+
with:
115+
repo_token: ${{ secrets.GITHUB_TOKEN }}
116+
file: ./${{ env.packageName }}.zip
117+
asset_name: lemon-win-qt6-x64.zip
118+
tag: ${{ github.ref }}
119+
overwrite: true

makespec/BUILDVERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
106
1+
107

0 commit comments

Comments
 (0)