try new compile action

This commit is contained in:
shenjack 2023-06-10 15:39:50 +08:00
parent 69e16e1cc0
commit 71410eb2e8

View File

@ -43,20 +43,6 @@ jobs:
- name: Checkout code - name: Checkout code
uses: nschloe/action-cached-lfs-checkout@v1 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 # 安装 Python
- name: Setup Python ${{ matrix.python-version }} - name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4 uses: actions/setup-python@v4
@ -95,83 +81,49 @@ jobs:
Write-Output $infos >> $env:GITHUB_ENV Write-Output $infos >> $env:GITHUB_ENV
python .github/workflows/get_info.py python .github/workflows/get_info.py
# 还是得我自己写脚本 # 使用新的 nuitka_build.py
- name: Build on Windows - name: Build by nuitka
if: runner.os == 'Windows'
shell: pwsh shell: pwsh
run: | run: |
$arg = @() python nuitka_build.py --github
# 输出配置 # 集成的构建脚本 好耶!
$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
- name: Build on MacOS / Linux # - name: after build
if: ${{ runner.os == 'macOS' || runner.os == 'Linux' }} # 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 shell: pwsh
run: | run: |
$arg = @() $short_sha = Write-Output $env:GITHUB_SHA
# 输出配置 $short_sha = $short_sha.substring(1,7)
$arg += @("--standalone") Write-Output $short_sha
$arg += @("--output-dir=build") Write-Output "short_sha=$short_sha" >> $env:GITHUB_ENV
$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
- name: after build # Uploads artifact
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
- name: Upload Artifact - name: Upload Artifact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with: