Add unix build script and add to samples CI

This commit is contained in:
Caelan Sayler
2025-06-26 22:38:17 +01:00
committed by Caelan
parent fee5cb2148
commit 72af62649f
3 changed files with 68 additions and 1 deletions

View File

@@ -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)

View File

@@ -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

45
samples/PythonWXPython/build.sh Executable file
View File

@@ -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."