Skip to content
Merged

Dev #28

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
8e73a33
Update dev_package_and_upload.yml (#17)
God-2077 Jul 8, 2025
e0f9d10
更新 NetEase_Cloud_Music_Download
God-2077 Jul 8, 2025
4e7652a
sync (#19)
God-2077 Jul 8, 2025
cbc2deb
更新依赖项,添加psutil和astropy库
God-2077 Jul 8, 2025
77a6a2b
添加favicon.ico图标文件,并在配置中启用UPX压缩
God-2077 Jul 8, 2025
2b4ec59
Merge branch 'main' into dev
God-2077 Jul 8, 2025
571e1ee
Nuitka Build 启用多核并行编译
God-2077 Jul 8, 2025
8ab03e6
test cache
God-2077 Jul 8, 2025
117f181
删去错误版本信息
God-2077 Jul 8, 2025
ef83c93
fix dev_package_and_upload.yml
God-2077 Jul 8, 2025
63c3af4
fix dev_package_and_upload.yml
God-2077 Jul 8, 2025
3b306ad
fix dev_package_and_upload.yml pip-cache-dir
God-2077 Jul 8, 2025
92f2afe
Update dev_package_and_upload.yml fix type
God-2077 Jul 8, 2025
34541ce
添加对插件的支持,更新配置文件以启用UPX插件和自定义命令
God-2077 Jul 9, 2025
c673c96
禁用 Nuitka Package and Upload(dev) 自动流程,启用手动触发,添加测试流程
God-2077 Jul 9, 2025
b20d849
fix Nuitka Package and Upload(dev)
God-2077 Jul 9, 2025
6ecca80
try fix nuitka_build.py
God-2077 Jul 9, 2025
98eb78f
Nuitka Package and Upload(dev) update upx installer and use more os b…
God-2077 Jul 9, 2025
baf984c
Nuitka Package and Upload(dev) fix value
God-2077 Jul 9, 2025
8ab54fc
Nuitka Package and Upload(dev) fix Timezone
God-2077 Jul 9, 2025
b4133b4
update
God-2077 Jul 9, 2025
5567aa9
update nuitka 兼容Linux Windows平台
God-2077 Jul 9, 2025
c2404a4
remove windows-11-arm
God-2077 Jul 9, 2025
0b65153
update
God-2077 Jul 9, 2025
367ca79
more option
God-2077 Jul 9, 2025
077c594
fix artifact upload
God-2077 Jul 9, 2025
cb08bea
update Package
God-2077 Jul 9, 2025
5bcd5a0
Merge branch 'main' into dev
God-2077 Jul 9, 2025
d9dbaeb
fix workflows name and fix nuitka_build.py
God-2077 Jul 9, 2025
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
153 changes: 135 additions & 18 deletions .github/workflows/dev_package_and_upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,120 @@ name: Nuitka Package and Upload(dev)

on:
workflow_dispatch:
push:
branches:
- dev
paths:
- 'package/nuitka_config.yml'
inputs:
test:
description: '测试'
required: true
type: boolean
default: true
config_path:
description: '测试模式时用的配置文件路径(非测试时请忽略)'
required: true
type: string
default: 'package/nuitka_test_config.yml'
# push:
# branches:
# - dev
# paths:
# - 'package/nuitka_config.yml'

jobs:
package-and-upload:
runs-on: windows-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest,ubuntu-24.04-arm,windows-latest] # windows-11-arm没有对应的 Python
env:
PYTHON_VERSION: '3.10'
NUITKA_CACHE_DIR: ${{ github.workspace }}/nuitka-cache
UPXVERSION: '5.0.1'

# 添加必要的权限
permissions:
contents: write # 允许创建发布和上传资源

steps:
- name: Set Timezone to China Standard Time
run: tzutil /s "China Standard Time"
shell: pwsh

- name: Checkout code
uses: actions/checkout@v4

- name: Set Timezone to China Standard Time on Windows
if: ${{ runner.os == 'Windows' }}
run: tzutil /s "China Standard Time"
shell: pwsh

- name: Set Timezone to China Standard Time on Linux
if: ${{ runner.os == 'Linux' }}
run: sudo timedatectl set-timezone Asia/Shanghai


- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: ${{ env.PYTHON_VERSION }}

- name: Cache UPX
id: cache-upx
uses: actions/cache@v4
with:
path: upx
key: ${{ runner.os }}-${{ runner.arch }}-upx-v${{ env.UPXVERSION }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-upx-

- name: Create UPX directory
if: ${{ steps.cache-upx.outputs.cache-hit != 'true' }}
run: mkdir -p ./upx

- name: Install UPX on Linux
if: ${{ runner.os == 'Linux' && steps.cache-upx.outputs.cache-hit != 'true' }}
run: |

UPX_URL="https://github.com/upx/upx/releases/download/v${{ env.UPXVERSION }}/upx-${{ env.UPXVERSION }}-${{ runner.arch == 'X64' && 'amd64' || 'arm64' }}_linux.tar.xz"
curl -L "$UPX_URL" -o upx.tar.xz
tar -xf upx.tar.xz -C ./upx --strip-components=1
chmod +x ./upx/upx

shell: bash

- name: Install UPX on Windows
if: ${{ runner.os == 'Windows' && steps.cache-upx.outputs.cache-hit != 'true' }}
run: |
$arch = if (("${{ runner.arch }}" -eq "amd64") -or ("${{ runner.arch }}" -eq "X64")) { "win64" } else { "win32" }
$upxVersion = "${{ env.UPXVERSION }}"
$upxUrl = "https://github.com/upx/upx/releases/download/v$upxVersion/upx-$upxVersion-$arch.zip"

Invoke-WebRequest -Uri $upxUrl -OutFile upx.zip
Expand-Archive -Path upx.zip -DestinationPath ./upx -Force

# Windows 版本的 UPX 解压后在子目录中,需要移动到根目录
Move-Item -Path "./upx/upx-$upxVersion-$arch/*" -Destination ./upx -Force

shell: pwsh

- name: UPX Setup
- name: Verify UPX installation
run: |
mkdir upx
curl -o upx/upx.exe https://assets.ksable.top/github/upx/upx/v5.0.1/windows-amd64/upx.exe
./upx/upx --version
shell: bash

- name: get pip cache dir on Windows
if: ${{ runner.os == 'Windows' }}
id: pip-cache-dir-window
run: echo "pip-cache-dir=$(pip cache dir)" >> $env:GITHUB_OUTPUT

- name: get pip cache dir on Linux
if: ${{ runner.os == 'Linux' }}
id: pip-cache-dir-linux
run: echo "pip-cache-dir=$(pip cache dir)" >> $GITHUB_OUTPUT

- name: pip cache
uses: actions/cache@v4
with:
path: ${{ runner.os == 'Windows' && steps.pip-cache-dir-window.outputs.pip-cache-dir || steps.pip-cache-dir-linux.outputs.pip-cache-dir }}
key: ${{ runner.os }}-${{ runner.arch }}-pip-${{ github.event.inputs.test && hashFiles(github.event.inputs.config_path) || hashFiles('package/nuitka_build.py') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-pip-


- name: Install dependencies
run: |
Expand All @@ -52,22 +135,56 @@ jobs:
# [System.Environment]::SetEnvironmentVariable('PYTHONUTF8', '1', 'Process')
# # 设置控制台编码为UTF-8
# chcp.com 65001

- name: Install ccache on Linux
if: ${{ runner.os == 'Linux' }}
run: |
sudo apt-get update -y
sudo apt-get install -y ccache

- name: Cache Nuitka cache directory
uses: actions/cache@v4
with:
path: ${{ env.NUITKA_CACHE_DIR }}
key: nuitka-${{ runner.os }}-${{ runner.arch }}-python-${{ env.PYTHON_VERSION }}-nuitka-${{ github.event.inputs.test && hashFiles(github.event.inputs.config_path) || hashFiles('package/nuitka_build.py') }}
restore-keys: |
nuitka-${{ runner.os }}-${{ runner.arch }}-python-${{ env.PYTHON_VERSION }}-
nuitka-${{ runner.os }}-${{ runner.arch }}-

- name: Run packaging script on Windows
if: ${{ !github.event.inputs.test && runner.os == 'Windows' }}
run: |
# 设置Python使用UTF-8编码
[System.Environment]::SetEnvironmentVariable('PYTHONUTF8', '1', 'Process')
# 设置控制台编码为UTF-8
chcp.com 65001
python ./package/nuitka_build.py ./package/nuitka_config.yml

- name: Run packaging script
- name: Run Test packaging script on Windows
if: ${{ github.event.inputs.test && runner.os == 'Windows' }}
run: |
# 设置Python使用UTF-8编码
[System.Environment]::SetEnvironmentVariable('PYTHONUTF8', '1', 'Process')
# 设置控制台编码为UTF-8
chcp.com 65001
cd package
python nuitka_build.py nuitka_config.yml
python ./package/nuitka_build.py ${{ github.event.inputs.config_path }}

- name: Run packaging script on Linux
if: ${{ !github.event.inputs.test && runner.os == 'Linux' }}
run: |
python ./package/nuitka_build.py ./package/nuitka_config.yml

- name: Run Test packaging script on Linux
if: ${{ github.event.inputs.test && runner.os == 'Linux' }}
run: |
python ./package/nuitka_build.py ${{ github.event.inputs.config_path }}

- name: Upload files with wildcards
uses: actions/upload-artifact@v4
with:
name: Artifact
name: ${{ runner.os }}-${{ runner.arch }}-${{ github.event.inputs.test && 'test-' || '' }}artifact
path: |
./dist/*.exe
./dist/*
retention-days: 14
if-no-files-found: warn
overwrite: true
141 changes: 121 additions & 20 deletions .github/workflows/nuitka_package_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,41 +9,122 @@ on:
- 'package/nuitka_config.yml'

jobs:
package-and-release:
package-and-upload:
runs-on: windows-latest
# runs-on: ${{ matrix.os }}
# strategy:
# matrix:
# os: [ubuntu-latest,ubuntu-24.04-arm,windows-latest] # windows-11-arm没有对应的 Python
env:
PYTHON_VERSION: '3.10'
NUITKA_CACHE_DIR: ${{ github.workspace }}/nuitka-cache
UPXVERSION: '5.0.1'

# 添加必要的权限
permissions:
contents: write # 允许创建发布和上传资源

steps:
- name: Set Timezone to China Standard Time
run: tzutil /s "China Standard Time"
shell: pwsh

- name: Checkout code
uses: actions/checkout@v4

- name: Generate version tag
id: version
- name: Set Timezone to China Standard Time on Windows
if: ${{ runner.os == 'Windows' }}
run: tzutil /s "China Standard Time"
shell: pwsh

- name: Set Timezone to China Standard Time on Linux
if: ${{ runner.os == 'Linux' }}
run: sudo timedatectl set-timezone Asia/Shanghai

- name: Generate version tag on Windows
if: ${{ runner.os == 'Windows' }}
run: |
# 使用 UTC 时间确保一致性
$date = (Get-Date).ToUniversalTime().ToString("yy.MM.dd")
$tag = "v$date"
$release = "Release $date"
echo "tag=$tag" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
echo "release_name=$release" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append


echo "VERSION_TAG=$tag" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "RELEASE_NAME=$release" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
shell: pwsh

- name: Generate version tag on Linux
if: ${{ runner.os == 'Linux' }}
run: |
# 使用 UTC 时间确保一致性
DATE=$(date -u +%y.%m.%d)
echo "VERSION_TAG=v$DATE" >> $GITHUB_ENV
echo "RELEASE_NAME=Release $DATE" >> $GITHUB_ENV
shell: bash

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: ${{ env.PYTHON_VERSION }}

- name: Cache UPX
id: cache-upx
uses: actions/cache@v4
with:
path: upx
key: ${{ runner.os }}-${{ runner.arch }}-upx-v${{ env.UPXVERSION }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-upx-

- name: Create UPX directory
if: ${{ steps.cache-upx.outputs.cache-hit != 'true' }}
run: mkdir -p ./upx

- name: Install UPX on Linux
if: ${{ runner.os == 'Linux' && steps.cache-upx.outputs.cache-hit != 'true' }}
run: |

UPX_URL="https://github.com/upx/upx/releases/download/v${{ env.UPXVERSION }}/upx-${{ env.UPXVERSION }}-${{ runner.arch == 'X64' && 'amd64' || 'arm64' }}_linux.tar.xz"
curl -L "$UPX_URL" -o upx.tar.xz
tar -xf upx.tar.xz -C ./upx --strip-components=1
chmod +x ./upx/upx

shell: bash

- name: UPX Setup
- name: Install UPX on Windows
if: ${{ runner.os == 'Windows' && steps.cache-upx.outputs.cache-hit != 'true' }}
run: |
mkdir upx
curl -o upx/upx.exe https://assets.ksable.top/github/upx/upx/v5.0.1/windows-amd64/upx.exe
$arch = if (("${{ runner.arch }}" -eq "amd64") -or ("${{ runner.arch }}" -eq "X64")) { "win64" } else { "win32" }
$upxVersion = "${{ env.UPXVERSION }}"
$upxUrl = "https://github.com/upx/upx/releases/download/v$upxVersion/upx-$upxVersion-$arch.zip"

Invoke-WebRequest -Uri $upxUrl -OutFile upx.zip
Expand-Archive -Path upx.zip -DestinationPath ./upx -Force

# Windows 版本的 UPX 解压后在子目录中,需要移动到根目录
Move-Item -Path "./upx/upx-$upxVersion-$arch/*" -Destination ./upx -Force

shell: pwsh

- name: Verify UPX installation
run: |
./upx/upx --version
shell: bash

- name: get pip cache dir on Windows
if: ${{ runner.os == 'Windows' }}
id: pip-cache-dir-window
run: echo "pip-cache-dir=$(pip cache dir)" >> $env:GITHUB_OUTPUT

- name: get pip cache dir on Linux
if: ${{ runner.os == 'Linux' }}
id: pip-cache-dir-linux
run: echo "pip-cache-dir=$(pip cache dir)" >> $GITHUB_OUTPUT

- name: pip cache
uses: actions/cache@v4
with:
path: ${{ runner.os == 'Windows' && steps.pip-cache-dir-window.outputs.pip-cache-dir || steps.pip-cache-dir-linux.outputs.pip-cache-dir }}
key: ${{ runner.os }}-${{ runner.arch }}-pip-${{ github.event.inputs.test && hashFiles(github.event.inputs.config_path) || hashFiles('package/nuitka_build.py') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-pip-


- name: Install dependencies
run: |
Expand All @@ -64,26 +145,46 @@ jobs:
# # 设置控制台编码为UTF-8
# chcp.com 65001

- name: Run packaging script
- name: Install ccache on Linux
if: ${{ runner.os == 'Linux' }}
run: |
sudo apt-get update -y
sudo apt-get install -y ccache

- name: Cache Nuitka cache directory
uses: actions/cache@v4
with:
path: ${{ env.NUITKA_CACHE_DIR }}
key: nuitka-${{ runner.os }}-${{ runner.arch }}-python-${{ env.PYTHON_VERSION }}-nuitka-${{ github.event.inputs.test && hashFiles(github.event.inputs.config_path) || hashFiles('package/nuitka_build.py') }}
restore-keys: |
nuitka-${{ runner.os }}-${{ runner.arch }}-python-${{ env.PYTHON_VERSION }}-
nuitka-${{ runner.os }}-${{ runner.arch }}-

- name: Run packaging script on Windows
if: ${{ runner.os == 'Windows' }}
run: |
# 设置Python使用UTF-8编码
[System.Environment]::SetEnvironmentVariable('PYTHONUTF8', '1', 'Process')
# 设置控制台编码为UTF-8
chcp.com 65001
cd package
python nuitka_build.py nuitka_config.yml
python ./package/nuitka_build.py ./package/nuitka_config.yml

- name: Run packaging script on Linux
if: ${{ runner.os == 'Linux' }}
run: |
python ./package/nuitka_build.py ./package/nuitka_config.yml

- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1 # 使用更活跃维护的 release 操作
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.version.outputs.tag }}
name: ${{ steps.version.outputs.release_name }}
tag_name: ${{ env.VERSION_TAG }}
name: ${{ env.RELEASE_NAME }}
generate_release_notes: true
draft: false
prerelease: false
overwrite_files: true
files: |
dist/*.exe
dist/*
2 changes: 1 addition & 1 deletion novel_crawler/novel_crawler_v.25.07.08.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ def download_chapter(chapter_info, progress, task_id, chapter_count):

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

if debug:
logger.debug("Debug模式已开启")
Expand Down
Loading