Skip to content

Commit

Permalink
Merge pull request #163 from NekoSilverFox/MengJianing
Browse files Browse the repository at this point in the history
优化 CI/CD测试输出及打包名称
  • Loading branch information
nekosilverfox authored Apr 8, 2024
2 parents 52bdbf8 + f18b1a6 commit 7587191
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
21 changes: 11 additions & 10 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ jobs:
qt_ver: [6.2.2, 6.6.0]
qt_arch: [clang_64]
env:
targetName: PolyChat
# 在 Qt pro 文件中的 TARGET
QtApplicationName: App
AppTargetName: PolyChat
# .app 所处编译文件夹的路径
QtAppDirName: App
steps:
# macos 11.0 默认环境变了,要指定
- name: prepare env
Expand Down Expand Up @@ -61,30 +62,30 @@ jobs:
- name: Build on macOS
run: |
ls
cd ./${QtApplicationName}
cd ./${QtAppDirName}
qmake
make
# 打包
- name: Package on MacOS
run: |
cd ./${QtApplicationName}
# mv ./${QtApplicationName}/${QtApplicationName}.app .
cd ./${QtAppDirName}
# mv ./${QtAppDirName}/${AppTargetName}.app .
echo '------------------'
ls
# 拷贝依赖 pro文件里的名称:
macdeployqt ${QtApplicationName}.app -qmldir=. -verbose=1 -dmg
macdeployqt ${AppTargetName}.app -qmldir=. -verbose=1 -dmg
# 上传artifacts
- uses: actions/upload-artifact@v2
with:
name: ${{ env.targetName }}_${{ matrix.os }}_${{matrix.qt_ver}}.zip
path: ${{ env.QtApplicationName }}/${{ env.QtApplicationName }}.app
name: ${{ env.AppTargetName }}_${{ matrix.os }}_${{matrix.qt_ver}}.zip
path: ${{ env.QtAppDirName }}/${{ env.AppTargetName }}.app
# tag 上传Release
- name: Upload Release
if: startsWith(github.event.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.QtApplicationName }}/${{ env.QtApplicationName }}.dmg
asset_name: ${{ env.targetName }}_${{ matrix.os }}_${{ matrix.qt_ver }}.dmg
file: ${{ env.QtAppDirName }}/${{ env.AppTargetName }}.dmg
asset_name: ${{ env.AppTargetName }}_${{ matrix.os }}_${{ matrix.qt_ver }}.dmg
tag: ${{ github.ref }}
overwrite: true
2 changes: 1 addition & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
env:
targetName: PolyChat
# 在 Qt pro 文件中的
QtApplicationName: App.exe
QtApplicationName: PolyChat.exe
# 步骤
steps:
# 安装Qt
Expand Down
2 changes: 2 additions & 0 deletions App/App.pro
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

TARGET = PolyChat

RESOURCES += \
resource.qrc

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

//this->setWindowTitle(QString(tr("Chat %1 on port %2")).arg(name).arg(port)); // 注意:这里 .arg() 必须链式调用 不可以 .arg(name, port) 否则无法正常渲染。这是因为 如果想 .arg(name, port) 单次调用的话,必须保证参数类型一样,而这里是一个 QString 一个 qint16 类型,而链式调用就不存在这个问题
this->setWindowTitle(QString(tr("Chat %1 on port %2")).arg(name, QString::number(port)));


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

0 comments on commit 7587191

Please sign in to comment.