Feature/python build #25

Merged
shenjackyuanjie merged 28 commits from feature/python_build into main 2023-06-10 19:02:01 +08:00
Showing only changes of commit 71410eb2e8 - Show all commits

View File

@ -43,20 +43,6 @@ jobs:
- name: Checkout code
uses: nschloe/action-cached-lfs-checkout@v1
# 获取短 sha
- name: Get short commit sha
id: get_short_sha
shell: pwsh
run: |
# short_sha=$(echo ${GITHUB_SHA} | cut -c1-7)
# echo "short_sha=$short_sha" >> $GITHUB_OUTPUT
# echo $GITHUB_OUTPUT
$short_sha = Write-Output $env:GITHUB_SHA
$short_sha = $short_sha.substring(1,7)
Write-Output $short_sha
Write-Output "short_sha=$short_sha" >> $env:GITHUB_ENV
# 安装 Python
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
@ -95,83 +81,49 @@ jobs:
Write-Output $infos >> $env:GITHUB_ENV
python .github/workflows/get_info.py
# 还是得我自己写脚本
- name: Build on Windows
if: runner.os == 'Windows'
# 使用新的 nuitka_build.py
- name: Build by nuitka
shell: pwsh
run: |
$arg = @()
# 输出配置
$arg += @("--standalone")
$arg += @("--output-dir=build")
$arg += @("--company-name=tool-shenjack-workshop")
$arg += @("--product-name=Difficult-Rocket")
$arg += @("--product-version=$env:DR_version")
$arg += @("--file-version=$env:Build_version")
$arg += @("--file-description=Difficult-Rocket!")
$arg += @("--windows-icon-from-ico=textures/icon.png")
# $arg += @("--macos-app-icon=textures/icon.png")
# 编译器配置
$arg += @("--msvc=latest")
$arg += @("--clang")
$arg += @("--lto=no")
# 包配置
$arg += @("--nofollow-import-to=objprint,pillow,PIL,cffi")
$arg += @("--follow-import-to=pyglet")
# 数据配置
$arg += @("--include-data-dir=./textures=./textures")
$arg += @("--include-data-dir=./configs=./configs")
# 编译配置
$arg += @("--disable-ccache")
$arg += @("--assume-yes-for-download")
python -m nuitka $arg DR.py
python nuitka_build.py --github
# 集成的构建脚本 好耶!
- name: Build on MacOS / Linux
if: ${{ runner.os == 'macOS' || runner.os == 'Linux' }}
# - name: after build
# shell: pwsh
# run: |
# Get-ChildItem libs/fonts/Fira_Code -Recurse | Remove-Item -Force
# Get-ChildItem libs/fonts/scientifica -Recurse | Remove-Item -Force
# Remove-Item libs/fonts/Monocraft.otf -Force
# Remove-Item libs/fonts/SmileySans-Oblique.ttf -Force
# Get-ChildItem libs/fonts/HarmonyOS_Sans/HarmonyOS_Sans_Condensed/* -Recurse | Remove-Item -Force
# Get-ChildItem libs/fonts/HarmonyOS_Sans/HarmonyOS_Sans/* -Recurse | Remove-Item -Force
#
# Copy-Item libs/fonts build\DR.dist\libs\fonts -Recurse
# # Copy-Item libs\pyglet\ build\DR.dist -Recurse
#
# Rename-Item build/DR.dist Difficult-Rocket
# python ./.github/workflows/post_compile.py
upload-artifact:
runs-on: ubuntu-latest
needs:
- build-nuitka
steps:
# 获取短 sha
- name: Get short commit sha
id: get_short_sha
shell: pwsh
run: |
$arg = @()
# 输出配置
$arg += @("--standalone")
$arg += @("--output-dir=build")
$arg += @("--company-name=tool-shenjack-workshop")
$arg += @("--product-name=Difficult-Rocket")
$arg += @("--product-version=$env:DR_version")
$arg += @("--file-version=$env:Build_version")
$arg += @("--file-description=Difficult-Rocket!")
# $arg += @("--windows-icon-from-ico=textures/icon.png")
$arg += @("--macos-app-icon=textures/icon.png")
# 编译器配置
$arg += @("--clang")
$arg += @("--lto=no")
# 包配置
$arg += @("--nofollow-import-to=objprint,pillow,PIL,cffi")
$arg += @("--follow-import-to=pyglet")
# 数据配置
$arg += @("--include-data-dir=./textures=./textures")
$arg += @("--include-data-dir=./configs=./configs")
# 编译配置
$arg += @("--disable-ccache")
$arg += @("--assume-yes-for-download")
python -m nuitka $arg DR.py
$short_sha = Write-Output $env:GITHUB_SHA
$short_sha = $short_sha.substring(1,7)
Write-Output $short_sha
Write-Output "short_sha=$short_sha" >> $env:GITHUB_ENV
- name: after build
shell: pwsh
run: |
Get-ChildItem libs/fonts/Fira_Code -Recurse | Remove-Item -Force
Get-ChildItem libs/fonts/scientifica -Recurse | Remove-Item -Force
Remove-Item libs/fonts/Monocraft.otf -Force
Remove-Item libs/fonts/SmileySans-Oblique.ttf -Force
Get-ChildItem libs/fonts/HarmonyOS_Sans/HarmonyOS_Sans_Condensed/* -Recurse | Remove-Item -Force
Get-ChildItem libs/fonts/HarmonyOS_Sans/HarmonyOS_Sans/* -Recurse | Remove-Item -Force
Copy-Item libs/fonts build\DR.dist\libs\fonts -Recurse
# Copy-Item libs\pyglet\ build\DR.dist -Recurse
Rename-Item build/DR.dist Difficult-Rocket
python ./.github/workflows/post_compile.py
# Uploads artifact
# Uploads artifact
- name: Upload Artifact
uses: actions/upload-artifact@v3
with: