pypvz/.github/workflows/build-pr.yml
2022-10-30 17:23:59 +08:00

142 lines
5.4 KiB
YAML

name: "Build for PR"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
jobs:
windows:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
python_version:
- "3.11"
- "3.10"
name: Windows Python ${{ matrix.python_version }}
steps:
- uses: actions/checkout@v2
- uses: ilammy/msvc-dev-cmd@v1
- name: Use Python ${{ matrix.python_version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python_version }}
- name: 🧳 Install dependencies
run: |
echo y | pip install --no-python-version-warning --disable-pip-version-check pyinstaller
echo y | pip install --no-python-version-warning --disable-pip-version-check nuitka
echo y | pip install --no-python-version-warning --disable-pip-version-check zstandard
echo y | pip install --no-python-version-warning --disable-pip-version-check pygame
echo y | pip install --no-python-version-warning --disable-pip-version-check ordered-set
# 使用pyinstaller构建
- name: Build pypvz with pyinstaller
run: |
pyinstaller -F pypvz.py `
-n pypvz-with-python${{ matrix.python_version }}-pyinstaller-x64.exe `
--distpath ./out `
--noconsole `
--add-data="resources;./resources" `
--add-data="pypvz-exec-logo.png;./pypvz-exec-logo.png" `
-i ./pypvz.ico
- name: Release the version built by pyinstaller
uses: ncipollo/release-action@v1
with:
allowUpdates: true
tag: Current.Version.Built.with.Pyinstaller
artifacts: ./out/*pyinstaller*.exe
token: ${{ secrets.GITHUB_TOKEN }}
# 使用Nuitka构建
- name: Show nuitka version
run: |
Get-ChildItem env:
python -m nuitka --version
- name: Build pypvz with Nuitka
run: |
echo y | python -m nuitka --standalone `
--onefile `
--show-progress `
--show-memory `
--output-dir=out `
--windows-icon-from-ico=pypvz.ico `
--include-data-dir=resources=resources `
--include-data-file=c:\hostedtoolcache\windows\python\${{ matrix.python_version }}*\x64\lib\site-packages\pygame\libogg-0.dll=libogg-0.dll `
--include-data-file=c:\hostedtoolcache\windows\python\${{ matrix.python_version }}*\x64\lib\site-packages\pygame\libopus-0.dll=libopus-0.dll `
--include-data-file=c:\hostedtoolcache\windows\python\${{ matrix.python_version }}*\x64\lib\site-packages\pygame\libopusfile-0.dll=libopusfile-0.dll `
--include-data-file=c:\hostedtoolcache\windows\python\${{ matrix.python_version }}*\x64\lib\site-packages\pygame\libvorbisfile-3.dll=libvorbisfile-3.dll `
--include-data-file=c:\hostedtoolcache\windows\python\${{ matrix.python_version }}*\x64\lib\site-packages\pygame\libvorbis-0.dll=libvorbis-0.dll `
--windows-disable-console `
-o ./out/pypvz-with-python${{ matrix.python_version }}-nuitka-windows-x64.exe `
pypvz.py
# artifact压缩包处上传包含exe和运行环境的文件夹
- name: "Upload binaries"
uses: actions/upload-artifact@v2
with:
name: artifact-windows-python-${{ matrix.python_version }}
path: ./out/*.dist
#linux:
# runs-on: ubuntu-latest
# strategy:
# fail-fast: false
# matrix:
# python_version:
# - "3.10"
# name: Ubuntu Python ${{ matrix.python_version }}
# steps:
# - name: 🛎️ Checkout
# uses: actions/checkout@v2
# with:
# fetch-depth: 0
# - name: 🐍 Use Python ${{ matrix.python_version }}
# uses: actions/setup-python@v2
# with:
# python-version: ${{ matrix.python_version }}
# - name: 🧳 Install dependencies
# run: |
# sudo apt-get update
# sudo apt-get install patchelf gdb ccache libfuse2
# python -m pip install --no-python-version-warning --disable-pip-version-check zstandard appdirs ordered-set tqdm Jinja2
# python -m pip install --no-python-version-warning --disable-pip-version-check nuitka
# python -m pip install --no-python-version-warning --disable-pip-version-check pygame
# # 使用Nuitka构建
# - name: Show nuitka version
# run: |
# env
# python -m nuitka --version
# - name: Build pypvz with Nuitka
# run: |
# yes | python -m nuitka \
# --show-progress \
# --follow-imports \
# --show-memory \
# --output-dir=out \
# --linux-onefile-icon=pypvz.ico \
# -o ./out/pypvz \
# --remove-output \
# main.py
# cp -r ./resources ./out/resources
# cd out
# tar -cvpaf ../pypvz-with-python${{ matrix.python_version }}-nuitka-linux-x64.tar.zst .
# - name: "Upload binaries"
# uses: actions/upload-artifact@v2
# with:
# name: artifact-windows-python-${{ matrix.python_version }}
# path: ./pypvz-with-python${{ matrix.python_version }}-nuitka-linux-x64.tar.zst