diff --git "a/.github/ISSUE_TEMPLATE/\345\256\211\345\205\250\346\274\217\346\264\236\346\212\245\345\221\212.md" "b/.github/ISSUE_TEMPLATE/\345\256\211\345\205\250\346\274\217\346\264\236\346\212\245\345\221\212.md" index daad9f17..d78d61b4 100644 --- "a/.github/ISSUE_TEMPLATE/\345\256\211\345\205\250\346\274\217\346\264\236\346\212\245\345\221\212.md" +++ "b/.github/ISSUE_TEMPLATE/\345\256\211\345\205\250\346\274\217\346\264\236\346\212\245\345\221\212.md" @@ -48,4 +48,4 @@ assignees: LZY98276 ## ✅ 最后确认 - [ ] 我已提供**详细复现步骤** - [ ] 我理解可能需要**私下沟通**漏洞细节 -- [ ] 我愿意协助漏洞修复测试 \ No newline at end of file +- [ ] 我愿意协助漏洞修复测试 diff --git "a/.github/ISSUE_TEMPLATE/\346\200\247\350\203\275\351\227\256\351\242\230\346\212\245\345\221\212.md" "b/.github/ISSUE_TEMPLATE/\346\200\247\350\203\275\351\227\256\351\242\230\346\212\245\345\221\212.md" index 475c8db1..d781b495 100644 --- "a/.github/ISSUE_TEMPLATE/\346\200\247\350\203\275\351\227\256\351\242\230\346\212\245\345\221\212.md" +++ "b/.github/ISSUE_TEMPLATE/\346\200\247\350\203\275\351\227\256\351\242\230\346\212\245\345\221\212.md" @@ -46,4 +46,4 @@ assignees: LZY98276 ## ✅ 最后确认 - [ ] 我已提供**具体性能数据**和**复现步骤** - [ ] 我理解性能优化可能需要**多轮测试** -- [ ] 我愿意协助进行性能测试和验证 \ No newline at end of file +- [ ] 我愿意协助进行性能测试和验证 diff --git "a/.github/ISSUE_TEMPLATE/\346\226\207\346\241\243\346\224\271\350\277\233.md" "b/.github/ISSUE_TEMPLATE/\346\226\207\346\241\243\346\224\271\350\277\233.md" index 262ae6d2..2bb4e4d4 100644 --- "a/.github/ISSUE_TEMPLATE/\346\226\207\346\241\243\346\224\271\350\277\233.md" +++ "b/.github/ISSUE_TEMPLATE/\346\226\207\346\241\243\346\224\271\350\277\233.md" @@ -30,4 +30,4 @@ assignees: yuanbenxin ## ✅ 最后确认 - [ ] 我已提供**具体位置和改进建议** -- [ ] 我知道清晰的描述能帮助开发者快速修复文档问题 \ No newline at end of file +- [ ] 我知道清晰的描述能帮助开发者快速修复文档问题 diff --git "a/.github/ISSUE_TEMPLATE/\351\227\256\351\242\230\345\222\250\350\257\242.md" "b/.github/ISSUE_TEMPLATE/\351\227\256\351\242\230\345\222\250\350\257\242.md" index a8212eba..bed64ba5 100644 --- "a/.github/ISSUE_TEMPLATE/\351\227\256\351\242\230\345\222\250\350\257\242.md" +++ "b/.github/ISSUE_TEMPLATE/\351\227\256\351\242\230\345\222\250\350\257\242.md" @@ -36,4 +36,4 @@ assignees: LZY98276 ## ✅ 最后确认 - [ ] 我已提供**详细问题描述和截图** -- [ ] 我知道可以通过**Discussions**获得更快的社区支持 \ No newline at end of file +- [ ] 我知道可以通过**Discussions**获得更快的社区支持 diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml deleted file mode 100644 index 2397f3bc..00000000 --- a/.github/workflows/build-linux.yml +++ /dev/null @@ -1,134 +0,0 @@ -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 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 288abc1a..a48d1051 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,6 @@ name: 构建 -on: +on: push: pull_request: workflow_dispatch: @@ -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: @@ -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 @@ -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" @@ -163,7 +163,7 @@ jobs: path: artifacts run-id: ${{ github.run_id }} - - name: 准备 artifacts + - name: 准备 artifacts run: | echo "整理构建产物..." # Windows 构建产物 @@ -185,7 +185,7 @@ jobs: done echo "SHA256校验值计算完成:" cat SHA256SUMS.txt - + - name: 验证 SHA256SUMS.txt 文件 run: | echo "验证SHA256SUMS.txt文件..." @@ -230,7 +230,7 @@ jobs: done < SHA256SUMS.txt rm SHA256SUMS.txt cd .. - + - name: 确定发布类型 id: release-type run: | @@ -252,4 +252,4 @@ jobs: name: SecRandom 新版本 - ${{ github.ref_name }} fail_on_unmatched_files: true env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 00000000..42c58199 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,19 @@ +name: Pre-commit + +on: + push: + branches: [main, master] + pull_request: + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: "3.11" + - name: Install pre-commit + run: pip install pre-commit + - name: Run pre-commit on all files + run: pre-commit run --all-files diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml new file mode 100644 index 00000000..35a7c9de --- /dev/null +++ b/.github/workflows/ruff.yml @@ -0,0 +1,8 @@ +name: Ruff +on: [push, pull_request] +jobs: + ruff: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: astral-sh/ruff-action@v3 diff --git a/.gitignore b/.gitignore index ecbaf7c9..6cad6594 100644 --- a/.gitignore +++ b/.gitignore @@ -30,7 +30,6 @@ MANIFEST # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest -*.spec # Installer logs pip-log.txt diff --git a/.idea/MarsCodeWorkspaceAppSettings.xml b/.idea/MarsCodeWorkspaceAppSettings.xml index afda9c38..9d69744c 100644 --- a/.idea/MarsCodeWorkspaceAppSettings.xml +++ b/.idea/MarsCodeWorkspaceAppSettings.xml @@ -4,4 +4,4 @@ - \ No newline at end of file + diff --git a/.idea/misc.xml b/.idea/misc.xml index e557d17a..b816b3d6 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,4 +4,4 @@