Skip to content

Commit e3b029d

Browse files
committed
[新增和更新GitHub Actions工作流以及依赖安装动作]: 引入了新的依赖安装动作,并更新了CMake和QMake构建工作流,以支持Qt 6.7.0版本和更一致的构建环境。
- 新增`install-dependencies`动作,支持跨平台的依赖安装,包括ninja, cmake, Qt 6.7.0等。 - 更新`cmake.yml`工作流,移除了对Qt版本的硬编码,现在使用`install-dependencies`动作来安装Qt,并优化了Windows, macOS, Ubuntu的构建步骤。 - 更新`delete_workflow.yml`工作流,修改了删除工作流的默认结论模式。 - 更新`qmake.yml`工作流,移除了对Qt版本的硬编码,并引入了`install-dependencies`动作以及`install-jom`动作。 - 更新`readme.yml`工作流,移除了对Node.js版本的指定。 - 更新`.gitignore`文件,添加了对Qt生成文件的忽略规则。 - 更新`settings.json`文件,调整了Qt版本路径。 - 更新`CMakeLists.txt`文件,升级了最低CMake版本要求,并引入了新的cmake模块。 - 新增`build_info.cmake`,`common.cmake`和`qt.cmake`文件,以支持更灵活的CMake配置。 - 更新跨平台打包脚本,调整了Qt版本和构建命令。 - 新增`setVsDev.ps1`脚本,用于设置Windows开发环境。
1 parent 6480e22 commit e3b029d

File tree

19 files changed

+323
-178
lines changed

19 files changed

+323
-178
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: 'Install Dependencies'
2+
description: 'Install qt environment and compile dependencies'
3+
inputs:
4+
os_name:
5+
description: 'os name'
6+
required: true
7+
type: string
8+
qt_modules:
9+
description: 'qt modules'
10+
required: false
11+
default: 'qtcharts qt5compat qtnetworkauth qtimageformats'
12+
type: string
13+
qt_ver:
14+
description: 'qt version'
15+
required: false
16+
default: '6.7.0'
17+
type: string
18+
19+
runs:
20+
using: 'composite'
21+
22+
steps:
23+
- name: Install dependencies on windows
24+
if: startsWith(runner.os, 'Windows')
25+
shell: bash
26+
run: |
27+
choco install ninja
28+
ninja --version
29+
cmake --version
30+
31+
- name: Install dependencies on macos
32+
if: startsWith(runner.os, 'macOS')
33+
shell: bash
34+
run: |
35+
brew install ninja
36+
ninja --version
37+
cmake --version
38+
clang --version
39+
40+
- name: Install dependencies on linux
41+
if: startsWith(runner.os, 'Linux')
42+
shell: bash
43+
run: |
44+
sudo apt-get update
45+
sudo apt-get install -y ninja-build build-essential libgl1-mesa-dev
46+
ninja --version
47+
cmake --version
48+
gcc --version
49+
50+
- name: Install Qt
51+
uses: jurplel/install-qt-action@v3
52+
with:
53+
version: ${{ inputs.qt_ver }}
54+
modules: ${{ inputs.qt_modules }}
55+
cache: 'true'

.github/workflows/cmake.yml

Lines changed: 21 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,22 @@ name: CMake Build
22

33
on:
44
push:
5-
paths-ignore: # 下列文件的变更不触发部署,可以自行添加
6-
- '.github/workflows/delete_workflow.yml'
7-
- '.github/workflows/qmake.yml'
8-
- '.github/workflows/readme.yml'
5+
paths-ignore:
96
- '**/picture/**'
107
- 'packaging/**'
11-
- '.clang-format'
8+
- '.clang-*'
129
- '.gitignore'
1310
- 'LICENSE'
11+
- '*.pro'
1412
- 'README*'
1513
pull_request:
16-
paths-ignore: # 下列文件的变更不触发部署,可以自行添加
17-
- '.github/workflows/delete_workflow.yml'
18-
- '.github/workflows/qmake.yml'
19-
- '.github/workflows/readme.yml'
14+
paths-ignore:
2015
- '**/picture/**'
2116
- 'packaging/**'
22-
- '.clang-format'
17+
- '.clang-*'
2318
- '.gitignore'
2419
- 'LICENSE'
20+
- '*.pro'
2521
- 'README*'
2622

2723
jobs:
@@ -35,73 +31,38 @@ jobs:
3531
- windows-latest
3632
- macos-latest
3733
- ubuntu-latest
38-
qt_ver:
39-
- 6.6.2
4034
build_type:
4135
- "RelWithDebInfo"
4236
generators:
4337
- "Ninja"
4438

4539
steps:
46-
- name: Install Qt
47-
uses: jurplel/install-qt-action@v3
48-
with:
49-
version: ${{ matrix.qt_ver }}
50-
install-deps: 'true'
51-
modules: 'addons.qtcharts addons.qtnetworkauth'
52-
cache: 'true'
53-
- name: Install dependencies on windows
54-
if: startsWith(matrix.os, 'windows')
55-
run: |
56-
choco install ninja
57-
ninja --version
58-
cmake --version
59-
- name: Install dependencies on macos
60-
if: startsWith(matrix.os, 'macos')
61-
run: |
62-
brew install ninja
63-
ninja --version
64-
cmake --version
65-
- name: Install dependencies on ubuntu
66-
if: startsWith(matrix.os, 'ubuntu')
67-
run: |
68-
sudo apt-get update
69-
sudo apt-get install -y ninja-build build-essential libgl1-mesa-dev
70-
ninja --version
71-
cmake --version
72-
gcc --version
7340
- uses: actions/checkout@v4
7441
with:
7542
fetch-depth: 1
7643

