From 72af62649f1e0ffe081a79ac39f37734e2455d1d Mon Sep 17 00:00:00 2001 From: Caelan Sayler Date: Thu, 26 Jun 2025 22:38:17 +0100 Subject: [PATCH] Add unix build script and add to samples CI --- .github/workflows/build-samples.yml | 21 +++++++++++++- samples/PythonWXPython/build.bat | 3 ++ samples/PythonWXPython/build.sh | 45 +++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100755 samples/PythonWXPython/build.sh diff --git a/.github/workflows/build-samples.yml b/.github/workflows/build-samples.yml index af7c7e77..6c83d065 100644 --- a/.github/workflows/build-samples.yml +++ b/.github/workflows/build-samples.yml @@ -7,7 +7,15 @@ jobs: strategy: fail-fast: false matrix: - sample: [CPlusPlusWidgets, CPlusPlusWin32, CSharpAvalonia, CSharpUno, CSharpWpf, NodeJSElectron, RustIced] + sample: + - CPlusPlusWidgets + - CPlusPlusWin32 + - CSharpAvalonia + - CSharpUno + - CSharpWpf + - NodeJSElectron + - PythonWXPython + - RustIced os: [windows-latest, ubuntu-latest, macos-latest] exclude: - os: ubuntu-latest @@ -44,6 +52,16 @@ jobs: sudo apt-cache search libgtk* sudo apt install -y libwxgtk3.2-dev libgtk-3-dev if: ${{ matrix.sample == 'CPlusPlusWidgets' && matrix.os == 'ubuntu-latest' }} + - name: Install uv + run: | + pip install uv + if: ${{ matrix.sample == 'PythonWXPython' }} + - name: Refresh uv.lock for wxPython + working-directory: samples/${{ matrix.sample }} + run: | + rm uv.lock + uv sync --find-links https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-24.04 + if: ${{ matrix.sample == 'PythonWXPython' && matrix.os == 'ubuntu-latest' }} - name: Setup dotnet uses: actions/setup-dotnet@v4 with: @@ -51,6 +69,7 @@ jobs: 6.0.x 8.0.x 9.0.x + if: ${{ startsWith(matrix.sample, 'CSharp') }} - name: Install VPK run: dotnet tool install -g vpk - name: Pack Sample (Windows) diff --git a/samples/PythonWXPython/build.bat b/samples/PythonWXPython/build.bat index 2b395a7f..666f8e62 100644 --- a/samples/PythonWXPython/build.bat +++ b/samples/PythonWXPython/build.bat @@ -12,18 +12,21 @@ cd %~dp0 echo. echo Installing dependencies uv sync +if errorlevel 1 exit /b 1 echo update_url = R"%~dp0releases" > _build_config.py echo. echo Building Python application uv run pyinstaller --onedir --windowed --noconfirm main.py +if errorlevel 1 exit /b 1 echo. echo Building Velopack Release v%~1 mkdir publish 2>nul xcopy /E /I /Y dist\main\* publish\ >nul vpk pack --packId VelopackPythonSampleApp --mainExe main.exe -o releases --packDir publish --packVersion %* +if errorlevel 1 exit /b 1 echo. echo Cleaning up diff --git a/samples/PythonWXPython/build.sh b/samples/PythonWXPython/build.sh new file mode 100755 index 00000000..2202de50 --- /dev/null +++ b/samples/PythonWXPython/build.sh @@ -0,0 +1,45 @@ +#!/bin/bash +set -e + +# Find the absolute path of the script +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +# Check if version parameter is provided +if [ "$#" -lt 1 ]; then + echo "Version number is required." + echo "Usage: ./build.sh [version] [extra_args...]" + exit 1 +fi + +cd "$SCRIPT_DIR" + +# Installing dependencies +echo "" +echo "Installing dependencies..." +uv sync + +# Generate build config +# Note: In Python, we use r'' for raw strings. The path needs to be absolute. +echo "update_url = r'$SCRIPT_DIR/releases'" > _build_config.py + +# Building Python application +echo "" +echo "Building Python application..." +uv run pyinstaller --onedir --windowed --noconfirm main.py + +# Building Velopack Release +echo "" +echo "Building Velopack Release v$1..." +mkdir -p publish +cp -r dist/main/* publish/ +vpk pack --packId VelopackPythonSampleApp --mainExe main -o releases --packDir publish --packVersion "$@" + +# Cleaning up +echo "" +echo "Cleaning up..." +rm -rf build +rm -rf dist +rm -rf publish +rm -f main.spec + +echo "Done."