0
0
mirror of https://github.com/ok-oldking/ok-wuthering-waves.git synced 2025-04-24 08:25:16 +00:00

性能以及界面优化

This commit is contained in:
firedcto@gmail.com 2024-11-27 21:22:21 +08:00
parent 5ef2e807ad
commit 22411a314a
7 changed files with 107 additions and 131 deletions

View File

@ -39,42 +39,49 @@ jobs:
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: Copy ok-script lib
run: |
python -m ok.update.copy_ok_folder
- name: Rename .py files to .pyx
run: |
Get-ChildItem -Path .\src -Recurse -Filter *.py -Exclude '__init__.py' | ForEach-Object { Rename-Item $_.FullName -NewName ($_.FullName -replace '\.py$', '.pyx') }
- name: build cython
run: |
python setup.py build_ext --inplace
Get-ChildItem -Path .\src -Recurse -Filter *.pyx | ForEach-Object { Remove-Item $_.FullName }
Get-ChildItem -Path .\src -Recurse -Filter *.cpp | ForEach-Object { Remove-Item $_.FullName }
- name: Run tests
run: |
python -m ok.test.RunTests
- name: Build Executable
run: |
echo "tag: ${{ steps.changes.outputs.tag }}"
echo "changes: ${{ steps.changes.outputs.changes }}"
python -m ok.update.package_launcher ${{ steps.tagName.outputs.tag }}
python -m ok.update.gen_md5 .\dist
Copy-Item -Path "dist" -Destination "ok-ww" -Recurse
7z a -t7z -r "ok-ww-release-${{ steps.tagName.outputs.tag }}.7z" "ok-ww"
7z a -tzip -r "ok-ww-${{ steps.tagName.outputs.tag }}.zip" "ok-ww"
Remove-Item -Path "ok-ww" -Recurse -Force
python -m ok.update.package_launcher ${{ steps.tagName.outputs.tag }} deploy.txt
python -m ok.update.package_full_with_profile ${{ steps.tagName.outputs.tag }} 1
python -m ok.update.gen_md5 .\dist
Copy-Item -Path "dist" -Destination "ok-ww" -Recurse
7z a -t7z -r "ok-ww-CPU-full-${{ steps.tagName.outputs.tag }}.7z" "ok-ww"
Remove-Item -Path "ok-ww" -Recurse -Force
python -m ok.update.package_full_with_profile ${{ steps.tagName.outputs.tag }} 0
python -m ok.update.gen_md5 .\dist
Copy-Item -Path "dist" -Destination "ok-ww" -Recurse
7z a -t7z -r "ok-ww-Nvidia-GPU-full-${{ steps.tagName.outputs.tag }}.7z" "ok-ww"
Remove-Item -Path "ok-ww" -Recurse -Force
shell: pwsh
- name: Create Release
id: create_release
uses: actions/create-release@v1
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
@ -87,43 +94,15 @@ jobs:
${{ steps.changes.outputs.changes }}
draft: false
prerelease: true
files: |
ok-ww-CPU-full-${{ steps.tagName.outputs.tag }}.7z
ok-ww-Nvidia-GPU-full-${{ steps.tagName.outputs.tag }}.7z
- name: upload-7z
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./ok-ww-release-${{ steps.tagName.outputs.tag }}.7z
asset_name: ok-ww-release-${{ steps.tagName.outputs.tag }}.7z
asset_content_type: application/x-7z-compressed
- name: push to ok-ww-update
run: |
python -m ok.update.push_repos --repos https://ok-oldking:${{ secrets.OK_GH }}@github.com/ok-oldking/ok-ww-update --files src ok config.py launcher.json launcher.py main.py ok-ww.exe main.py main_debug.py main_gpu.py main_gpu_debug.py assets i18n icon.png requirements.txt
- name: upload-zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./ok-ww-${{ steps.tagName.outputs.tag }}.zip
asset_name: ok-ww-${{ steps.tagName.outputs.tag }}.zip
asset_content_type: application/zip
- name: push to coding
run: |
python -m ok.update.push_repos --repos https://${{ secrets.CODING_USERNAME }}:${{ secrets.CODING_PASSWORD }}@e.coding.net/g-frfh1513/ok-wuthering-waves/ok-wuthering-waves.git --files src ok config.py launcher.json launcher.py main.py ok-ww.exe main.py main_debug.py main_gpu.py main_gpu_debug.py assets i18n icon.png requirements.txt
- name: upload-7z-gpu
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./ok-ww-Nvidia-GPU-full-${{ steps.tagName.outputs.tag }}.7z
asset_name: ok-ww-Nvidia-GPU-full-${{ steps.tagName.outputs.tag }}.7z
asset_content_type: application/x-7z-compressed
- name: upload-7z-cpu
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./ok-ww-CPU-full-${{ steps.tagName.outputs.tag }}.7z
asset_name: ok-ww-CPU-full-${{ steps.tagName.outputs.tag }}.7z
asset_content_type: application/x-7z-compressed

