From b0b05b456c0c0e4e3a817665733a5bc49cbab348 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 23 Jan 2026 05:48:28 +0000 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20MSVC=20?= =?UTF-8?q?=E5=92=8C=20MinGW=20workflow=20=E4=B8=AD=E5=8F=AF=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E6=96=87=E4=BB=B6=E6=9C=AA=E4=B8=8A=E4=BC=A0=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 修改内容 ### MSVC Workflow - 添加文件列表调试步骤,显示构建和安装目录的内容 - 扩展 artifacts 上传路径,包含: - build/Release/*.exe (多配置生成器产生的可执行文件) - build/Release/*.dll (运行时库) - build/src/tools/Release/*.exe (工具可执行文件) ### MinGW Workflow - 添加 `cmake --install build` 步骤,将产物安装到 install 目录 - 修改 CMAKE_INSTALL_PREFIX 从 /usr 改为 $PWD/install - 添加文件列表调试步骤 - 更新 artifacts 上传路径为: - install/** (安装后的所有文件,包含 bin/, lib/, share/ 等) - build/src/tools/*.exe (备用,直接从构建目录上传可执行文件) - 测试相关文件 (Testing/**, ctest.log) ## 问题分析 原问题:opencc.exe、opencc_dict.exe 等关键产物未被上传 ### MSVC - Windows 多配置生成器将产物放在 build/Release/ 而不是根目录 bin/ - 虽然 build.cmd 执行了 install,但需要验证实际安装路径 ### MinGW - 缺少 install 步骤,产物留在 build/src/tools/ 深层目录 - 上传 build/** 包含大量不必要的中间文件 ## 验证方式 下次 workflow 运行时,查看 "list installed files" 步骤的输出, 确认 opencc.exe 等文件的实际位置,如需进一步调整可根据日志修正路径。 https://claude.ai/code/session_DH6D6 --- .github/workflows/mingw.yml | 15 +++++++++++++-- .github/workflows/msvc.yml | 15 +++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/.github/workflows/mingw.yml b/.github/workflows/mingw.yml index 6a2885df1..63dd744be 100644 --- a/.github/workflows/mingw.yml +++ b/.github/workflows/mingw.yml @@ -26,18 +26,29 @@ jobs: CC=/mingw64/bin/cc CXX=/mingw64/bin/c++ cmake \ -B build -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_INSTALL_PREFIX=$PWD/install \ -DENABLE_GTEST=ON \ -DBUILD_SHARED_LIBS=OFF cmake --build build + cmake --install build - name: Run test run: | cd build ctest + - name: list installed files + if: ${{ always() }} + run: | + echo "=== Contents of install directory ===" + if [ -d install ]; then find install -type f; fi + echo -e "\n=== Contents of build/src/tools directory ===" + if [ -d build/src/tools ]; then find build/src/tools -name "*.exe" -o -name "opencc*"; fi - name: upload artifacts if: ${{ always() }} uses: actions/upload-artifact@v4 with: name: opencc-mingw path: | - build/** + install/** + build/src/tools/*.exe + build/Testing/** + build/ctest.log diff --git a/.github/workflows/msvc.yml b/.github/workflows/msvc.yml index bbbed3a0d..8ecc409fa 100644 --- a/.github/workflows/msvc.yml +++ b/.github/workflows/msvc.yml @@ -28,6 +28,18 @@ jobs: run: ./build.cmd - name: test run: ./test.cmd + - name: list installed files + if: ${{ always() }} + shell: pwsh + run: | + Write-Host "=== Contents of bin directory ===" + if (Test-Path bin) { Get-ChildItem bin -Recurse | Select-Object FullName } + Write-Host "`n=== Contents of lib directory ===" + if (Test-Path lib) { Get-ChildItem lib -Recurse | Select-Object FullName } + Write-Host "`n=== Contents of build/Release directory ===" + if (Test-Path build/Release) { Get-ChildItem build/Release | Select-Object FullName } + Write-Host "`n=== Contents of build/src/tools directory ===" + if (Test-Path build/src/tools) { Get-ChildItem build/src/tools -Recurse | Select-Object FullName } - name: upload artifacts if: ${{ always() }} uses: actions/upload-artifact@v4 @@ -38,5 +50,8 @@ jobs: lib/** share/** include/** + build/Release/*.exe + build/Release/*.dll + build/src/tools/Release/*.exe build/ctest.log build/Testing/** From adedea3975f7bbbaeca86351c7431cf9f44b1b63 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 23 Jan 2026 06:11:06 +0000 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=20artifacts=20?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E7=A1=AE=E4=BF=9D=E5=8C=85=E5=90=AB=20.ocd2?= =?UTF-8?q?=20=E5=AD=97=E5=85=B8=E5=92=8C=20.json=20=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 修改内容 ### MSVC Workflow 根据安装日志,文件实际安装在 build/ 子目录下: - `build/bin/` - 可执行文件和 DLL - `build/lib/` - 静态库和 CMake 配置 - `build/share/opencc/` - 所有 .ocd2 字典和 .json 配置文件 - `build/include/` - 头文件 更新 artifacts 上传路径: - 从根目录 `bin/**`, `lib/**`, `share/**`, `include/**` - 改为 `build/bin/**`, `build/lib/**`, `build/share/**`, `build/include/**` - 移除冗余的 `build/Release/*.exe` 等备用路径 更新调试步骤: - 列出 build/bin, build/lib, build/share, build/include 的内容 ### MinGW Workflow 已通过 `cmake --install` 安装到 install/ 目录,上传 `install/**` 包含所有必需文件。 更新调试步骤: - 单独列出 install/bin/ 和 install/share/opencc/ 以便快速验证 - 保留完整文件列表供详细检查 ## 重要说明 **share/opencc/** 目录包含运行时必需的文件: - *.ocd2 - 字典文件(STCharacters, STPhrases, TWVariants 等) - *.json - 配置文件(s2t.json, t2s.json, s2tw.json 等) 没有这些文件,opencc.exe 无法正常工作。 https://claude.ai/code/session_DH6D6 --- .github/workflows/mingw.yml | 8 +++++--- .github/workflows/msvc.yml | 27 ++++++++++++--------------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/.github/workflows/mingw.yml b/.github/workflows/mingw.yml index 63dd744be..6ee1bccab 100644 --- a/.github/workflows/mingw.yml +++ b/.github/workflows/mingw.yml @@ -38,10 +38,12 @@ jobs: - name: list installed files if: ${{ always() }} run: | - echo "=== Contents of install directory ===" + echo "=== Contents of install/bin ===" + if [ -d install/bin ]; then ls -lh install/bin/; fi + echo -e "\n=== Contents of install/share/opencc ===" + if [ -d install/share/opencc ]; then ls -lh install/share/opencc/; fi + echo -e "\n=== All installed files ===" if [ -d install ]; then find install -type f; fi - echo -e "\n=== Contents of build/src/tools directory ===" - if [ -d build/src/tools ]; then find build/src/tools -name "*.exe" -o -name "opencc*"; fi - name: upload artifacts if: ${{ always() }} uses: actions/upload-artifact@v4 diff --git a/.github/workflows/msvc.yml b/.github/workflows/msvc.yml index 8ecc409fa..cf05c45d6 100644 --- a/.github/workflows/msvc.yml +++ b/.github/workflows/msvc.yml @@ -32,26 +32,23 @@ jobs: if: ${{ always() }} shell: pwsh run: | - Write-Host "=== Contents of bin directory ===" - if (Test-Path bin) { Get-ChildItem bin -Recurse | Select-Object FullName } - Write-Host "`n=== Contents of lib directory ===" - if (Test-Path lib) { Get-ChildItem lib -Recurse | Select-Object FullName } - Write-Host "`n=== Contents of build/Release directory ===" - if (Test-Path build/Release) { Get-ChildItem build/Release | Select-Object FullName } - Write-Host "`n=== Contents of build/src/tools directory ===" - if (Test-Path build/src/tools) { Get-ChildItem build/src/tools -Recurse | Select-Object FullName } + Write-Host "=== Contents of build/bin directory ===" + if (Test-Path build/bin) { Get-ChildItem build/bin -Recurse | Select-Object FullName } + Write-Host "`n=== Contents of build/lib directory ===" + if (Test-Path build/lib) { Get-ChildItem build/lib -Recurse | Select-Object FullName } + Write-Host "`n=== Contents of build/share directory ===" + if (Test-Path build/share) { Get-ChildItem build/share -Recurse | Select-Object FullName } + Write-Host "`n=== Contents of build/include directory ===" + if (Test-Path build/include) { Get-ChildItem build/include -Recurse | Select-Object FullName } - name: upload artifacts if: ${{ always() }} uses: actions/upload-artifact@v4 with: name: opencc-msvc-${{ matrix.arch }} path: | - bin/** - lib/** - share/** - include/** - build/Release/*.exe - build/Release/*.dll - build/src/tools/Release/*.exe + build/bin/** + build/lib/** + build/share/** + build/include/** build/ctest.log build/Testing/**