windows初步采用nuitka打包,减小约一半体积 #202
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
| # This workflow will install Python dependencies, run tests and lint with a single version of Python | |
| # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
| name: CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| macos: | |
| runs-on: macos-latest | |
| env: | |
| PACKAGENAME: bika_macos_universal2 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pyinstaller | |
| pip install https://github.com/tonquer/waifu2x-vulkan/releases/download/v1.1.6/sr_ncnn_vulkan-1.2.0-cp36.cp37.cp38.cp39.cp310.cp311.cp312.cp313-none-macosx_10_9_universal2.whl | |
| cd script | |
| pip install delocate wheel_filename | |
| python build_universal2.py pillow | |
| pip install *.whl | |
| cd .. | |
| pip install -r src/requirements_macos.txt | |
| brew install create-dmg | |
| - name: Build | |
| run: | | |
| cd src | |
| cd db | |
| rm -rf book.db | |
| wget https://github.com/bika-robot/picacg-database/releases/download/v1.5.3/book.db | |
| cd .. | |
| cp ../res/icon/Icon.icns ./ | |
| pyinstaller --target-architecture=universal2 --clean --onedir --name PicACG \ | |
| --hidden-import sr_ncnn_vulkan --hidden-import PySide6 --hidden-import requests \ | |
| --hidden-import urllib3 --hidden-import websocket-client --hidden-import pillow \ | |
| --hidden-import config \ | |
| --hidden-import component \ | |
| --hidden-import server \ | |
| --hidden-import task \ | |
| --hidden-import tools \ | |
| --hidden-import view \ | |
| --strip --windowed -i Icon.icns \ | |
| start.py | |
| cp -avf db dist/PicACG.app/Contents/Frameworks | |
| xattr -cr dist/PicACG.app | |
| create-dmg --volname "PicACG" --volicon "Icon.icns" --icon "PicACG.app" 200 190 \ | |
| --window-pos 200 120 \ | |
| --window-size 800 400 \ | |
| --icon-size 100 \ | |
| --hide-extension "PicACG.app" --app-drop-link 600 185 \ | |
| ${{ env.PACKAGENAME }}.dmg dist/PicACG.app | |
| zip -9 bika.zip ${{ env.PACKAGENAME }}.dmg | |
| mv ${{ env.PACKAGENAME }}.dmg .. | |
| mv bika.zip .. | |
| cd .. | |
| - name: Upload | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.PACKAGENAME }} | |
| path: bika.zip | |
| retention-days: 7 | |
| macos-nosr: | |
| runs-on: macos-latest | |
| env: | |
| PACKAGENAME: bika_nosr_macos_universal2 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pyinstaller | |
| cd script | |
| pip install delocate wheel_filename | |
| python build_universal2.py pillow | |
| pip install *.whl | |
| cd .. | |
| pip install -r src/requirements_macos.txt | |
| brew install create-dmg | |
| - name: Build | |
| run: | | |
| cd src | |
| cd db | |
| rm -rf book.db | |
| wget https://github.com/bika-robot/picacg-database/releases/download/v1.5.3/book.db | |
| cd .. | |
| cp ../res/icon/Icon.icns ./ | |
| pyinstaller --target-architecture=universal2 --clean --onedir --name PicACG \ | |
| --hidden-import sr_ncnn_vulkan --hidden-import PySide6 --hidden-import requests \ | |
| --hidden-import urllib3 --hidden-import websocket-client --hidden-import pillow \ | |
| --hidden-import config \ | |
| --hidden-import component \ | |
| --hidden-import server \ | |
| --hidden-import task \ | |
| --hidden-import tools \ | |
| --hidden-import view \ | |
| --strip --windowed -i Icon.icns \ | |
| start.py | |
| cp -avf db dist/PicACG.app/Contents/Frameworks | |
| xattr -cr dist/PicACG.app | |
| create-dmg --volname "PicACG" --volicon "Icon.icns" --icon "PicACG.app" 200 190 \ | |
| --window-pos 200 120 \ | |
| --window-size 800 400 \ | |
| --icon-size 100 \ | |
| --hide-extension "PicACG.app" --app-drop-link 600 185 \ | |
| ${{ env.PACKAGENAME }}.dmg dist/PicACG.app | |
| zip -9 bika.zip ${{ env.PACKAGENAME }}.dmg | |
| mv ${{ env.PACKAGENAME }}.dmg .. | |
| mv bika.zip .. | |
| cd .. | |
| - name: Upload | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.PACKAGENAME }} | |
| path: bika.zip | |
| retention-days: 7 | |
| windows: | |
| runs-on: windows-latest | |
| env: | |
| PACKAGENAME: bika_py39_windows_x64 | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Set up Python 3.9 | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: 3.9 | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pyinstaller | |
| pip install https://github.com/tonquer/waifu2x-vulkan/releases/download/v1.1.6/sr_ncnn_vulkan-1.2.0-cp36.cp37.cp38.cp39.cp310.cp311-none-win_amd64.whl | |
| pip install -r src\requirements.txt | |
| - name: Build | |
| run: | | |
| cd src | |
| cd db | |
| Remove-Item book.db | |
| Invoke-WebRequest -Uri "https://github.com/bika-robot/picacg-database/releases/download/v1.5.3/book.db" -OutFile "book.db" | |
| cd .. | |
| cp ..\res\icon\icon.ico .\ | |
| pyinstaller -F -w -i icon.ico start.py | |
| mv dist bika | |
| Copy-Item -Verbose -Recurse -Path db -Destination bika/ | |
| cp ..\LICENSE bika\ | |
| cp ..\CHANGELOG bika\ | |
| cd .. | |
| mkdir ${{ env.PACKAGENAME }} | |
| mv src\bika ${{ env.PACKAGENAME }} | |
| 7z a -r "$($Env:PACKAGENAME + '.zip')" "bika" | |
| - name: Upload | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.PACKAGENAME }} | |
| path: ${{ env.PACKAGENAME }} | |
| retention-days: 7 | |
| windows-nosr: | |
| runs-on: windows-latest | |
| env: | |
| PACKAGENAME: bika_py39_nosr_windows_x64 | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Set up Python 3.9 | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: 3.9 | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pyinstaller | |
| pip install -r src\requirements.txt | |
| - name: Build | |
| run: | | |
| cd src | |
| cd db | |
| Remove-Item book.db | |
| Invoke-WebRequest -Uri "https://github.com/bika-robot/picacg-database/releases/download/v1.5.3/book.db" -OutFile "book.db" | |
| cd .. | |
| cp ..\res\icon\icon.ico .\ | |
| pyinstaller -F -w -i icon.ico start.py | |
| mv dist bika | |
| Copy-Item -Verbose -Recurse -Path db -Destination bika/ | |
| cp ..\LICENSE bika\ | |
| cp ..\CHANGELOG bika\ | |
| cd .. | |
| mkdir ${{ env.PACKAGENAME }} | |
| mv src\bika ${{ env.PACKAGENAME }} | |
| 7z a -r "$($Env:PACKAGENAME + '.zip')" "bika" | |
| - name: Upload | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.PACKAGENAME }} | |
| path: ${{ env.PACKAGENAME }} | |
| retention-days: 7 | |
| windows7: | |
| runs-on: windows-latest | |
| env: | |
| PACKAGENAME: bika_py38_windows7_x64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python 3.8 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.8 | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pyinstaller==4.6 | |
| pip install https://github.com/tonquer/waifu2x-vulkan/releases/download/v1.1.6/sr_ncnn_vulkan-1.2.0-cp36.cp37.cp38.cp39.cp310.cp311-none-win_amd64.whl | |
| pip install -r src\requirements_win7.txt | |
| - name: Build | |
| run: | | |
| cd src | |
| cd db | |
| Remove-Item book.db | |
| Invoke-WebRequest -Uri "https://github.com/bika-robot/picacg-database/releases/download/v1.5.3/book.db" -OutFile "book.db" | |
| cd .. | |
| cp ..\res\icon\icon.ico .\ | |
| pyinstaller -F -w -i icon.ico start.py | |
| mv dist bika | |
| Copy-Item -Verbose -Recurse -Path db -Destination bika/ | |
| cp ..\LICENSE bika\ | |
| cp ..\CHANGELOG bika\ | |
| cd .. | |
| mkdir ${{ env.PACKAGENAME }} | |
| mv src\bika ${{ env.PACKAGENAME }} | |
| 7z a -r "$($Env:PACKAGENAME + '.zip')" "bika" | |
| - name: Upload | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.PACKAGENAME }} | |
| path: ${{ env.PACKAGENAME }} | |
| retention-days: 7 | |
| windows7-nosr: | |
| runs-on: windows-latest | |
| env: | |
| PACKAGENAME: bika_py38_nosr_windows7_x64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python 3.8 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.8 | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pyinstaller==4.6 | |
| pip install -r src\requirements_win7.txt | |
| - name: Build | |
| run: | | |
| cd src | |
| cd db | |
| Remove-Item book.db | |
| Invoke-WebRequest -Uri "https://github.com/bika-robot/picacg-database/releases/download/v1.5.3/book.db" -OutFile "book.db" | |
| cd .. | |
| cp ..\res\icon\icon.ico .\ | |
| pyinstaller -F -w -i icon.ico start.py | |
| mv dist bika | |
| Copy-Item -Verbose -Recurse -Path db -Destination bika/ | |
| cp ..\LICENSE bika\ | |
| cp ..\CHANGELOG bika\ | |
| cd .. | |
| mkdir ${{ env.PACKAGENAME }} | |
| mv src\bika ${{ env.PACKAGENAME }} | |
| 7z a -r "$($Env:PACKAGENAME + '.zip')" "bika" | |
| - name: Upload | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.PACKAGENAME }} | |
| path: ${{ env.PACKAGENAME }} | |
| retention-days: 7 | |
| ubuntu: | |
| runs-on: ubuntu-latest | |
| env: | |
| PACKAGENAME: bika_py39_linux | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python 3.9 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.9 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get install -y fuse libfuse2 | |
| python -m pip install --upgrade pip | |
| pip install pyinstaller | |
| pip install https://github.com/tonquer/waifu2x-vulkan/releases/download/v1.1.6/sr_ncnn_vulkan-1.2.0-cp37-abi3-linux_x86_64.whl | |
| pip install -r src/requirements.txt | |
| - name: Build | |
| run: | | |
| cd src | |
| pyinstaller -w start.py | |
| cd db | |
| rm -rf book.db | |
| wget https://github.com/bika-robot/picacg-database/releases/download/v1.5.3/book.db | |
| cd .. | |
| cd dist | |
| mkdir -p picacg.AppRun/usr/bin | |
| wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage | |
| chmod +x appimagetool-x86_64.AppImage | |
| cp -r ../../res/appimage/* picacg.AppRun/ | |
| cp -r ../../res/icon/logo_round.png picacg.AppRun/PicACG.png | |
| cp -r start/* picacg.AppRun/usr/bin/ | |
| cp -r ../db picacg.AppRun/ | |
| mv picacg.AppRun/usr/bin/start picacg.AppRun/usr/bin/PicACG | |
| chmod +x picacg.AppRun/AppRun | |
| chmod +x picacg.AppRun/usr/bin/PicACG | |
| ./appimagetool-x86_64.AppImage picacg.AppRun | |
| mv PicACG-x86_64.AppImage ../../${{ env.PACKAGENAME }}-x86_64.AppImage | |
| cd ../.. | |
| - name: Upload | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.PACKAGENAME }} | |
| path: ${{ env.PACKAGENAME }}-x86_64.AppImage | |
| retention-days: 7 |