77-
- name: Enable Developer Command Prompt
78-
if: startsWith(matrix.os, 'windows')
79-
uses: ilammy/[email protected]
44+
- uses: ./.github/actions/install-dependencies
8045
with:
81-
arch: amd64
82-
- name: Configure windows
46+
os_name: ${{ matrix.os }}
47+
48+
- name: Configure and build windows
8349
if: startsWith(matrix.os, 'windows')
84-
shell: bash
50+
shell: pwsh
8551
run: |
86-
cmake \
87-
-S . \
88-
-B ./build \
89-
-DCMAKE_C_COMPILER=cl \
90-
-DCMAKE_CXX_COMPILER=cl \
91-
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
92-
-G "${{ matrix.generators }}" \
93-
-DCMAKE_INSTALL_PREFIX:PATH=instdir
94-
- name: Configure macos or ubuntu
95-
if: startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu')
52+
.\scripts\windows\setVsDev.ps1
53+
cmake `
54+
-S . `
55+
-B ./build `
56+
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} `
57+
-G "${{ matrix.generators }}"
58+
cmake --build ./build --config ${{ matrix.build_type }}
59+
- name: Configure and build on ubuntu or macos
60+
if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos')
9661
shell: bash
9762
run: |
9863
cmake \
9964
-S . \
10065
-B ./build \
10166
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
102-
-G "${{ matrix.generators }}" \
103-
-DCMAKE_INSTALL_PREFIX:PATH=instdir
104-
- name: Build
105-
shell: bash
106-
run: |
67+
-G "${{ matrix.generators }}"
10768
cmake --build ./build --config ${{ matrix.build_type }}

.github/workflows/delete_workflow.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ on:
2727
delete_run_by_conclusion_pattern:
2828
description: 'Remove runs based on conclusion: action_required, cancelled, failure, skipped, success'
2929
required: true
30-
default: "failure"
30+
default: "Unsuccessful: action_required,cancelled,failure,skipped"
3131
type: choice
3232
options:
3333
- "ALL"

.github/workflows/qmake.yml

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,22 @@ name: QMake Build
33
on:
44
push:
55
paths-ignore: # 下列文件的变更不触发部署,可以自行添加
6-
- '.github/workflows/cmake.yml'
7-
- '.github/workflows/delete_workflow.yml'
8-
- '.github/workflows/readme.yml'
96
- '**/picture/**'
7+
- 'cmake/**'
108
- 'packaging/**'
11-
- '.clang-format'
9+
- '.clang-*'
1210
- '.gitignore'
11+
- 'CMake*'
1312
- 'LICENSE'
1413
- 'README*'
1514
pull_request:
1615
paths-ignore: # 下列文件的变更不触发部署,可以自行添加
17-
- '.github/workflows/cmake.yml'
18-
- '.github/workflows/delete_workflow.yml'
19-
- '.github/workflows/readme.yml'
2016
- '**/picture/**'
17+
- 'cmake/**'
2118
- 'packaging/**'
22-
- '.clang-format'
19+
- '.clang-*'
2320
- '.gitignore'
21+
- 'CMake*'
2422
- 'LICENSE'
2523
- 'README*'
2624

@@ -35,36 +33,42 @@ jobs:
3533
- windows-2019
3634
- macos-latest
3735
- ubuntu-latest
38-
qt_ver:
39-
- 6.6.2
4036

4137
steps:
42-
- name: Install Qt
43-
uses: jurplel/install-qt-action@v3
44-
with:
45-
version: ${{ matrix.qt_ver }}
46-
install-deps: 'true'
47-
modules: 'addons.qtcharts addons.qtnetworkauth'
48-
cache: 'true'
49-
- name: ubuntu install GL library
50-
if: startsWith(matrix.os, 'ubuntu')
51-
run: |
52-
sudo apt-get update
53-
sudo apt-get install -y build-essential libgl1-mesa-dev
5438
- uses: actions/checkout@v4
55-
with:
39+
with:
5640
fetch-depth: 1
41+
42+
- uses: ./.github/actions/install-dependencies
43+
with:
44+
os_name: ${{ matrix.os }}
45+
46+
- uses: RealChuan/install-jom@main
47+
48+
- name: mkdir build
49+
shell: bash
50+
run: |
51+
mkdir build
5752
5853
- name: msvc-build
5954
if: startsWith(matrix.os, 'windows')
60-
shell: cmd
55+
shell: pwsh
56+
run: |
57+
..\scripts\windows\setVsDev.ps1 -VersionRange "[16.0,17.0)" -Arch "x64"
58+
& qmake ./../.
59+
& jom
60+
working-directory: build
61+
- name: ubuntu-build
62+
if: startsWith(matrix.os, 'ubuntu')
63+
shell: bash
6164
run: |
62-
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
63-
qmake
64-
nmake
65-
- name: build macos or ubuntu
66-
if: startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu')
65+
qmake ./../.
66+
make -j $(nproc)
67+
working-directory: build
68+
- name: macos-build
69+
if: startsWith(matrix.os, 'macos')
6770
shell: bash
6871
run: |
69-
qmake
70-
make -j4
72+
qmake ./../.
73+
make -j $(sysctl -n hw.ncpu)
74+
working-directory: build

.github/workflows/readme.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ jobs:
1515
- uses: actions/checkout@v4
1616
- name: Setup Node.js
1717
uses: actions/setup-node@v4
18-
with:
19-
node-version: 12.x
2018
# ISO Langusge Codes: https://cloud.google.com/translate/docs/languages
2119
- name: Adding README - English
2220
uses: dephraiim/translate-readme@main

0 commit comments

Comments
 (0)