Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 21 additions & 13 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ jobs:
strategy:
matrix:
builder: [pyinstaller, nuitka]
env:
PYTHONOPTIMIZATION: 2
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

问题 (typo): 环境变量名称可能存在拼写错误。

'PYTHONOPTIMIZATION' 应为 'PYTHONOPTIMIZE' 以设置 Python 优化级别;否则,此变量将无效。

Suggested change
env:
PYTHONOPTIMIZATION: 2
env:
PYTHONOPTIMIZE: 2
Original comment in English

issue (typo): Possible typo in environment variable name.

'PYTHONOPTIMIZATION' should be 'PYTHONOPTIMIZE' to set the Python optimization level; otherwise, this variable will not have any effect.

Suggested change
env:
PYTHONOPTIMIZATION: 2
env:
PYTHONOPTIMIZE: 2

runs-on: windows-latest
steps:
- name: Checkout code
Expand All @@ -33,12 +35,15 @@ jobs:

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements.txt
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

建议 (bug_risk): 硬编码 'python3' 可能会在 Windows 运行器上导致问题。

在 Windows 上,'python3' 可能不可用;使用 'python' 可以提高跨平台兼容性。

Suggested change
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements.txt
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
Original comment in English

suggestion (bug_risk): Hardcoding 'python3' may cause issues on Windows runners.

On Windows, 'python3' may not be available; using 'python' improves cross-platform compatibility.

Suggested change
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements.txt
python -m pip install --upgrade pip
python -m pip install -r requirements.txt


- name: Download External Data Release
id: download_data
run: |
mkdir data
cd data
touch __init__.py
# 获取 LiteLoaderQQNT 的最新版本
$LLtag = (Invoke-RestMethod -Uri "https://api.github.com/repos/LiteLoaderQQNT/LiteLoaderQQNT/releases/latest").tag_name
echo "LLtag=$LLtag" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
Expand All @@ -51,35 +56,38 @@ jobs:
curl -L -o "list-viewer-${LVtag}.zip" "https://github.com/ltxhhz/LL-plugin-list-viewer/releases/download/${LVtag}/list-viewer.zip"

dir
cd ..

- name: Restore Cache
uses: actions/cache/restore@v4
if: matrix.builder == 'nuitka'
with:
path: nuitka_cache
key: nuitka-cache
restore-keys: nuitka-
path: |
${{ matrix.builder }}_cache
dist
key: ${{ matrix.builder }}-cache-${{ github.run_number }}
restore-keys: ${{ matrix.builder }}-cache-

- name: Build by ${{ matrix.builder }}
env:
LLtag: ${{ env.LLtag }}
LVtag: ${{ env.LVtag }}
run: |
python -m pip install ${{ matrix.builder }}
# python3 -m pip install ${{ matrix.builder }}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

问题 (bug_risk): 构建器安装被注释掉了。

如果构建器尚未安装,这可能会导致构建失败。

Original comment in English

issue (bug_risk): Builder installation is commented out.

If the builder is not already installed, this may cause the build to fail.


if ('${{ matrix.builder }}' -eq 'nuitka') {
$env:NUITKA_CACHE_DIR = "nuitka_cache"
nuitka --onefile --windows-uac-admin --include-data-files="LiteLoaderQQNT-$($env:LLtag).zip"="./" --include-data-files="list-viewer-$($env:LVtag).zip"="./" install_windows.py --output-dir="dist" --output-file="install_windows_nuitka" --assume-yes-for-downloads --enable-plugins="tk-inter" --enable-console --mingw64
nuitka --onefile --windows-uac-admin --include-raw-dir="data/"="data/" install_windows.py --output-dir="dist" --output-file="install_windows_nuitka" --assume-yes-for-downloads --enable-plugins="tk-inter" --windows-console-mode=force --mingw64 --lto=yes
} else {
pyinstaller --onefile --uac-admin --add-data "LiteLoaderQQNT-$($env:LLtag).zip:." --add-data "list-viewer-$($env:LVtag).zip:." install_windows.py --distpath dist --name install_windows_pyinstaller
pyinstaller --onefile --uac-admin --add-data "data/:data/" install_windows.py --distpath dist --name install_windows_pyinstaller
}

- name: Save Cache
uses: actions/cache/save@v4
if: matrix.builder == 'nuitka'
with:
path: nuitka_cache
key: nuitka-cache
path: |
${{ matrix.builder }}_cache
dist
key: ${{ matrix.builder }}-cache-${{ github.run_number }}

- name: Upload install_windows_${{ matrix.builder }}.exe
uses: actions/upload-artifact@v4
Expand All @@ -90,7 +98,7 @@ jobs:
- name: Download and Install QQ Software
run: |
# Download QQ software
python3 -m pip install requests
# python3 -m pip install requests
python3 get_qqnt.py QQInstaller.exe windows ntDownloadX64Url
# Install QQ silently
Start-Process -FilePath QQInstaller.exe -ArgumentList '/S' -Wait
Expand Down
Loading
Loading