Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/安全漏洞报告.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ assignees: LZY98276
## ✅ 最后确认
- [ ] 我已提供**详细复现步骤**
- [ ] 我理解可能需要**私下沟通**漏洞细节
- [ ] 我愿意协助漏洞修复测试
- [ ] 我愿意协助漏洞修复测试
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/性能问题报告.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ assignees: LZY98276
## ✅ 最后确认
- [ ] 我已提供**具体性能数据**和**复现步骤**
- [ ] 我理解性能优化可能需要**多轮测试**
- [ ] 我愿意协助进行性能测试和验证
- [ ] 我愿意协助进行性能测试和验证
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/文档改进.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ assignees: yuanbenxin

## ✅ 最后确认
- [ ] 我已提供**具体位置和改进建议**
- [ ] 我知道清晰的描述能帮助开发者快速修复文档问题
- [ ] 我知道清晰的描述能帮助开发者快速修复文档问题
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/问题咨询.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ assignees: LZY98276

## ✅ 最后确认
- [ ] 我已提供**详细问题描述和截图**
- [ ] 我知道可以通过**Discussions**获得更快的社区支持
- [ ] 我知道可以通过**Discussions**获得更快的社区支持
134 changes: 134 additions & 0 deletions .github/workflows/build-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: Linux构建

on:
push:
branches:
- linux-port
pull_request:
branches:
- linux-port
workflow_dispatch:

concurrency:
group: build-linux-${{ github.ref }}
cancel-in-progress: true

jobs:
builder_matrix:
permissions:
contents: read
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
arch: x64
pack_mode: dir

runs-on: ${{ matrix.os }}
steps:
- name: 检出仓库
uses: actions/checkout@v4.2.2

- name: 安装 Python
uses: actions/setup-python@v5.3.0
with:
python-version: '3.8.10'
architecture: ${{ matrix.arch }}

- name: 安装 uv
uses: astral-sh/setup-uv@v4

- name: 安装系统依赖
run: |
sudo apt-get update
sudo apt-get install -y \
libpulse-dev \
pulseaudio \
libportaudio2 \
libsndfile1 \
libasound2-dev \
portaudio19-dev \
libxcb-xinerama0 \
libxcb-cursor0 \
libxkbcommon-x11-0 \
libgl1-mesa-glx \
libegl1 \
libdbus-1-3 \
libxcb-icccm4 \
libxcb-image0 \
libxcb-keysyms1 \
libxcb-randr0 \
libxcb-render-util0 \
libxcb-shape0

- name: 初始化 zip 文件夹
run: mkdir -p zip

- name: 运行 Linux 构建
run: |
echo "开始 Linux 构建流程..."
# 创建虚拟环境
echo "创建虚拟环境..."
uv venv

# 激活虚拟环境
echo "激活虚拟环境..."
source .venv/bin/activate

# 安装依赖
echo "安装项目依赖..."
uv pip install -r requirements-linux.txt

# 安装 pyinstaller
echo "安装 PyInstaller..."
uv pip install pyinstaller

# 清理之前的构建文件
echo "清理之前的构建文件..."
rm -rf dist build zip_dist
echo "构建环境准备完成"

# 目录模式打包
echo "开始目录模式打包..."
pyinstaller main.py \
-w \
-D \
-i ./resources/secrandom-icon-paper.ico \
-n SecRandom \
--add-data ./app/resources:app/resources \
--add-data LICENSE:.
echo "目录模式打包完成"

- name: 打包操作
run: |
echo "开始打包操作..."

# 创建zip_dist/SecRandom目录
mkdir -p zip_dist/SecRandom

