Skip to content

Commit 7587191

Browse files
Merge pull request #163 from NekoSilverFox/MengJianing
优化 CI/CD测试输出及打包名称
2 parents 52bdbf8 + f18b1a6 commit 7587191

File tree

4 files changed

+17
-12
lines changed

4 files changed

+17
-12
lines changed

.github/workflows/macos.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ jobs:
2020
qt_ver: [6.2.2, 6.6.0]
2121
qt_arch: [clang_64]
2222
env:
23-
targetName: PolyChat
2423
# 在 Qt pro 文件中的 TARGET
25-
QtApplicationName: App
24+
AppTargetName: PolyChat
25+
# .app 所处编译文件夹的路径
26+
QtAppDirName: App
2627
steps:
2728
# macos 11.0 默认环境变了,要指定
2829
- name: prepare env
@@ -61,30 +62,30 @@ jobs:
6162
- name: Build on macOS
6263
run: |
6364
ls
64-
cd ./${QtApplicationName}
65+
cd ./${QtAppDirName}
6566
qmake
6667
make
6768
# 打包
6869
- name: Package on MacOS
6970
run: |
70-
cd ./${QtApplicationName}
71-
# mv ./${QtApplicationName}/${QtApplicationName}.app .
71+
cd ./${QtAppDirName}
72+
# mv ./${QtAppDirName}/${AppTargetName}.app .
7273
echo '------------------'
7374
ls
7475
# 拷贝依赖 pro文件里的名称:
75-
macdeployqt ${QtApplicationName}.app -qmldir=. -verbose=1 -dmg
76+
macdeployqt ${AppTargetName}.app -qmldir=. -verbose=1 -dmg
7677
# 上传artifacts
7778
- uses: actions/upload-artifact@v2
7879
with:
79-
name: ${{ env.targetName }}_${{ matrix.os }}_${{matrix.qt_ver}}.zip
80-
path: ${{ env.QtApplicationName }}/${{ env.QtApplicationName }}.app
80+
name: ${{ env.AppTargetName }}_${{ matrix.os }}_${{matrix.qt_ver}}.zip
81+
path: ${{ env.QtAppDirName }}/${{ env.AppTargetName }}.app
8182
# tag 上传Release
8283
- name: Upload Release
8384
if: startsWith(github.event.ref, 'refs/tags/')
8485
uses: svenstaro/upload-release-action@v2
8586
with:
8687
repo_token: ${{ secrets.GITHUB_TOKEN }}
87-
file: ${{ env.QtApplicationName }}/${{ env.QtApplicationName }}.dmg
88-
asset_name: ${{ env.targetName }}_${{ matrix.os }}_${{ matrix.qt_ver }}.dmg
88+
file: ${{ env.QtAppDirName }}/${{ env.AppTargetName }}.dmg
89+
asset_name: ${{ env.AppTargetName }}_${{ matrix.os }}_${{ matrix.qt_ver }}.dmg
8990
tag: ${{ github.ref }}
9091
overwrite: true

.github/workflows/windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
env:
3737
targetName: PolyChat
3838
# 在 Qt pro 文件中的
39-
QtApplicationName: App.exe
39+
QtApplicationName: PolyChat.exe
4040
# 步骤
4141
steps:
4242
# 安装Qt

App/App.pro

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ qnx: target.path = /tmp/$${TARGET}/bin
4444
else: unix:!android: target.path = /opt/$${TARGET}/bin
4545
!isEmpty(target.path): INSTALLS += target
4646

47+
TARGET = PolyChat
48+
4749
RESOURCES += \
4850
resource.qrc
4951

App/uil_chatboxwidget.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ ChatBoxWidget::ChatBoxWidget(QWidget* parent, QString name, qint16 port)
2323
ui->setupUi(this);
2424
this->setAttribute(Qt::WA_DeleteOnClose);
2525
this->setWindowIcon(QIcon(":/icon/icons/user-group.png"));
26-
this->setWindowTitle(QString(tr("Chat %1 on port %2")).arg(name).arg(port)); // 注意:这里 .arg() 必须链式调用 不可以 .arg(name, port) 否则无法正常渲染。这是因为 如果想 .arg(name, port) 单次调用的话,必须保证参数类型一样,而这里是一个 QString 一个 qint16 类型,而链式调用就不存在这个问题
26+
27+
//this->setWindowTitle(QString(tr("Chat %1 on port %2")).arg(name).arg(port)); // 注意:这里 .arg() 必须链式调用 不可以 .arg(name, port) 否则无法正常渲染。这是因为 如果想 .arg(name, port) 单次调用的话,必须保证参数类型一样,而这里是一个 QString 一个 qint16 类型,而链式调用就不存在这个问题
28+
this->setWindowTitle(QString(tr("Chat %1 on port %2")).arg(name, QString::number(port)));
2729

2830

2931
/* 对所有窗口的同样地址广播 8888 (告诉 ChatList 本窗口存在) */

0 commit comments

Comments
 (0)