Skip to content

Commit 905e8d6

Browse files
committed
ci: update qt6 workflows
1 parent aed2330 commit 905e8d6

File tree

4 files changed

+138
-145
lines changed

4 files changed

+138
-145
lines changed

.github/workflows/MacOS.yml

Lines changed: 46 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,53 @@
1-
name: MacOS
2-
on:
3-
push:
4-
paths-ignore:
5-
- '*.md'
6-
pull_request:
7-
paths-ignore:
8-
- '*.md'
9-
jobs:
10-
build:
11-
name: Build
12-
runs-on: ${{ matrix.os }}
13-
strategy:
14-
matrix:
15-
os: [macos-10.15] # macos-10.14 macos-10.15, macos-11.0, macos-12.6 # https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md
16-
qt_ver: [5.15.2] # 参考: https://mirrors.cloud.tencent.com/qt/online/qtsdkrepository/mac_x64/desktop/qt5_5111
17-
qt_arch: [clang_64]
18-
env:
19-
targetName: ChineseChess
20-
targetOS: macos
21-
22-
steps:
23-
# macos 11.0 后默认环境变了,要指定
24-
- name: prepare env
25-
if: ${{ matrix.os == 'macos-11.0' }}
26-
run: |
27-
softwareupdate --all --install --force
28-
sudo xcode-select --print-path
29-
sudo xcode-select --switch /Library/Developer/CommandLineTools
30-
31-
- name: Install Qt
32-
uses: jurplel/install-qt-action@v3
33-
with:
34-
version: ${{ matrix.qt_ver }}
35-
1+
name: MacOS
2+
on:
3+
push:
4+
branches:
5+
- '**'
6+
tags:
7+
- 'v*'
8+
paths-ignore:
9+
- '*.md'
10+
pull_request:
11+
paths-ignore:
12+
- '*.md'
13+
jobs:
14+
build:
15+
name: Build
16+
runs-on: ${{ matrix.os }}
17+
strategy:
18+
matrix:
19+
os: [macos-14]
20+
qt_ver: ['6.7.2']
21+
qt_arch: [clang_64]
22+
env:
23+
targetName: ChineseChess
24+
targetOS: macos
25+
26+
steps:
27+
- name: Install Qt
28+
uses: jurplel/install-qt-action@v4
29+
with:
30+
version: ${{ matrix.qt_ver }}
31+
arch: ${{ matrix.qt_arch }}
32+
3633
- uses: actions/checkout@v4
3734
with:
3835
fetch-depth: 1
3936
submodules: true
4037

41-
- name: build macos
42-
run: |
43-
mkdir build
44-
cd build
45-
cmake ..
46-
make
47-
48-
echo "-------------- debug 1 --------------"
49-
pwd
50-
ls -al
51-
52-
echo "-------------- debug 2 --------------"
53-
cd bin
54-
ls -al
55-
38+
- name: Configure & Build
39+
run: |
40+
cmake -S . -B build -DCMAKE_PREFIX_PATH="$Qt6_DIR"
41+
cmake --build build --config Release -- -j$(sysctl -n hw.ncpu)
42+
43+
echo "-------------- debug 1 --------------"
44+
pwd
45+
ls -al
46+
47+
echo "-------------- debug 2 --------------"
48+
cd build/bin
49+
ls -al
50+
5651
- name: NameVersion
5752
id: NameVersion
5853
if: startsWith(github.event.ref, 'refs/tags/')
@@ -121,4 +116,4 @@ jobs:
121116
files: |
122117
${{ env.productName }}.dmg
123118
tag: ${{ github.ref }}
124-
overwrite: true
119+
overwrite: true

