Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] CICD: add github action to release portable exectuable zip #9115

Closed
wants to merge 14 commits into from
24 changes: 24 additions & 0 deletions .github/workflows/bigdl-release-portable-executable-zip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: BigDL Release Portable Executable Zip

on:
push:
branches: [main]
paths:
- ".github/workflows/bigdl-release-portable-executable-zip.yml"
- "python/llm/portable-executable/**"
pull_request:
branches: [main]
paths:
- ".github/workflows/bigdl-release-portable-executable-zip.yml"
- "python/llm/portable-executable/**"
workflow_dispatch:

jobs:
build-zip:
runs-on: [self-hosted, llm, windows]

steps:
- uses: actions/checkout@v3
- name: run bat
run: '& ./python/llm/portable-zip/setup.bat'
shell: powershell
18 changes: 9 additions & 9 deletions python/llm/portable-zip/setup.bat
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
:: download python and extract zip
powershell -Command "Start-BitsTransfer -Source https://www.python.org/ftp/python/3.9.13/python-3.9.13-embed-amd64.zip -Destination python-3.9.13-embed-amd64.zip"
powershell -Command "Expand-Archive .\python-3.9.13-embed-amd64.zip -DestinationPath .\python-embed"
powershell -Command "Start-BitsTransfer -Source https://www.python.org/ftp/python/3.9.13/python-3.9.13-embed-amd64.zip -Destination .\python\llm\portable-zip\python-3.9.13-embed-amd64.zip"
powershell -Command "Expand-Archive .\python\llm\portable-zip\python-3.9.13-embed-amd64.zip -DestinationPath .\python\llm\portable-zip\python-embed"
del .\python-3.9.13-embed-amd64.zip

set "python-embed=.\python-embed\python.exe"
set "python-embed=.\python\llm\portable-zip\python-embed\python.exe"

:: download get-pip.py and install
powershell -Command "Invoke-WebRequest https://bootstrap.pypa.io/get-pip.py -OutFile .\python-embed\get-pip.py"
%python-embed% .\python-embed\get-pip.py
powershell -Command "Invoke-WebRequest https://bootstrap.pypa.io/get-pip.py -OutFile .\python\llm\portable-zip\python-embed\get-pip.py"
%python-embed% .\python\llm\portable-zip\python-embed\get-pip.py

:: enable run site.main() automatically
cd .\python-embed
@REM cd .\python\llm\portable-zip\python-embed
set "search=#import site"
set "replace=import site"
powershell -Command "(gc python39._pth) -replace '%search%', '%replace%' | Out-File -encoding ASCII python39._pth"
cd ..
powershell -Command "(gc .\python\llm\portable-zip\python-embed\python39._pth) -replace '%search%', '%replace%' | Out-File -encoding ASCII .\python\llm\portable-zip\python-embed\python39._pth"
@REM cd ..

:: install pip packages
%python-embed% -m pip install bigdl-llm[all] transformers_stream_generator tiktoken einops colorama

:: compress the python and scripts
powershell -Command "Compress-Archive -Path '.\python-embed', '.\chat.bat', '.\chat.py', '.\README.md' -DestinationPath .\bigdl-llm.zip"
powershell -Command "Compress-Archive -Path '.\python\llm\portable-zip\python-embed', '.\python\llm\portable-zip\chat.bat', '.\python\llm\portable-zip\chat.py', '.\python\llm\portable-zip\README.md' -DestinationPath .\python\llm\portable-zip\bigdl-llm.zip"
Loading