feat: try some script

This commit is contained in:
shenjack 2022-12-29 11:15:00 +08:00
parent f639584f46
commit ff15d5ae98
3 changed files with 60 additions and 18 deletions

View File

@ -26,6 +26,7 @@ jobs:
- name: Check out - name: Check out
uses: actions/checkout@v3 uses: actions/checkout@v3
# 安装 Python
- name: Setup Python - name: Setup Python
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
@ -39,22 +40,55 @@ jobs:
run: pip install -r requirement.txt run: pip install -r requirement.txt
# Build python script into a stand-alone exe # # Build python script into a stand-alone exe
- name: Build # - name: Build
uses: Nuitka/Nuitka-Action@v0.4 # uses: Nuitka/Nuitka-Action@v0.4
with: # with:
script-name: DR.py # script-name: DR.py
standalone: true # standalone: true
include-package-data: './configs=./configs' # onefile: false
assume-yes-for-download: true ## include-package-data: './configs=./configs'
# assume-yes-for-download: true
# 还是得我自己写脚本
- name: Build on Windows
if: runner.os == 'Windows'
shell: powershell
run: |
$arg = "--standalone --assume-yes-for-download "
$arg += "--msvc=latest --clang --lto=no "
$arg += "--nofollow-import-to=objprint,numpy,pillow,cffi,PIL,pyglet "
$arg += "--include-data-dir=./libs/pyglet=./pyglet "
$arg += "--include-data-dir=./libs/fonts=./libs/fonts "
$arg += "--include-data-dir=./textures=./textures "
$arg += "--include-data-dir=./configs=./configs "
python -m nuitka $arg DR.py
- name: Build on MacOS / Linux
if: ${{ runner.os == 'macOS' || runner.os == 'Linux' }}
shell: bash
run: |
arg = "--standalone --assume-yes-for-download "
arg += "--clang --lto=no "
arg += "--nofollow-import-to=objprint,numpy,pillow,cffi,PIL,pyglet "
arg += "--include-data-dir=./libs/pyglet=./pyglet "
arg += "--include-data-dir=./libs/fonts=./libs/fonts "
arg += "--include-data-dir=./textures=./textures "
arg += "--include-data-dir=./configs=./configs "
python -m nuitka $arg DR.py
- name: after build
shell: powershell7
run: |
python after_compile.py
# Uploads artifact # # Uploads artifact
- name: Upload Artifact # - name: Upload Artifact
uses: actions/upload-artifact@v3 # uses: actions/upload-artifact@v3
with: # with:
name: ${{ runner.os }} Build # name: ${{ runner.os }} Build
path: | # path: |
build/*.exe # build/*.exe
build/*.bin # build/*.bin
build/*.app/**/* # build/*.app/**/*

8
after_compile.py Normal file
View File

@ -0,0 +1,8 @@
# -------------------------------
# Difficult Rocket
# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com
# All rights reserved
# -------------------------------
import os
print(os.listdir('./build'))

View File

@ -1,6 +1,6 @@
$start_time = Get-Uptime $start_time = Get-Uptime
Write-Output $start_time Write-Output $start_time
python3.8.exe -m nuitka --jobs=24 --msvc=latest --clang --lto=no --show-memory --show-progress --output-dir=build/nuitka1 --include-data-dir=./configs=./configs --include-data-dir=./libs/fonts=./libs/fonts --include-data-dir=./textures=./textures --include-data-dir=./libs/pyglet=./pyglet --enable-plugin=numpy --nofollow-import-to=objprint,numpy,pillow,cffi,PIL,pyglet --standalone $args .\DR.py python3.8.exe -m nuitka --jobs=24 --msvc=latest --clang --lto=no --show-memory --show-progress --output-dir=build/nuitka1 --include-data-dir=./configs=./configs --include-data-dir=./libs/fonts=./libs/fonts --include-data-dir=./textures=./textures --include-data-dir=./libs/pyglet=./pyglet --nofollow-import-to=objprint,numpy,pillow,cffi,PIL,pyglet --standalone $args .\DR.py
$end_time = Get-Uptime $end_time = Get-Uptime
$out = $end_time.TotalMilliseconds - $start_time.TotalMilliseconds $out = $end_time.TotalMilliseconds - $start_time.TotalMilliseconds
Write-Output $end_time.TotalSeconds $start_time.TotalSeconds $out s Write-Output $end_time.TotalSeconds $start_time.TotalSeconds $out s