.github/workflows/Ubuntu_Deb.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: Ubuntu_DEB
22
on:
33
push:
4+
branches:
5+
- '**'
6+
tags:
7+
- 'v*'
48
paths-ignore:
59
- '*.md'
610
pull_request:
@@ -9,16 +13,11 @@ on:
913
jobs:
1014
build:
1115
name: Build
12-
# 运行平台, ubuntu-latest 目前是 Ubuntu 20.04
13-
# 参考文档 https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md
1416
runs-on: ${{ matrix.os }}
1517
strategy:
16-
matrix: # 矩阵配置
17-
qt_ver: [5.15.2] # 参考: https://mirrors.cloud.tencent.com/qt/online/qtsdkrepository/linux_x64/desktop/qt5_5152
18-
qt_target: [desktop]
19-
qt_arch: [gcc_64]
20-
arch: [amd64] # arm64
21-
os: [ubuntu-20.04]
18+
matrix:
19+
include:
20+
- os: ubuntu-24.04
2221
env:
2322
targetName: ChineseChess
2423
targetLowerName: chinesechess
@@ -53,7 +52,8 @@ jobs:
5352
run: |
5453
sudo apt clean
5554
sudo apt update
56-
sudo apt install vim wget tar dh-make debmake lintian cmake qtbase5-dev qt5-default libqt5svg5-dev qtmultimedia5-dev qttools5-dev libqt5x11extras5-dev
55+
sudo apt install -y vim wget tar dh-make debmake lintian cmake ninja-build libgl1-mesa-dev \
56+
qt6-base-dev qt6-tools-dev qt6-tools-dev-tools qt6-wayland-dev libqt6svg6-dev libqt6opengl6-dev
5757
5858
# tag 打包 .deb,无动态库
5959
- name: DebPackage
@@ -114,4 +114,4 @@ jobs:
114114
files: |
115115
../*.deb
116116
tag: ${{ github.ref }}
117-
overwrite: true
117+
overwrite: true

.github/workflows/ubuntu.yml

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: Ubuntu
22
on:
33
push:
4+
branches:
5+
- '**'
6+
tags:
7+
- 'v*'
48
paths-ignore:
59
- '*.md'
610
pull_request:
@@ -9,23 +13,20 @@ on:
913
jobs:
1014
build:
1115
name: Build
12-
# 运行平台, ubuntu-latest 目前是 Ubuntu 20.04
13-
# 参考文档 https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md
1416
runs-on: ${{ matrix.os }}
1517
strategy:
16-
matrix: # 矩阵配置
17-
qt_ver: [5.15.2] # 参考: https://mirrors.cloud.tencent.com/qt/online/qtsdkrepository/linux_x64/desktop/qt5_51211
18-
qt_target: [desktop]
19-
qt_arch: [gcc_64]
20-
arch: [arm64, amd64]
21-
os: [ubuntu-20.04] # ubuntu-18.04
18+
matrix:
19+
include:
20+
- os: ubuntu-24.04
21+
qt_ver: '6.7.2'
22+
qt_arch: gcc_64
2223
env:
2324
targetName: ChineseChess
2425
targetOS: debian
2526

2627
steps:
2728
- name: Install Qt
28-
uses: jurplel/install-qt-action@v3
29+
uses: jurplel/install-qt-action@v4
2930
with:
3031
version: ${{ matrix.qt_ver }}
3132
arch: ${{ matrix.qt_arch }}
@@ -36,14 +37,17 @@ jobs:
3637
fetch-depth: 1
3738
submodules: true
3839

40+
- name: Install build deps
41+
run: |
42+
sudo apt-get update
43+
sudo apt-get install -y ninja-build libgl1-mesa-dev libpulse-dev
44+
3945
- name: gcc build
4046
id: gcc-build
4147
shell: bash
4248
run: |
43-
mkdir build
44-
cd build
45-
cmake ..
46-
make
49+
cmake -S . -B build -GNinja -DCMAKE_PREFIX_PATH="$Qt6_DIR"
50+
cmake --build build
4751
4852
- name: NameVersion
4953
id: NameVersion
@@ -65,7 +69,11 @@ jobs:
6569
shell: bash
6670
run: |
6771
mkdir bin
68-
cp -r build/bin/${{ env.targetName }} bin
72+
target_path="build/bin/${{ env.targetName }}"
73+
if [ ! -f "$target_path" ]; then
74+
target_path="${{ github.workspace }}/bin/${{ env.targetName }}"
75+
fi
76+
cp "$target_path" bin/${{ env.targetName }}
6977
cp -r debian_portable/* bin
7078
7179
sudo chmod 777 bin/ldd.sh
@@ -88,4 +96,4 @@ jobs:
8896
files: |
8997
${{ env.productName }}.zip
9098
tag: ${{ github.ref }}
91-
overwrite: true
99+
overwrite: true

.github/workflows/windows.yml

Lines changed: 59 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,39 @@
1-
name: Windows
2-
on:
3-
push:
4-
paths-ignore:
5-
- '*.md'
6-
pull_request:
7-
paths-ignore:
8-
- '*.md'
9-
jobs:
10-
build:
11-
name: Build
12-
# 运行平台, windows-latest目前是windows server 2022
13-
# 参考文档 https://github.com/actions/runner-images/blob/main/images/windows/Windows2019-Readme.md https://github.com/actions/runner-images/issues/12045 https://github.com/arvidn/libtorrent/pull/7932
14-
runs-on: windows-latest
15-
strategy:
16-
# 矩阵配置
17-
matrix:
18-
qt_target: [desktop]
19-
include:
20-
# 5.15.2 参考 https://mirrors.cloud.tencent.com/qt/online/qtsdkrepository/windows_x86/desktop/qt5_5152/
21-
- qt_ver: 5.15.2
22-
qt_arch: win32_msvc2019
23-
msvc_arch: x86
24-
qt_arch_install: msvc2019
25-
- qt_ver: 5.15.2
26-
qt_arch: win64_msvc2019_64
27-
msvc_arch: x64
28-
qt_arch_install: msvc2019_64
29-
env:
30-
targetName: ChineseChess
31-
targetOS: windows
32-
33-
steps:
34-
- name: Install Qt
35-
uses: jurplel/install-qt-action@v3
36-
with:
37-
version: ${{ matrix.qt_ver }}
38-
arch: ${{ matrix.qt_arch }}
39-
set-env: true
40-
1+
name: Windows
2+
on:
3+
push:
4+
branches:
5+
- '**'
6+
tags:
7+
- 'v*'
8+
paths-ignore:
9+
- '*.md'
10+
pull_request:
11+
paths-ignore:
12+
- '*.md'
13+
jobs:
14+
build:
15+
name: Build
16+
# windows-2022 runners map to Windows 11 environments
17+
runs-on: ${{ matrix.os }}
18+
strategy:
19+
matrix:
20+
include:
21+
- os: windows-2022
22+
qt_ver: '6.7.2'
23+
qt_arch: win64_msvc2019_64
24+
msvc_arch: x64
25+
env:
26+
targetName: ChineseChess
27+
targetOS: windows
28+
29+
steps:
30+
- name: Install Qt
31+
uses: jurplel/install-qt-action@v4
32+
with:
33+
version: ${{ matrix.qt_ver }}
34+
arch: ${{ matrix.qt_arch }}
35+
set-env: true
36+
4137
- uses: actions/checkout@v4
4238
with:
4339
fetch-depth: 1
@@ -110,31 +106,24 @@ jobs:
110106
Write-Host "`n检查完成:未发现不可见Unicode字符。"
111107
}
112108
113-
- name: Inspect Qt
114-
shell: pwsh
115-
run: |
116-
Get-ChildItem -Recurse -Path $Env:Qt5_Dir
117-
118-
- name: msvc-build
119-
id: msvc-build
120-
shell: cmd
121-
run: |
122-
mkdir bin
123-
mkdir build
124-
125-
cd build
126-
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.msvc_arch }}
127-
128-
if "${{ matrix.msvc_arch }}" == "x86" (
129-
echo "-------------- x86 --------------"
130-
cmake -G "Visual Studio 17 2019" -A Win32 ..
131-
devenv "${{ env.targetName }}.sln" /Build "Release|Win32"
132-
) else (
133-
echo "-------------- x64 --------------"
134-
cmake -G "Visual Studio 16 2019" -A x64 ..
135-
devenv "${{ env.targetName }}.sln" /Build "Release|x64"
136-
)
137-
109+
- name: Inspect Qt
110+
shell: pwsh
111+
run: |
112+
Get-ChildItem -Recurse -Path $Env:Qt6_DIR
113+
114+
- name: Configure & Build (MSVC)
115+
id: msvc-build
116+
shell: cmd
117+
run: |
118+
mkdir bin
119+
mkdir build
120+
121+
cd build
122+
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.msvc_arch }}
123+
124+
cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_PREFIX_PATH="%Qt6_DIR%" ..
125+
cmake --build . --config Release
126+
138127
- name: name version
139128
id: name-version
140129
if: startsWith(github.event.ref, 'refs/tags/')
@@ -165,9 +154,10 @@ jobs:
165154
Compress-Archive -Path ${{ github.workspace }}/bin/* -Destination ${{ env.productName }}.zip
166155
dir ${{ github.workspace }}/bin
167156
168-
- uses: actions/upload-artifact@v3
169-
with:
170-
name: my-artifact
157+
- uses: actions/upload-artifact@v3
158+
if: startsWith(github.event.ref, 'refs/tags/')
159+
with:
160+
name: my-artifact
171161
path: ${{ env.productName }}.zip
172162

173163
# tag上传Release
@@ -182,4 +172,4 @@ jobs:
182172
files: |
183173
${{ env.productName }}.zip
184174
tag: ${{ github.ref }}
185-
overwrite: true
175+
overwrite: true

0 commit comments

Comments
 (0)