View File

@ -1,52 +0,0 @@
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'lts'
- 'v*'
branches:
- master
jobs:
build:
name: push to update repos
runs-on: windows-latest
steps:
- name: Configure git
run: |
git config --global user.email "ok-oldking@users.noreply.github.com"
git config --global user.name "ok-oldking"
- name: Checkout source repository
uses: actions/checkout@v4
with:
token: ${{ secrets.OK_GH }}
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.12' # Use the version of Python you need
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: test
run: |
python -m unittest discover tests
- name: Copy ok-script lib
run: |
python -m ok.update.copy_ok_folder
- name: push to ok-ww-update
run: |
python -m ok.update.push_repos --repos https://ok-oldking:${{ secrets.OK_GH }}@github.com/ok-oldking/ok-ww-update --files src ok config.py launcher.json launcher.py main.py ok-ww.exe main.py main_debug.py main_gpu.py main_gpu_debug.py assets i18n icon.png requirements.txt
- name: push to coding
run: |
python -m ok.update.push_repos --repos https://${{ secrets.CODING_USERNAME }}:${{ secrets.CODING_PASSWORD }}@e.coding.net/g-frfh1513/ok-wuthering-waves/ok-wuthering-waves.git --files src ok config.py launcher.json launcher.py main.py ok-ww.exe main.py main_debug.py main_gpu.py main_gpu_debug.py assets i18n icon.png requirements.txt

View File

@ -1,29 +0,0 @@
name: Remove Source Archives
on:
release:
types: [ published ]
jobs:
remove-source-archives:
runs-on: ubuntu-latest
steps:
- name: Set up GitHub CLI
run: |
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key C99B11DEB97541F0
sudo apt-add-repository https://cli.github.com/packages
sudo apt-get update
sudo apt-get install gh
- name: Authenticate GitHub CLI
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh auth login --with-token <<< "$GITHUB_TOKEN"
- name: Remove Source Archives
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
release_id=$(gh release view ${{ github.event.release.tag_name }} --json id --jq .id)
gh api repos/${{ github.repository }}/releases/$release_id/assets --jq '.[] | select(.name | endswith(".zip") or endswith(".tar.gz")).id' |
xargs -I {} gh api repos/${{ github.repository }}/releases/assets/{} -X DELETE

13
deploy.txt Normal file
View File

@ -0,0 +1,13 @@
src
ok
config.py
launcher.json
launcher.py
main.py
ok-ww.exe
main.py
main_debug.py
main_gpu.py
assets
icon.png
requirements.txt

2
requirements-dev.txt Normal file
View File

@ -0,0 +1,2 @@
cython==3.0.11
setuptools==75.4.0

View File

@ -1,4 +1,4 @@
ok-script==0.0.332
ok-script==0.0.357
#rapidocr_onnxruntime
rapidocr_openvino
pySide6-Fluent-Widgets>=1.5.5

63
setup.py Normal file
View File

@ -0,0 +1,63 @@
import setuptools
from Cython.Build import cythonize
from distutils.extension import Extension
from setuptools import Extension
import os
os.environ["PYTHONIOENCODING"] = "utf-8"
def find_pyx_packages(base_dir):
extensions = []
for dirpath, _, filenames in os.walk(base_dir):
for filename in filenames:
if filename.endswith(".pyx"):
module_path = os.path.join(dirpath, filename).replace('/', '.').replace('\\', '.')
module_name = module_path[:-4] # Remove the .pyx extension
extensions.append(
Extension(name=module_name, language="c++", sources=[os.path.join(dirpath, filename)]))
print(f'add Extension: {module_name} {[os.path.join(dirpath, filename)]}')
return extensions
def find_packages_with_init_files(base_dir):
packages = []
for dirpath, dirnames, filenames in os.walk(base_dir):
if '__init__.py' in filenames:
package = dirpath.replace('/', '.').replace('\\', '.')
packages.append(package)
return packages
base_dir = "src"
extensions = find_pyx_packages(base_dir)
setuptools.setup(
name="ok-ww",
version="0.0.1",
author="ok-oldking",
author_email="firedcto@gmail.com",
description="Automation with Computer Vision for Python",
url="https://github.com/ok-oldking/ok-script",
packages=setuptools.find_packages(),
include_package_data=True,
classifiers=[
"Programming Language :: Python :: 3",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: Microsoft :: Windows",
],
install_requires=[
'pywin32>=306',
'darkdetect>=0.8.0',
'PySideSix-Frameless-Window>=0.4.3',
'typing-extensions>=4.11.0',
'PySide6-Essentials>=6.7.0',
'GitPython>=3.1.43',
'requests>=2.32.3',
'psutil>=6.0.0'
],
python_requires='>=3.9',
ext_modules=cythonize(extensions, compiler_directives={'language_level': "3"})
)