Make Bundle for Toolbox and FlexTool #56
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 spinedb-api | |
- name: Build bundle | |
run: | | |
python -m PyInstaller spinetoolbox.spec -- --embedded-python=embedded-python | |
- 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: | | |
cd "dist/Spine Toolbox" | |
git clone 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: Add flextool start bat-file | |
shell: pwsh | |
run: | | |
cd "dist/Spine Toolbox" | |
$content = 'start "" ./spinetoolbox.exe flextool' | |
Set-Content -Path Flextool.bat -Value @content | |
- 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 |