Make Bundle for Toolbox and FlexTool #45
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Make Bundle for Toolbox and FlexTool | |
on: | |
workflow_dispatch: | |
inputs: | |
git-ref: | |
description: "Git branch, tag or SHA to bundle." | |
required: true | |
type: string | |
default: "" | |
jobs: | |
bundle: | |
name: Bundle | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ inputs.git-ref }} | |
fetch-depth: 0 | |
repository: spine-tools/Spine-Toolbox | |
- name: "Set up Python" | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12.7" | |
cache: pip | |
cache-dependency-path: | | |
pyproject.toml | |
requirements.txt | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install numpy # See issue #2852. Remove when PyInstaller supports numpy 2.0+ | |
python -m pip install -r requirements.txt | |
- name: Install PyInstaller | |
run: | | |
python -m pip install PyInstaller | |
- name: List packages | |
run: | |
python -m pip list | |
- name: Download embeddable Python | |
run: | | |
mkdir embedded-python | |
cd embedded-python | |
ls | |
curl -o python.zip https://www.python.org/ftp/python/3.12.7/python-3.12.7-embed-amd64.zip | |
tar xf python.zip | |
del python.zip | |
- name: Edit embedded Python search paths | |
run: | | |
cd embedded-python | |
Add-Content ./*._pth "Lib" | |
Add-Content ./*._pth "Lib/site-packages" | |
cat ./*._pth | |
- name: Download get-pip.py | |
run: | | |
cd embedded-python | |
curl -sSL https://bootstrap.pypa.io/get-pip.py -o get-pip.py | |
- name: Install pip for embedded Python | |
run : | | |
cd embedded-python | |
./python.exe get-pip.py | |
- name: List packages in embedded Python | |
run: | | |
cd embedded-python/Scripts | |
./pip.exe list | |
- name: Add pandas and spinedb-api | |
run: | | |
cd embedded-python/Scripts | |
./pip.exe --version | |
./pip.exe install pandas | |
./pip.exe install spinedb-api | |
- name: Copy pandas and spinedb-api to embedded side | |
run: | | |
which python | |
which pip | |
ls | |
cd embedded-python | |
ls | |
cd Lib/site-packages | |
ls | |
cd C:/hostedtoolcache/windows/Python/3.12.7/x64/lib/site-packages | |
ls | |
# - name: copy pandas and spinedb-pi | |
# run: | | |
# cp -r C:/hostedtoolcache/windows/Python/3.12.7/x64/lib/site-packages/pandas* "dist/Spine Toolbox/Python/Lib/site-packages" | |
# cp -r C:/hostedtoolcache/windows/Python/3.12.7/x64/lib/site-packages/spinedb_api* "dist/Spine Toolbox/Python/Lib/site-packages" | |
# cp -r C:/hostedtoolcache/windows/Python/3.12.7/x64/lib/site-packages/numpy* "dist/Spine Toolbox/Python/Lib/site-packages" | |
# - name: Build bundle | |
# run: | | |
# python -m PyInstaller --paths=./python/Lib/site-packages | |
- name: Get Toolbox version | |
id: toolbox-version | |
shell: bash | |
run: | | |
python -c "from importlib.metadata import version; print('version=' + version('spinetoolbox'))" >> $GITHUB_OUTPUT | |
- name: Install FlexTool | |
run: | | |
ls | |
cd "dist/Spine Toolbox" | |
git clone -b structural_update https://github.com/irena-flextool/flextool.git --depth=1 | |
- name: Update FlexTool | |
run: | | |
cd "dist/Spine Toolbox/flextool" | |
python update_flextool.py --skip-git | |
- name: Upload archive with artifact v4 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: FlexTool-Toolbox-win-${{ steps.toolbox-version.outputs.version }} | |
path: "./dist/Spine Toolbox" | |
if-no-files-found: error | |
include-hidden-files: true |