Skip to content

Commit 2ed4e15

Browse files
authored
Dev (#23)
* Update dev_package_and_upload.yml (#17) * 更新 NetEase_Cloud_Music_Download * sync (#19) * Update dev_package_and_upload.yml * Update README.md * update nuitka_build.py * Update pyinstaller_package_and_release.yml * Update nuitka_package_release.yml * Update nuitka_build.py * 更新 NetEase_Cloud_Music_Download (#18) * Update dev_package_and_upload.yml (#17) * 更新 NetEase_Cloud_Music_Download * 更新依赖项,添加psutil和astropy库 * 添加favicon.ico图标文件,并在配置中启用UPX压缩 * Nuitka Build 启用多核并行编译 * test cache * 删去错误版本信息 * fix dev_package_and_upload.yml
1 parent 0070b16 commit 2ed4e15

3 files changed

Lines changed: 44 additions & 5 deletions

File tree

.github/workflows/dev_package_and_upload.yml

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ on:
99
- 'package/nuitka_config.yml'
1010

1111
jobs:
12-
package-and-upload:
12+
package-and-release:
1313
runs-on: windows-latest
14+
env:
15+
PYTHON_VERSION: 3.10
16+
NUITKA_CACHE_DIR: ${{ github.workspace }}/nuitka-cache
1417

1518
# 添加必要的权限
1619
permissions:
@@ -23,17 +26,42 @@ jobs:
2326

2427
- name: Checkout code
2528
uses: actions/checkout@v4
29+
30+
2631

2732
- name: Set up Python
2833
uses: actions/setup-python@v5
2934
with:
30-
python-version: '3.10'
31-
35+
python-version: ${{ env.PYTHON_VERSION }}
36+
37+
- name: Cache UPX
38+
id: cache-upx
39+
uses: actions/cache@v4
40+
with:
41+
path: upx
42+
key: ${{ runner.os }}-${{ runner.arch }}-upx-v5.0.1
43+
restore-keys: |
44+
${{ runner.os }}-${{ runner.arch }}-upx-
45+
3246
- name: UPX Setup
47+
if: ${{ steps.cache-upx.outputs.cache-hit != 'true' }
3348
run: |
3449
mkdir upx
3550
curl -o upx/upx.exe https://assets.ksable.top/github/upx/upx/v5.0.1/windows-amd64/upx.exe
3651
52+
- name: get pip cache dir
53+
id: pip-cache-dir
54+
run: echo "pip-cache-dir=$(pip cache dir)" >> $env:GITHUB_OUTPUT
55+
56+
- name: pip cache
57+
uses: actions/cache@v4
58+
with:
59+
path: ${{ steps.pip-cache-dir.outputs.dir }} # pip缓存路径
60+
key: ${{ runner.os }}-${{ runner.arch }}-pip-${{ hashFiles('package/nuitka_build.py') }}
61+
restore-keys: |
62+
${{ runner.os }}-${{ runner.arch }}-pip- # 后备恢复键(当精确键不存在时,使用最近的缓存)
63+
64+
3765
- name: Install dependencies
3866
run: |
3967
python -m pip install --upgrade pip
@@ -53,6 +81,15 @@ jobs:
5381
# # 设置控制台编码为UTF-8
5482
# chcp.com 65001
5583

84+
- name: Cache Nuitka cache directory
85+
uses: actions/cache@v4
86+
with:
87+
path: ${{ env.NUITKA_CACHE_DIR }}
88+
key: nuitka-${{ runner.os }}-${{ runner.arch }}-python-${{ env.PYTHON_VERSION }}-nuitka-${{ hashFiles('package/nuitka_build.py') }}
89+
restore-keys: |
90+
nuitka-${{ runner.os }}-${{ runner.arch }}-python-${{ env.PYTHON_VERSION }}-
91+
nuitka-${{ runner.os }}-${{ runner.arch }}-
92+
5693
- name: Run packaging script
5794
run: |
5895
# 设置Python使用UTF-8编码

novel_crawler/novel_crawler_v.25.07.08.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ def download_chapter(chapter_info, progress, task_id, chapter_count):
417417

418418
# 主函数开始
419419
def main():
420-
print_header("小说爬虫工具\n版本 v.25.07.07")
420+
print_header("小说爬虫工具")
421421

422422
if debug:
423423
logger.debug("Debug模式已开启")

package/nuitka_build.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,14 @@ def main():
2626

2727
print(f"当前操作系统: {Machine} {arrch}")
2828
print(f"平台详情: {platform.platform()}")
29+
print("CPU核心数:", os.cpu_count())
2930
print(f"Python版本: {sys.version}")
3031

3132
# 解析命令行参数
3233
parser = argparse.ArgumentParser(description='Nuitka打包脚本')
3334
parser.add_argument('config', help='配置文件路径')
3435
args = parser.parse_args()
35-
36+
cpu_count=os.cpu_count()
3637
# 读取配置文件
3738
with open(args.config, 'r', encoding='utf-8') as f:
3839
config = yaml.safe_load(f)
@@ -92,6 +93,7 @@ def main():
9293
'--onefile', # 单文件
9394
'--standalone',
9495
'--mingw64',
96+
f'--jobs={os.cpu_count()}', # 多线程
9597
# '--mode',
9698
'--assume-yes-for-downloads', #自动下载外部代码
9799
# '--show-memory'

0 commit comments

Comments
 (0)