Skip to content

Commit c673c96

Browse files
committed
禁用 Nuitka Package and Upload(dev) 自动流程,启用手动触发,添加测试流程
1 parent 34541ce commit c673c96

3 files changed

Lines changed: 99 additions & 6 deletions

File tree

.github/workflows/dev_package_and_upload.yml

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,22 @@ name: Nuitka Package and Upload(dev)
22

33
on:
44
workflow_dispatch:
5-
push:
6-
branches:
7-
- dev
8-
paths:
9-
- 'package/nuitka_config.yml'
5+
inputs:
6+
test:
7+
description: '测试'
8+
required: true
9+
type: boolean
10+
default: true
11+
config_path:
12+
description: '测试模式时用的配置文件路径(非测试时请忽略)'
13+
required: true
14+
type: string
15+
default: 'package/nuitka_test_config.yml'
16+
# push:
17+
# branches:
18+
# - dev
19+
# paths:
20+
# - 'package/nuitka_config.yml'
1021

1122
jobs:
1223
package-and-release:
@@ -91,18 +102,29 @@ jobs:
91102
nuitka-${{ runner.os }}-${{ runner.arch }}-
92103
93104
- name: Run packaging script
105+
if: ${{ !github.event.inputs.test }}
94106
run: |
95107
# 设置Python使用UTF-8编码
96108
[System.Environment]::SetEnvironmentVariable('PYTHONUTF8', '1', 'Process')
97109
# 设置控制台编码为UTF-8
98110
chcp.com 65001
99111
cd package
100112
python nuitka_build.py nuitka_config.yml
113+
114+
- name: Run Test packaging script
115+
if: ${{ github.event.inputs.test }}
116+
run: |
117+
# 设置Python使用UTF-8编码
118+
[System.Environment]::SetEnvironmentVariable('PYTHONUTF8', '1', 'Process')
119+
# 设置控制台编码为UTF-8
120+
chcp.com 65001
121+
cd package
122+
python nuitka_build.py nuitka_test_config.yml
101123
102124
- name: Upload files with wildcards
103125
uses: actions/upload-artifact@v4
104126
with:
105-
name: Artifact
127+
name: ${{ runner.os }}-${{ runner.arch }}-${{ github.event.inputs.test && 'test-' || '' }}artifact
106128
path: |
107129
./dist/*.exe
108130
retention-days: 14

package/hello_world.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import platform
2+
import os
3+
import sys
4+
import psutil
5+
print('='*50)
6+
7+
# 显示系统信息
8+
print('hello world')
9+
print('-'*50)
10+
print('系统信息')
11+
print("操作系统:", platform.system())
12+
print("架构:", platform.machine())
13+
print("版本:", platform.version())
14+
print("平台:", platform.platform())
15+
16+
# 显示硬件信息
17+
print('-'*50)
18+
print('CPU 信息')
19+
print(f"CPU 核心数: {psutil.cpu_count(logical=False)}")
20+
print(f"逻辑处理器数: {psutil.cpu_count(logical=True)}")
21+
print("处理器信息:", platform.processor())
22+
cpu_times = psutil.cpu_times()
23+
print(f"用户时间: {cpu_times.user}")
24+
print(f"系统时间: {cpu_times.system}")
25+
print(f"空闲时间: {cpu_times.idle}")
26+
27+
memory_info = psutil.virtual_memory()
28+
29+
print('-'*50)
30+
print('内存 信息')
31+
print(f"总内存: {memory_info.total / (1024 ** 3)} GB")
32+
print(f"空闲内存: {memory_info.free / (1024 ** 3)} GB")
33+
print(f"已用内存: {memory_info.used / (1024 ** 3)} GB")
34+
print(f"可用内存: {memory_info.available / (1024 ** 3)} GB")
35+
36+
# 获取内存详细信息
37+
print('-'*50)
38+
print('交换内存 信息')
39+
swap_memory = psutil.swap_memory()
40+
print(f"交换内存总量: {swap_memory.total / (1024 ** 3)} GB")
41+
print(f"已用交换内存: {swap_memory.used / (1024 ** 3)} GB")
42+
print(f"可用交换内存: {swap_memory.free / (1024 ** 3)} GB")
43+
44+
print("系统编码:", sys.getdefaultencoding())
45+
print("文件系统编码:", sys.getfilesystemencoding())
46+
47+
48+
49+
# 显示Python信息
50+
print("Python版本:", sys.version)
51+
print("Python路径:", sys.executable)
52+
print("当前工作目录:", os.getcwd())
53+
54+
55+
print('='*50)

package/nuitka_test_config.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
- name: 'hello_world'
2+
version: 'v.25.07.08'
3+
python-file: 'package\hello_world.py'
4+
install-requirements: [
5+
'psutil'
6+
]
7+
enable-plugins: [
8+
'upx'
9+
]
10+
# onefile: 2 # 0:文件夹 1:单文件 2:两者
11+
icon: package\assets\favicon.ico
12+
windows-disable-console: False
13+
distpath: 'dist'
14+
timeout: 2700
15+
output-name-template: '{{name}}_{{version}}_nuitka_{{os}}_{{arch}}'
16+
custom-command: []

0 commit comments

Comments
 (0)