-
Notifications
You must be signed in to change notification settings - Fork 58
构建、打包流程、文档以及依赖管理方面的重大改进 #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
BlueSkyXN
wants to merge
5
commits into
icysaintdx:main
Choose a base branch
from
BlueSkyXN:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
7b03c2f
Add GitHub Actions for PyInstaller and Nuitka builds
BlueSkyXN c637132
Update CI to install dependencies from requirements.txt
BlueSkyXN dcc15aa
Add requirements.txt and update .gitignore for requirements
BlueSkyXN d335b3a
Improve build workflows and GUI stop handling
BlueSkyXN 0a66445
Update docs and build guides to use requirements.txt
BlueSkyXN File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,179 @@ | ||
| name: Build with Nuitka | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - 'v*' | ||
| branches: | ||
| - main | ||
| - master | ||
| - dev | ||
| paths: | ||
| - 'linux_do_gui.py' | ||
| - 'requirements.txt' | ||
| - 'icon.ico' | ||
| - 'docs/**' | ||
| pull_request: | ||
| paths: | ||
| - 'linux_do_gui.py' | ||
| - 'requirements.txt' | ||
| workflow_dispatch: | ||
| inputs: | ||
| version: | ||
| description: 'Version tag for release (e.g., v8.1.0)' | ||
| required: false | ||
| default: '' | ||
|
|
||
| env: | ||
| APP_NAME: LinuxDoHelper | ||
| PYTHON_VERSION: '3.11' | ||
|
|
||
| jobs: | ||
| build: | ||
| name: Build on ${{ matrix.os }} | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - os: ubuntu-24.04 | ||
| artifact_name: LinuxDoHelper-nuitka-linux-amd64 | ||
| - os: ubuntu-24.04-arm | ||
| artifact_name: LinuxDoHelper-nuitka-linux-arm64 | ||
| - os: macos-15 | ||
| artifact_name: LinuxDoHelper-nuitka-macos-arm64.app.zip | ||
| app_dir_name: LinuxDoHelper-nuitka-macos-arm64.app | ||
| - os: windows-2025 | ||
| artifact_name: LinuxDoHelper-nuitka-windows-amd64.exe | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python ${{ env.PYTHON_VERSION }} | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: ${{ env.PYTHON_VERSION }} | ||
| cache: 'pip' | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -r requirements.txt | ||
| pip install nuitka ordered-set zstandard | ||
|
|
||
| - name: Install C compiler (Ubuntu) | ||
| if: runner.os == 'Linux' | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y build-essential patchelf | ||
|
|
||
| - name: Install C compiler (macOS) | ||
| if: runner.os == 'macOS' | ||
| run: | | ||
| xcode-select --install || true | ||
|
|
||
| - name: Build with Nuitka (macOS) | ||
| if: runner.os == 'macOS' | ||
| run: | | ||
| python -m nuitka \ | ||
| --mode=app \ | ||
| --assume-yes-for-downloads \ | ||
| --enable-plugin=tk-inter \ | ||
| --include-package=DrissionPage \ | ||
| --include-package=pystray \ | ||
| --include-package=PIL \ | ||
| --include-data-file=icon.ico=icon.ico \ | ||
| --output-filename=${{ env.APP_NAME }} \ | ||
| --output-dir=dist \ | ||
| linux_do_gui.py | ||
|
|
||
| - name: Build with Nuitka (Linux) | ||
| if: runner.os == 'Linux' | ||
| run: | | ||
| python -m nuitka \ | ||
| --onefile \ | ||
| --standalone \ | ||
| --assume-yes-for-downloads \ | ||
| --enable-plugin=tk-inter \ | ||
| --include-package=DrissionPage \ | ||
| --include-package=pystray \ | ||
| --include-package=PIL \ | ||
| --include-data-file=icon.ico=icon.ico \ | ||
| --output-filename=${{ env.APP_NAME }} \ | ||
| --output-dir=dist \ | ||
| linux_do_gui.py | ||
|
|
||
| - name: Build with Nuitka (Windows) | ||
| if: runner.os == 'Windows' | ||
| run: | | ||
| python -m nuitka --onefile --standalone --assume-yes-for-downloads --enable-plugin=tk-inter --include-package=DrissionPage --include-package=pystray --include-package=PIL --include-data-file=icon.ico=icon.ico --output-filename=${{ env.APP_NAME }} --output-dir=dist linux_do_gui.py | ||
|
|
||
| - name: Rename artifact (macOS) | ||
| if: runner.os == 'macOS' | ||
| run: | | ||
| mv dist/${{ env.APP_NAME }}.app dist/${{ matrix.app_dir_name }} | ||
|
|
||
| - name: Zip macOS app | ||
| if: runner.os == 'macOS' | ||
| run: | | ||
| ditto -c -k --sequesterRsrc --keepParent dist/${{ matrix.app_dir_name }} dist/${{ matrix.artifact_name }} | ||
|
|
||
| - name: Rename artifact (Linux) | ||
| if: runner.os == 'Linux' | ||
| run: | | ||
| mv dist/${{ env.APP_NAME }} dist/${{ matrix.artifact_name }} | ||
|
|
||
| - name: Rename artifact (Windows) | ||
| if: runner.os == 'Windows' | ||
| run: | | ||
| move dist\${{ env.APP_NAME }}.exe dist\${{ matrix.artifact_name }} | ||
|
|
||
| - name: Upload artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: ${{ matrix.artifact_name }} | ||
| path: dist/${{ matrix.artifact_name }} | ||
| retention-days: 30 | ||
|
|
||
| release: | ||
| name: Create Release | ||
| needs: build | ||
| runs-on: ubuntu-latest | ||
| if: startsWith(github.ref, 'refs/tags/v') | ||
|
|
||
| steps: | ||
| - name: Download all artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| path: artifacts/ | ||
|
|
||
| - name: Display artifacts | ||
| run: find artifacts/ -type f -o -type d | ||
|
|
||
| - name: Create GitHub Release | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| name: ${{ env.APP_NAME }} ${{ github.ref_name }} (Nuitka) | ||
| body: | | ||
| ## ${{ env.APP_NAME }} ${{ github.ref_name }} (Nuitka Build) | ||
|
|
||
| ### Downloads | ||
| - **Linux (x64)**: `LinuxDoHelper-nuitka-linux-amd64` | ||
| - **Linux (ARM64)**: `LinuxDoHelper-nuitka-linux-arm64` | ||
| - **macOS (Apple Silicon)**: `LinuxDoHelper-nuitka-macos-arm64.app.zip` | ||
| - **Windows (x64)**: `LinuxDoHelper-nuitka-windows-amd64.exe` | ||
|
|
||
| ### Build Info | ||
| - Builder: Nuitka (compiled to native code) | ||
| - Python: ${{ env.PYTHON_VERSION }} | ||
|
|
||
| ### Note | ||
| macOS builds use `--mode=app` to support GUI frameworks (Foundation/Tkinter). | ||
| files: | | ||
| artifacts/**/* | ||
| generate_release_notes: true | ||
| draft: false | ||
| prerelease: ${{ contains(github.ref_name, 'alpha') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'rc') }} | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,158 @@ | ||
| name: Build with PyInstaller | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - 'v*' | ||
| branches: | ||
| - main | ||
| - master | ||
| - dev | ||
| pull_request: | ||
| workflow_dispatch: | ||
|
||
|
|
||
| env: | ||
| APP_NAME: LinuxDoHelper | ||
| PYTHON_VERSION: '3.11' | ||
|
|
||
| jobs: | ||
| build: | ||
| name: Build on ${{ matrix.os }} | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - os: ubuntu-24.04 | ||
| platform: linux-amd64 | ||
| ext: '' | ||
| - os: ubuntu-24.04-arm | ||
| platform: linux-arm64 | ||
| ext: '' | ||
| - os: macos-15 | ||
| platform: macos-arm64 | ||
| ext: '' | ||
| - os: windows-2025 | ||
| platform: windows-amd64 | ||
| ext: '.exe' | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python ${{ env.PYTHON_VERSION }} | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: ${{ env.PYTHON_VERSION }} | ||
| cache: 'pip' | ||
|
|
||
| - name: Resolve version | ||
| id: version | ||
| shell: bash | ||
| run: | | ||
| if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then | ||
| VERSION="${GITHUB_REF_NAME}" | ||
| else | ||
| VERSION="dev-${GITHUB_SHA::7}" | ||
| fi | ||
| echo "VERSION=${VERSION}" >> "$GITHUB_ENV" | ||
| echo "version=${VERSION}" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Install system deps (Linux) | ||
| if: runner.os == 'Linux' | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y tk tcl libgtk-3-0 | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -r requirements.txt | ||
| pip install pyinstaller | ||
|
|
||
| - name: Build with PyInstaller (Unix) | ||
| if: runner.os != 'Windows' | ||
| run: | | ||
| pyinstaller --onefile --windowed --clean --noconfirm \ | ||
| --name "${APP_NAME}" \ | ||
| --hidden-import tkinter \ | ||
| --hidden-import tkinter.ttk \ | ||
| --hidden-import tkinter.scrolledtext \ | ||
| --hidden-import DrissionPage \ | ||
| --hidden-import pystray \ | ||
| --hidden-import PIL \ | ||
| --add-data "icon.ico:." \ | ||
| linux_do_gui.py | ||
|
|
||
| - name: Build with PyInstaller (Windows) | ||
| if: runner.os == 'Windows' | ||
| shell: pwsh | ||
| run: | | ||
| pyinstaller --onefile --windowed --clean --noconfirm ` | ||
| --name "${env:APP_NAME}" ` | ||
| --hidden-import tkinter ` | ||
| --hidden-import tkinter.ttk ` | ||
| --hidden-import tkinter.scrolledtext ` | ||
| --hidden-import DrissionPage ` | ||
| --hidden-import pystray ` | ||
| --hidden-import PIL ` | ||
| --add-data "icon.ico;." ` | ||
| --icon icon.ico ` | ||
| linux_do_gui.py | ||
|
|
||
| - name: Rename artifact (Unix) | ||
| if: runner.os != 'Windows' | ||
| run: | | ||
| mv "dist/${APP_NAME}" "dist/${APP_NAME}-pyinstaller-${{ steps.version.outputs.version }}-${{ matrix.platform }}" | ||
|
|
||
| - name: Rename artifact (Windows) | ||
| if: runner.os == 'Windows' | ||
| shell: pwsh | ||
| run: | | ||
| Move-Item "dist\\${env:APP_NAME}.exe" "dist\\${env:APP_NAME}-pyinstaller-${{ steps.version.outputs.version }}-${{ matrix.platform }}${{ matrix.ext }}" | ||
|
|
||
| - name: Upload artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: ${{ env.APP_NAME }}-pyinstaller-${{ steps.version.outputs.version }}-${{ matrix.platform }}${{ matrix.ext }} | ||
| path: dist/${{ env.APP_NAME }}-pyinstaller-${{ steps.version.outputs.version }}-${{ matrix.platform }}${{ matrix.ext }} | ||
| retention-days: 30 | ||
|
|
||
| release: | ||
| name: Create Release (PyInstaller) | ||
| needs: build | ||
| runs-on: ubuntu-latest | ||
| if: startsWith(github.ref, 'refs/tags/v') | ||
|
|
||
| steps: | ||
| - name: Download all artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| path: artifacts/ | ||
|
|
||
| - name: Display artifacts | ||
| run: find artifacts/ -type f | ||
|
|
||
| - name: Create GitHub Release | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| name: ${{ env.APP_NAME }} ${{ github.ref_name }} (PyInstaller) | ||
| body: | | ||
| ## ${{ env.APP_NAME }} ${{ github.ref_name }} (PyInstaller Build) | ||
|
|
||
| ### Downloads | ||
| - Linux (x64): `${{ env.APP_NAME }}-pyinstaller-${{ github.ref_name }}-linux-amd64` | ||
| - Linux (ARM64): `${{ env.APP_NAME }}-pyinstaller-${{ github.ref_name }}-linux-arm64` | ||
| - macOS (Apple Silicon): `${{ env.APP_NAME }}-pyinstaller-${{ github.ref_name }}-macos-arm64` | ||
| - Windows (x64): `${{ env.APP_NAME }}-pyinstaller-${{ github.ref_name }}-windows-amd64.exe` | ||
|
|
||
| ### Build Info | ||
| - Builder: PyInstaller | ||
| - Python: ${{ env.PYTHON_VERSION }} | ||
| files: | | ||
| artifacts/** | ||
| generate_release_notes: true | ||
| draft: false | ||
| prerelease: ${{ contains(github.ref_name, 'alpha') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'rc') }} | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The workflow defines a version input for workflow_dispatch events but never uses it. The version is always derived from the git reference in the build job (if present), but there's no step to resolve the version like in the PyInstaller workflow. Consider either using the input.version value when provided, or removing the unused input parameter.