# 复制dist/SecRandom目录下的所有文件到zip_dist/SecRandom目录下
cp -r dist/SecRandom/* zip_dist/SecRandom/

# 创建app目录
mkdir -p zip_dist/SecRandom/app

# 复制app/resources文件夹到zip_dist/SecRandom目录下
cp -r app/resources zip_dist/SecRandom/app/

# 复制 LICENSE 文件到zip_dist/SecRandom目录下
cp LICENSE zip_dist/SecRandom/

# 使用 tar 压缩文件
mkdir -p zip
cd zip_dist
tar -czf ../zip/SecRandom-Linux-${{ github.ref_name }}-${{ matrix.arch }}-dir.tar.gz SecRandom/
cd ..
echo "目录模式打包完成: zip/SecRandom-Linux-${{ github.ref_name }}-${{ matrix.arch }}-dir.tar.gz"

- name: 上传应用程序
if: ${{ github.event_name != 'pull_request' }}
uses: actions/upload-artifact@v4.4.2
with:
name: linux-${{ matrix.arch }}-${{ matrix.pack_mode }}
path: ./zip
38 changes: 19 additions & 19 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: 构建

on:
on:
push:
pull_request:
workflow_dispatch:
Expand All @@ -13,7 +13,7 @@ jobs:
builder_matrix:
# 仅在push或pull_request事件包含'进行打包'时执行,workflow_dispatch无条件执行
if: |
github.event_name == 'workflow_dispatch' ||
github.event_name == 'workflow_dispatch' ||
contains(github.event.head_commit.message, '进行打包') ||
(github.event_name == 'pull_request' && contains(github.event.pull_request.title, '进行打包'))
strategy:
Expand Down Expand Up @@ -58,21 +58,21 @@ jobs:
echo "创建虚拟环境..."
uv venv
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }

# 激活虚拟环境
echo "激活虚拟环境..."
.venv/Scripts/activate

# 安装依赖
echo "安装项目依赖..."
uv pip install -r requirements-windows.txt
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }

# 安装 pyinstaller
echo "安装 PyInstaller..."
uv pip install pyinstaller
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }

# 清理之前的构建文件
echo "清理之前的构建文件..."
Remove-Item -Recurse -Force dist -ErrorAction SilentlyContinue
Expand All @@ -91,33 +91,33 @@ jobs:
--add-data ./app/resources:app/resources `
--add-data LICENSE:. `
--version-file=version_info.txt
if ($LASTEXITCODE -ne 0) {
if ($LASTEXITCODE -ne 0) {
echo "目录模式打包失败"
exit $LASTEXITCODE
exit $LASTEXITCODE
}
echo "目录模式打包完成"
}

- name: 打包操作
if: ${{ matrix.os == 'windows-2022'}}
if: ${{ matrix.os == 'windows-2022'}}
run: |
echo "开始打包操作..."

# 创建zip_dist/SecRandom目录
mkdir -p zip_dist/SecRandom

# 复制dist/SecRandom目录下的所有文件到zip_dist/SecRandom目录下
Copy-Item -Recurse -Force dist/SecRandom/* zip_dist/SecRandom/

# 创建app目录
mkdir -p zip_dist/SecRandom/app

# 复制app/resources文件夹到zip_dist/SecRandom目录下
Copy-Item -Recurse -Force app/resources zip_dist/SecRandom/app

# 复制 LICENSE 文件到zip_dist/SecRandom目录下
Copy-Item LICENSE zip_dist/SecRandom/

# 使用 zip 压缩文件
mkdir zip -Force
$outputZip = "zip/SecRandom-Windows-${{ github.ref_name }}-${{ matrix.arch }}-dir.zip"
Expand Down Expand Up @@ -163,7 +163,7 @@ jobs:
path: artifacts
run-id: ${{ github.run_id }}

- name: 准备 artifacts
- name: 准备 artifacts
run: |
echo "整理构建产物..."
# Windows 构建产物
Expand All @@ -185,7 +185,7 @@ jobs:
done
echo "SHA256校验值计算完成:"
cat SHA256SUMS.txt

- name: 验证 SHA256SUMS.txt 文件
run: |
echo "验证SHA256SUMS.txt文件..."
Expand Down Expand Up @@ -230,7 +230,7 @@ jobs:
done < SHA256SUMS.txt
rm SHA256SUMS.txt
cd ..

- name: 确定发布类型
id: release-type
run: |
Expand All @@ -252,4 +252,4 @@ jobs:
name: SecRandom 新版本 - ${{ github.ref_name }}
fail_on_unmatched_files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30 changes: 30 additions & 0 deletions .github/workflows/codeQL.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: CodeQL

on:
push:
branches: [master]
pull_request:

jobs:
analyze:
name: CodeQL Analysis
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: python

- name: Autobuild (optional for Python)
uses: github/codeql-action/autobuild@v3

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
29 changes: 29 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Pre-commit

on:
push:
branches: [master]
pull_request:
branches: [main]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python 3.8.10
uses: actions/setup-python@v5
with:
python-version: "3.8.10"

- name: Setup uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true

- name: Install pre-commit with uv
run: uv pip install pre-commit

- name: Run pre-commit on all files
run: pre-commit run --all-files
32 changes: 32 additions & 0 deletions .github/workflows/pyright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# name: Pyright

# on:
# push:
# branches: [main, develop]
# pull_request:
# branches: [main]

# jobs:
# pyright:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4

# - name: Set up Python 3.8.10
# uses: actions/setup-python@v5
# with:
# python-version: "3.8.10"

# - name: Setup uv
# uses: astral-sh/setup-uv@v3
# with:
# enable-cache: true

# - name: Install dependencies with uv
# run: |
# uv pip install pyright
# # 如果有项目依赖
# uv pip install -r requirements.txt # 或 uv sync(若用 pyproject.toml + uv project)

# - name: Run Pyright
# run: pyright
Loading
Loading