Skip to content

Commit

Permalink
增加github action
Browse files Browse the repository at this point in the history
  • Loading branch information
FishHawk committed Oct 28, 2024
1 parent d884d39 commit d17c129
Show file tree
Hide file tree
Showing 12 changed files with 127 additions and 17 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: build

on:
workflow_dispatch: # allows manual triggering
inputs:
create_release:
description: "Create new release"
required: true
type: boolean
push:
branches:
- main
paths: [".github/workflows/build.yml", "main.spec", "**/*.py"]
pull_request:
types: [opened, synchronize, reopened]
paths: ["**/*.py"]

jobs:
windows-latest:
runs-on: windows-latest

steps:
- name: Clone
id: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

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

- name: Install Python Environment
id: pyenv
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: Build
id: pyinstaller_build
shell: powershell
run: |
pyinstaller --clean --noconfirm main.spec
Rename-Item -Path "dist\main.exe" -NewName "Sakura_Launcher_GUI_${GITHUB_SHA}.exe"
- name: Upload artifacts
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/main' ) || github.event.inputs.create_release == 'true' }}
uses: actions/upload-artifact@v4
with:
path: |
dist
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,5 @@ __pycache__
/Release
llama
sakura-launcher_config.json
main.spec
*.gguf
*.log
native.dll
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<p align="center">
<a href="https://github.com/PiDanShouRouZhouXD/Sakura_Launcher_GUI/">
<img src="icon.png" alt="Logo" width="80" height="80">
<img src="icon.ico" alt="Logo" width="80" height="80">
</a>

<h3 align="center">Sakura Launcher GUI</h3>
Expand Down
4 changes: 2 additions & 2 deletions dist.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pyinstaller -F main.py -w `
--icon="icon.png" `
--add-data "icon.png:." `
--icon="icon.ico" `
--add-data "icon.ico:." `
--add-data "cloudflared-windows-amd64.exe:." `
--hidden-import=tiktoken_ext.openai_public `
--hidden-import=tiktoken_ext `
Expand Down
11 changes: 11 additions & 0 deletions dist.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
pyinstaller -n main -F main.py -w \
--icon=icon.ico \
--add-data "icon.ico:." \
--add-data "cloudflared-windows-amd64.exe:." \
--hidden-import=tiktoken_ext.openai_public \
--hidden-import=tiktoken_ext \
--hidden-import=PySide6 \
--hidden-import=PySide6.QtCore \
--hidden-import=PySide6.QtGui \
--hidden-import=qfluentwidgets \
--clean
Binary file added icon.ico
Binary file not shown.
Binary file removed icon.png
Binary file not shown.
8 changes: 0 additions & 8 deletions justfile

This file was deleted.

59 changes: 59 additions & 0 deletions main.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# -*- mode: python ; coding: utf-8 -*-


a = Analysis(
['main.py'],
pathex=[],
binaries=[],
datas=[('icon.ico', '.'), ('cloudflared-windows-amd64.exe', '.')],
hiddenimports=['tiktoken_ext.openai_public', 'tiktoken_ext', 'PySide6', 'PySide6.QtCore', 'PySide6.QtGui', 'qfluentwidgets'],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
noarchive=False,
optimize=0,
)
exclude_prefix = [
'PySide6\\opengl32sw.dll',
'PySide6\\Qt6Pdf.dll',
'PySide6\\Qt6Network.dll',
'PySide6\\Qt6VirtualKeyboard.dll',
'PySide6\\Qt6Qml.dll',
'PySide6\\Qt6Quick.dll',
'PySide6\\Qt6OpenGL.dll',
'PySide6\\Qt6QmlModels.dll',
'PySide6\\translations',
'Pythonwin',
# QNetwork前置依赖
'libcrypto-3-x64.dll',
'libssl-3-x64.dll',
]
def should_include(t):
return not any(t[0].startswith(prefix) for prefix in exclude_prefix)
a.binaries = filter(should_include, a.binaries)
a.datas = filter(should_include, a.datas)

pyz = PYZ(a.pure)

exe = EXE(
pyz,
a.scripts,
a.binaries,
a.datas,
[],
name='main',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=False,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
icon=['icon.ico'],
)
1 change: 0 additions & 1 deletion pyinstaller.txt

This file was deleted.

3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
numpy<2
PySide6==6.6.2
PySide6-Fluent-Widgets[full]
PySide6-Fluent-Widgets
wmi
requests
py7zr
Expand Down
2 changes: 1 addition & 1 deletion src/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def get_self_path():


CURRENT_DIR = get_self_path()
ICON_FILE = "icon.png"
ICON_FILE = "icon.ico"
CLOUDFLARED = "cloudflared-windows-amd64.exe"
SAKURA_LAUNCHER_GUI_VERSION = "v1.0.0-beta"

Expand Down

0 comments on commit d17c129

Please sign in to comment.