Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Publish PyPi Package

on:
release:
types: [published]
types: [created]

permissions:
contents: read
Expand All @@ -24,6 +24,8 @@ jobs:
python -m pip install --upgrade pip
python -m pip install --upgrade build
python -m pip install --upgrade twine
cd /PyPI/Package
cd PyPI/Package/src/webui
sh bootstrap.sh
cd ../..
python -m build
python -m twine upload --repository pypi dist/* --username __token__ --password ${{ secrets.PYPI_API_TOKEN }}
103 changes: 0 additions & 103 deletions .github/workflows/update_binaries.yml

This file was deleted.

19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
# Python binaries
PyPI/Package/src/webui/webui-windows-msvc-x64/
PyPI/Package/src/webui/webui-windows-msvc-arm/
PyPI/Package/src/webui/webui-windows-msvc-arm64/
PyPI/Package/src/webui/webui-macos-clang-x64/
PyPI/Package/src/webui/webui-macos-clang-arm/
PyPI/Package/src/webui/webui-macos-clang-arm64/
PyPI/Package/src/webui/webui-linux-gcc-x64/
PyPI/Package/src/webui/webui-linux-gcc-arm/
PyPI/Package/src/webui/webui-linux-gcc-arm64/
*.dll
*.so
*.dylib

# Archives
*.zip
*.tar
*.gz

# Build
*.exe
*.ilk
Expand Down
2 changes: 1 addition & 1 deletion PyPI/Package/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "webui2"
version = "2.4.0.3"
version = "2.4.1"
authors = [
{ name="Hassan Draga" },
]
Expand Down
119 changes: 119 additions & 0 deletions PyPI/Package/src/webui/bootstrap.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
@echo off
SETLOCAL

:: This script downloads the trusted WebUI compiled library by GitHub CI for Windows.

IF "%1"=="minimal" (
goto MINIMAL
)

:: --- Full -------------------------------------
:: Download WebUI library for all supported OS.
echo WebUI Deno Bootstrap
echo.

:: Creating the temporary cache folder
mkdir "cache" 2>nul 1>nul

:: Nightly Build
:: SET "LINUX_ARM=https://github.com/webui-dev/webui/releases/download/nightly/webui-linux-gcc-arm.zip"
:: SET "LINUX_ARM64=https://github.com/webui-dev/webui/releases/download/nightly/webui-linux-gcc-arm64.zip"
:: SET "LINUX_X64=https://github.com/webui-dev/webui/releases/download/nightly/webui-linux-gcc-x64.zip"
:: SET "MACOS_ARM64=https://github.com/webui-dev/webui/releases/download/nightly/webui-macos-clang-arm64.zip"
:: SET "MACOS_X64=https://github.com/webui-dev/webui/releases/download/nightly/webui-macos-clang-x64.zip"
:: SET "WINDOWS_MSVC_X64=https://github.com/webui-dev/webui/releases/download/nightly/webui-windows-msvc-x64.zip"

:: Release
SET "LINUX_ARM=https://github.com/webui-dev/webui/releases/download/2.4.1/webui-linux-gcc-arm.zip"
SET "LINUX_ARM64=https://github.com/webui-dev/webui/releases/download/2.4.1/webui-linux-gcc-arm64.zip"
SET "LINUX_X64=https://github.com/webui-dev/webui/releases/download/2.4.1/webui-linux-gcc-x64.zip"
SET "MACOS_ARM64=https://github.com/webui-dev/webui/releases/download/2.4.1/webui-macos-clang-arm64.zip"
SET "MACOS_X64=https://github.com/webui-dev/webui/releases/download/2.4.1/webui-macos-clang-x64.zip"
SET "WINDOWS_MSVC_X64=https://github.com/webui-dev/webui/releases/download/2.4.1/webui-windows-msvc-x64.zip"

:: Download and extract archives
CALL :DOWNLOAD_AND_EXTRACT %LINUX_ARM% webui-linux-gcc-arm webui-2.so
CALL :DOWNLOAD_AND_EXTRACT %LINUX_ARM64% webui-linux-gcc-arm64 webui-2.so
CALL :DOWNLOAD_AND_EXTRACT %LINUX_X64% webui-linux-gcc-x64 webui-2.so
CALL :DOWNLOAD_AND_EXTRACT %MACOS_ARM64% webui-macos-clang-arm64 webui-2.dylib
CALL :DOWNLOAD_AND_EXTRACT %MACOS_X64% webui-macos-clang-x64 webui-2.dylib
CALL :DOWNLOAD_AND_EXTRACT %WINDOWS_MSVC_X64% webui-windows-msvc-x64 webui-2.dll

:: Remove cache folder
echo * Cleaning...
rmdir /S /Q "cache" 2>nul 1>nul
exit /b

:: Download and Extract Function
:DOWNLOAD_AND_EXTRACT
echo * Downloading [%1]...
SET FULL_URL=%1
SET FILE_NAME=%2
SET LIB_DYN=%3
SET LIB_STATIC=%4
powershell -Command "Invoke-WebRequest '%FULL_URL%' -OutFile 'cache\%FILE_NAME%.zip'"
echo * Extracting [%FILE_NAME%.zip]...
mkdir "cache\%FILE_NAME%" 2>nul 1>nul
tar -xf "cache\%FILE_NAME%.zip" -C "cache"
IF NOT "%LIB_DYN%"=="" (
:: Copy dynamic library
echo * Copying [%LIB_DYN%]...
mkdir "%FILE_NAME%" 2>nul 1>nul
copy /Y "cache\%FILE_NAME%\%LIB_DYN%" "%FILE_NAME%\%LIB_DYN%" 2>nul 1>nul
)
IF NOT "%LIB_STATIC%"=="" (
:: Copy dynamic library
echo * Copying [%LIB_STATIC%]...
mkdir "%FILE_NAME%" 2>nul 1>nul
copy /Y "cache\%FILE_NAME%\%LIB_STATIC%" "%FILE_NAME%\%LIB_STATIC%" 2>nul 1>nul
)
GOTO :EOF

:: --- Minimal ----------------------------------
:: Download WebUI library for only the current OS.
:MINIMAL

SET "BASE_URL=https://github.com/webui-dev/webui/releases/download/2.4.1/"

:: Check the CPU architecture
IF "%PROCESSOR_ARCHITECTURE%"=="x86" (
:: x86 32Bit
:: SET "FILENAME=webui-windows-msvc-x86"
ECHO Error: Windows x86 32Bit architecture is not supported yet
exit /b
) ELSE IF "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
:: x86 64Bit
SET "FILENAME=webui-windows-msvc-x64"
) ELSE IF "%PROCESSOR_ARCHITECTURE%"=="ARM" (
:: ARM 32Bit
:: SET "FILENAME=webui-windows-msvc-arm"
ECHO Error: Windows ARM architecture is unsupported yet
exit /b
) ELSE IF "%PROCESSOR_ARCHITECTURE%"=="ARM64" (
:: ARM 64Bit
:: SET "FILENAME=webui-windows-msvc-arm64"
ECHO Error: Windows ARM64 architecture is unsupported yet
exit /b
) ELSE (
ECHO Error: Unknown architecture '%PROCESSOR_ARCHITECTURE%'
exit /b
)

:: Creating the temporary cache folder
mkdir "cache" 2>nul 1>nul
mkdir "cache\%FILENAME%" 2>nul 1>nul

:: Download the archive using PowerShell
powershell -Command "Invoke-WebRequest '%BASE_URL%%FILENAME%.zip' -OutFile 'cache\%FILENAME%.zip'"

:: Extract archive (Windows 10 and later)
tar -xf "cache\%FILENAME%.zip" -C "cache"

:: Copy library
mkdir "%FILENAME%" 2>nul 1>nul
copy /Y "cache\%FILENAME%\webui-2.dll" "%FILENAME%\webui-2.dll" 2>nul 1>nul

:: Remove cache folder
rmdir /S /Q "cache" 2>nul 1>nul

ENDLOCAL
122 changes: 122 additions & 0 deletions PyPI/Package/src/webui/bootstrap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
#!/bin/bash

# This script downloads the trusted WebUI compiled library by GitHub CI for Linux.

if [[ "$1" == "" ]]; then

# --- Full -------------------------------------
# Download WebUI library for all supported OS.
echo "WebUI Deno Bootstrap"
echo

# Creating the temporary cache folder
mkdir -p "cache" 2>/dev/null

# Nightly Build
# LINUX_ARM="https://github.com/webui-dev/webui/releases/download/nightly/webui-linux-gcc-arm.zip"
# LINUX_ARM64="https://github.com/webui-dev/webui/releases/download/nightly/webui-linux-gcc-arm64.zip"
# LINUX_X64="https://github.com/webui-dev/webui/releases/download/nightly/webui-linux-gcc-x64.zip"
# MACOS_ARM64="https://github.com/webui-dev/webui/releases/download/nightly/webui-macos-clang-arm64.zip"
# MACOS_X64="https://github.com/webui-dev/webui/releases/download/nightly/webui-macos-clang-x64.zip"
# WINDOWS_MSVC_X64="https://github.com/webui-dev/webui/releases/download/nightly/webui-windows-msvc-x64.zip"

# Release
LINUX_ARM="https://github.com/webui-dev/webui/releases/download/2.4.1/webui-linux-gcc-arm.zip"
LINUX_ARM64="https://github.com/webui-dev/webui/releases/download/2.4.1/webui-linux-gcc-arm64.zip"
LINUX_X64="https://github.com/webui-dev/webui/releases/download/2.4.1/webui-linux-gcc-x64.zip"
MACOS_ARM64="https://github.com/webui-dev/webui/releases/download/2.4.1/webui-macos-clang-arm64.zip"
MACOS_X64="https://github.com/webui-dev/webui/releases/download/2.4.1/webui-macos-clang-x64.zip"
WINDOWS_MSVC_X64="https://github.com/webui-dev/webui/releases/download/2.4.1/webui-windows-msvc-x64.zip"

# Download and extract archives
download_and_extract() {
echo "* Downloading [$1]..."
wget -q "$1" -O "cache/$2.zip"
echo "* Extracting [$2.zip]..."
mkdir -p "cache/$2" 2>/dev/null
unzip -q "cache/$2.zip" -d "cache"
if [ -n "$3" ]; then
echo "* Copying [$3]..."
mkdir -p "$2" 2>/dev/null
cp -f "cache/$2/$3" "$2/$3"
fi
if [ -n "$4" ]; then
echo "* Copying [$4]..."
mkdir -p "$2" 2>/dev/null
cp -f "cache/$2/$4" "$2/$4"
fi
}

download_and_extract $LINUX_ARM "webui-linux-gcc-arm" "webui-2.so"
download_and_extract $LINUX_ARM64 "webui-linux-gcc-arm64" "webui-2.so"
download_and_extract $LINUX_X64 "webui-linux-gcc-x64" "webui-2.so"
download_and_extract $MACOS_ARM64 "webui-macos-clang-arm64" "webui-2.dylib"
download_and_extract $MACOS_X64 "webui-macos-clang-x64" "webui-2.dylib"
download_and_extract $WINDOWS_MSVC_X64 "webui-windows-msvc-x64" "webui-2.dll"

# Remove cache folder
echo "* Cleaning..."
rm -rf "cache"
exit 0
fi

if [[ "$1" == "minimal" ]]; then

# --- Minimal ----------------------------------
# Download WebUI library for only the current OS.

# Nightly Build
# BASE_URL="https://github.com/webui-dev/webui/releases/download/nightly/"

# Release
BASE_URL="https://github.com/webui-dev/webui/releases/download/2.4.1/"

# Detect OS (macOS / Linux)
OS="linux"
CC="gcc"
EXT="so"
if [[ "$OSTYPE" == "darwin"* ]]; then
OS="macos"
CC="clang"
EXT="dylib"
fi

# Check the CPU architecture
ARCH=$(uname -m)
if [ "$ARCH" = "x86" ]; then
# x86 32Bit
# FILENAME="webui-${OS}-${CC}-x86"
echo "Error: Linux/macOS x86 32Bit architecture is not supported yet"
exit 1
elif [ "$ARCH" = "x86_64" ]; then
# x86 64Bit
FILENAME="webui-${OS}-${CC}-x64"
elif [ "$ARCH" = "arm" ]; then
# ARM 32Bit
FILENAME="webui-${OS}-${CC}-arm"
elif [ "$ARCH" = "aarch64" ]; then
# ARM 64Bit
FILENAME="webui-${OS}-${CC}-arm64"
else
echo "Error: Unknown architecture '$ARCH'"
exit 1
fi

# Creating the temporary cache folder
mkdir -p "cache/$FILENAME" 2>/dev/null

# Download the archive using wget
wget -q "$BASE_URL$FILENAME.zip" -O "cache/$FILENAME.zip"

# Extract archive
unzip -q "cache/$FILENAME.zip" -d "cache"

# Copy library
mkdir -p "$FILENAME" 2>/dev/null
cp -f "cache/$FILENAME/webui-2.${EXT}" "$FILENAME/webui-2.${EXT}"

# Remove cache folder
rm -rf "cache"

exit 0
fi
Loading