Skip to content

delete gallery plugin #925

delete gallery plugin

delete gallery plugin #925

Workflow file for this run

name: Build & Publish
on:
push:
branches:
- '**'
tags:
- '*'
paths:
- '.github/workflows/ci.yml'
- '.github/scripts/**'
- 'client/**'
- 'sdk/python/packages/**'
- 'packages/flet/**'
- '.fvmrc'
pull_request:
paths:
- '.github/workflows/ci.yml'
- '.github/scripts/**'
- 'client/**'
- 'sdk/python/packages/**'
- 'packages/flet/**'
- '.fvmrc'
workflow_dispatch:
permissions:
id-token: write
contents: write
concurrency:
group: ci-${{ github.workflow }}-${{ github.event.pull_request.head.ref || github.ref_name }}
cancel-in-progress: true
env:
ROOT: "${{ github.workspace }}"
SDK_PYTHON: "${{ github.workspace }}/sdk/python"
SCRIPTS: "${{ github.workspace }}/.github/scripts"
UV_PYTHON: "3.12"
PYODIDE_VERSION: "0.27.7"
jobs:
# ============
# Python tests
# ============
python_tests:
name: Python ${{ matrix.python-version }} tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [ "3.10", "3.11", "3.12", "3.13", "3.14" ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup uv
uses: astral-sh/setup-uv@v6
with:
python-version: ${{ matrix.python-version }}
- name: Run tests
shell: bash
working-directory: ${{ env.SDK_PYTHON }}
run: |
uv run --no-dev --group test pytest packages/flet/tests
- name: Run docs-coverage
if: matrix.python-version == '3.12'
shell: bash
working-directory: ${{ env.SDK_PYTHON }}
run: uv run --directory packages/flet --no-dev --group docs-coverage docstr-coverage > docstr_coverage.log 2>&1
- name: Upload docs-coverage logs
if: matrix.python-version == '3.12'
uses: actions/upload-artifact@v4
with:
name: docs-coverage
path: sdk/python/docstr_coverage.log
# ===========================
# Build Flet Flutter package
# ===========================
build_flet_package:
name: Build Flet Flutter package
runs-on: ubuntu-latest
outputs:
PKG_VER: ${{ steps.versions.outputs.PKG_VER }}
BUILD_VER: ${{ steps.versions.outputs.BUILD_VER }}
PYPI_VER: ${{ steps.versions.outputs.PYPI_VER }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch all history
fetch-tags: true # ensure tags are available
- name: Setup uv
uses: astral-sh/setup-uv@v6
- name: Compute versions
id: versions
run: source "${SCRIPTS}/update_build_version.sh"
- name: Setup Flutter
uses: kuhnroyal/flutter-fvm-config-action/setup@v3
with:
path: '.fvmrc'
cache: true
- name: Run tests
shell: bash
working-directory: packages/flet
run: flutter test
- name: Publish to pub.dev (Dry Run)
shell: bash
working-directory: packages/flet
run: dart pub publish --dry-run || exit 0
- name: Publish to pub.dev (Release)
if: ${{ github.ref_type == 'tag' }}
env:
PUB_DEV_TOKEN: ${{ secrets.PUB_DEV_TOKEN }}
shell: bash
working-directory: packages/flet
run: |
mkdir -p "$HOME/.config/dart"
printf %s "$PUB_DEV_TOKEN" | base64 --decode > "$HOME/.config/dart/pub-credentials.json"
# patch pubspec for release
patch_pubspec_version ./pubspec.yaml "$PKG_VER"
dart pub publish --force
# =============================
# Build Flet Client for Windows
# =============================
build_windows:
name: Build Flet Client for Windows
runs-on: windows-latest
needs:
- python_tests
- build_flet_package
env:
BUILD_VER: ${{ needs.build_flet_package.outputs.BUILD_VER }}
PYPI_VER: ${{ needs.build_flet_package.outputs.PYPI_VER }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup uv
uses: astral-sh/setup-uv@v6
- name: Setup Flutter
uses: kuhnroyal/flutter-fvm-config-action/setup@v3
with:
path: '.fvmrc'
cache: true
- name: Prepare env and patch versions
shell: bash
run: |
source "$SCRIPTS/common.sh"
patch_python_package_versions
patch_toml_versions "${SDK_PYTHON}/packages/flet-desktop/pyproject.toml" "$PYPI_VER"
- name: Build Flutter Windows client
env:
RUNNER_DIR: ${{ env.ROOT }}/client/build/windows/x64/runner
RELEASE_DIR: ${{ env.ROOT }}/client/build/windows/x64/runner/Release
shell: bash
working-directory: client
run: |
flutter build windows --build-name="$BUILD_VER"
# Copy needed runtime DLLs
cp "${WINDIR}/system32/msvcp140.dll" "$RELEASE_DIR"
cp "${WINDIR}/system32/vcruntime140.dll" "$RELEASE_DIR"
cp "${WINDIR}/system32/vcruntime140_1.dll" "$RELEASE_DIR"
# Rename Release folder to flet
mv "$RELEASE_DIR" "${RUNNER_DIR}/flet"
# Zip up the runner
cd "$RUNNER_DIR"
7z a "${ROOT}/client/flet-windows.zip" "flet"
# Stage app into flet-desktop package
FLET_DESKTOP_APP="${SDK_PYTHON}/packages/flet-desktop/src/flet_desktop/app"
mkdir -p "$FLET_DESKTOP_APP"
cp -r "flet" "${FLET_DESKTOP_APP}/flet"
- name: Build flet-desktop Python package
shell: bash
run: |
source "$SCRIPTS/common.sh"
cd "$SDK_PYTHON"
uv build --package flet-desktop --wheel
# Ensure glob expands
shopt -s nullglob
for wheel in dist/*-py3-none-any.whl; do
repackage_wheel_with_tag "$wheel" "py3-none-win_amd64"
repackage_wheel_with_tag "$wheel" "py3-none-win32"
rm -f "$wheel"
done
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: windows-artifacts
if-no-files-found: error
path: |
client/flet-windows.zip
sdk/python/dist/*.whl
# ===========================
# Build Flet Client for macOS
# ===========================
build_macos:
name: Build Flet Client for macOS
runs-on: macos-latest
needs:
- python_tests
- build_flet_package
env:
BUILD_VER: ${{ needs.build_flet_package.outputs.BUILD_VER }}
PYPI_VER: ${{ needs.build_flet_package.outputs.PYPI_VER }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup uv
uses: astral-sh/setup-uv@v6
- name: Setup Flutter
uses: kuhnroyal/flutter-fvm-config-action/setup@v3
with:
path: '.fvmrc'
cache: true
- name: Build Flutter macOS client
shell: bash
working-directory: client
run: |
flutter build macos --build-name="$BUILD_VER"
tar -czvf flet-macos.tar.gz -C build/macos/Build/Products/Release Flet.app
mkdir -p "${SDK_PYTHON}/packages/flet-desktop/src/flet_desktop/app"
cp flet-macos.tar.gz "${SDK_PYTHON}/packages/flet-desktop/src/flet_desktop/app"
- name: Build flet-desktop Python package
shell: bash
working-directory: ${{ env.SDK_PYTHON }}
run: |
source "$SCRIPTS/common.sh"
patch_python_package_versions
uv build --package flet-desktop --wheel
for file in dist/*-py3-none-any.whl; do
repackage_wheel_with_tag "$file" "py3-none-macosx_12_0_arm64"
repackage_wheel_with_tag "$file" "py3-none-macosx_10_14_x86_64"
rm "$file"
done
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: macos-artifacts
if-no-files-found: error
path: |
client/flet-macos.tar.gz
sdk/python/dist/*.whl
# ===========================
# Build Flet Client for Linux
# ===========================
build_linux:
name: Build Flet Client for Linux ${{ matrix.title }}
runs-on: ${{ matrix.runner }}
needs:
- python_tests
- build_flet_package
strategy:
matrix:
include:
- arch: arm64
runner: ubuntu-24.04-arm
build_arch: arm64
platform_arch: aarch64
title: ARM64
- arch: amd64
runner: ubuntu-24.04
build_arch: x64
platform_arch: x86_64
title: AMD64
env:
BUILD_VER: ${{ needs.build_flet_package.outputs.BUILD_VER }}
PYPI_VER: ${{ needs.build_flet_package.outputs.PYPI_VER }}
ARCH: ${{ matrix.arch }}
BUILD_ARCH: ${{ matrix.build_arch }}
PLATFORM_ARCH: ${{ matrix.platform_arch }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup uv
uses: astral-sh/setup-uv@v6
- name: Get Flutter version from ".fvmrc"
uses: kuhnroyal/flutter-fvm-config-action/config@v3
id: fvm-config-action
with:
path: '.fvmrc'
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ steps.fvm-config-action.outputs.FLUTTER_VERSION }}
channel: ${{ matrix.arch == 'arm64' && 'master' || 'stable' }} # https://github.com/subosito/flutter-action/issues/345#issuecomment-2657332687
cache: true
- name: Install dependencies
shell: bash
run: |
sudo sed -i.bak '/apt.postgresql.org/s/^/# /' /etc/apt/sources.list
sudo apt update --allow-releaseinfo-change
sudo apt install -y clang libgtk-3-dev libasound2-dev
sudo apt install -y \
libmpv-dev mpv \
libgstreamer1.0-dev \
libgstreamer-plugins-base1.0-dev \
libgstreamer-plugins-bad1.0-dev \
gstreamer1.0-plugins-base gstreamer1.0-plugins-good \
gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly \
gstreamer1.0-libav gstreamer1.0-tools gstreamer1.0-x \
gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 \
gstreamer1.0-qt5 gstreamer1.0-pulseaudio
- name: Build Flutter Linux clients
shell: bash
working-directory: client
run: |
STAGING_DIR="${RUNNER_TEMP:-/tmp}/flet_tars_${ARCH}"
echo "STAGING_DIR=$STAGING_DIR" >> "$GITHUB_ENV"
mkdir -p "$STAGING_DIR"
build_flutter() {
local PACKAGE_NAME="$1"
local SUFFIX=""
local FLAVOR="full"
if [[ "$PACKAGE_NAME" == "flet-desktop-light" ]]; then
SUFFIX="-light"
FLAVOR="light"
fi
echo "::group::($PACKAGE_NAME) Preparing sources"
# Reset Flutter app files so light edits don't leak into full or vice-versa
git checkout -- pubspec.yaml lib/main.dart || true
if [[ "$PACKAGE_NAME" == "flet-desktop-light" ]]; then
# Strip FAT_CLIENT blocks for the light flavor
sed -i '/--FAT_CLIENT_START--/,/--FAT_CLIENT_END--/d' pubspec.yaml
sed -i '/--FAT_CLIENT_START--/,/--FAT_CLIENT_END--/d' lib/main.dart
fi
echo "::endgroup::"
echo "::group::($PACKAGE_NAME) Flutter build"
flutter build linux --build-name="$BUILD_VER"
# Remove any previous build output, so mv below works as expected
rm -rf "build/linux/${BUILD_ARCH}/release/flet"
# Rename Flutter's default "bundle" output directory to "flet"
mv "build/linux/${BUILD_ARCH}/release/bundle" "build/linux/${BUILD_ARCH}/release/flet"
# Create a compressed tarball of the "flet" directory for distribution
tar -czvf "flet-linux${SUFFIX}-${ARCH}.tar.gz" -C "build/linux/${BUILD_ARCH}/release" flet
# Stage the archive
cp -f "flet-linux${SUFFIX}-${ARCH}.tar.gz" "${STAGING_DIR}/flet-linux-${FLAVOR}-${ARCH}.tar.gz"
echo "::endgroup::"
}
build_flutter "flet-desktop"
build_flutter "flet-desktop-light"
- name: Build flet-desktop and flet-desktop-light Python packages
shell: bash
working-directory: client
run: |
source "$SCRIPTS/common.sh"
# Ensure glob expands
shopt -s nullglob
# Patch Python package versions
pushd "$SDK_PYTHON"
patch_python_package_versions
# directory which will contain uv-build output
dist="${SDK_PYTHON}/dist"
FLET_DESKTOP="${SDK_PYTHON}/packages/flet-desktop"
FLET_DESKTOP_APP="${FLET_DESKTOP}/src/flet_desktop/app"
mkdir -p "$FLET_DESKTOP_APP"
build_wheels() {
local PACKAGE_NAME="$1"
local FLAVOR="full"
if [[ "$PACKAGE_NAME" == "flet-desktop-light" ]]; then
FLAVOR="light"
fi
echo "::group::($PACKAGE_NAME) Build wheels"
pushd "$FLET_DESKTOP"
# Move corresponding staged Linux client to the app directory, so it is part of wheel
rm -f "${FLET_DESKTOP_APP}"/flet-linux-${ARCH}.tar.gz
mv -f "${STAGING_DIR}/flet-linux-${FLAVOR}-${ARCH}.tar.gz" "${FLET_DESKTOP_APP}/flet-linux-${ARCH}.tar.gz"
# Patch the package name to match the current wheel's flavor and build
patch_toml_package_name pyproject.toml "$PACKAGE_NAME"
uv build --wheel
if [[ "$PACKAGE_NAME" == "flet-desktop-light" ]]; then
rm -rf "$FLET_DESKTOP_APP"
uv build --sdist
fi
# Find all universal wheels for the current package
universal=( "${dist}/${PACKAGE_NAME//-/_}-"*"-py3-none-any"*.whl )
if (( ${#universal[@]} == 0 )); then
echo "ERROR: No universal wheels found in ${dist} for ${PACKAGE_NAME}."
ls -laR "$dist" || true
exit 1
fi
# Wheel tags to generate from the universal wheel
wheel_tags=(
"py3-none-manylinux_2_17_${PLATFORM_ARCH},py3-none-manylinux2014_${PLATFORM_ARCH}"
"py3-none-musllinux_1_2_${PLATFORM_ARCH}"
)
# Repackage each universal wheel with all specified platform tags
for wheel in "${universal[@]}"; do
echo "Retagging $wheel"
for tag in "${wheel_tags[@]}"; do
echo "Tagging $wheel with $tag"
uv run "${SCRIPTS}/repackage_wheel_with_tag.py" "$wheel" "$tag"
done
# Delete the original universal wheel
rm -f "$wheel"
done
echo "::endgroup::"
}
build_wheels "flet-desktop"
build_wheels "flet-desktop-light"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: linux-${{ matrix.arch }}-artifacts
if-no-files-found: error
path: |
client/flet-linux*.tar.gz
sdk/python/dist/*.whl
sdk/python/dist/*.tar.gz
# =========================
# Build Flet Client for Web
# =========================
build_web:
name: Build Flet Client for Web
runs-on: ubuntu-latest
needs:
- python_tests
- build_flet_package
env:
PYPI_VER: ${{ needs.build_flet_package.outputs.PYPI_VER }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup uv
uses: astral-sh/setup-uv@v6
- name: Setup Flutter
uses: kuhnroyal/flutter-fvm-config-action/setup@v3
with:
path: '.fvmrc'
cache: true
- name: Build Web client
shell: bash
working-directory: client
run: |
# Compute Pyodide URLs
PYODIDE_URL="https://github.com/pyodide/pyodide/releases/download/${PYODIDE_VERSION}/pyodide-core-${PYODIDE_VERSION}.tar.bz2"
PYODIDE_CDN_URL="https://cdn.jsdelivr.net/pyodide/v${PYODIDE_VERSION}/full"
FLET_WEB="${SDK_PYTHON}/packages/flet-web/src/flet_web"
flutter build web --wasm
cp -R "build/web" "${FLET_WEB}"
# Safari mobile workaround: https://github.com/flutter/flutter/issues/145111#issuecomment-2714599139
FLUTTER_JS_DIR="$(dirname "$(command -v flutter)")/cache/flutter_web_sdk/flutter_js"
cp "$FLUTTER_JS_DIR/flutter.js.map" "${FLET_WEB}/web"
# Download the Pyodide tarball and extract its contents into the web build folder
curl -L "$PYODIDE_URL" | tar -xj -C "${FLET_WEB}/web"
# Download the prebuilt pyodide wheels
for wheel in "packaging-24.2-py3-none-any.whl" "micropip-0.8.0-py3-none-any.whl"; do
curl -L "${PYODIDE_CDN_URL}/${wheel}" -o "${FLET_WEB}/web/pyodide/${wheel}"
done
# Archive the web client into a gzipped tarball
tar -czvf "flet-web.tar.gz" -C "build/web" .
- name: Build flet-web Python package
shell: bash
working-directory: ${{ env.SDK_PYTHON }}
run: |
source "$SCRIPTS/common.sh"
patch_python_package_versions
uv build --package flet-web --wheel
rm -rf "packages/flet-web/src/flet_web/web"
uv build --package flet-web --sdist
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: web-artifacts
if-no-files-found: error
path: |
client/flet-web.tar.gz
sdk/python/dist/*.whl
sdk/python/dist/*.tar.gz
# ============================================
# Build Flet extension Python packages
# ============================================
build_flet_extensions:
name: Build Flet extensions
runs-on: ubuntu-latest
needs:
- python_tests
- build_flet_package
env:
PYPI_VER: ${{ needs.build_flet_package.outputs.PYPI_VER }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup uv
uses: astral-sh/setup-uv@v6
- name: Setup Flutter
uses: kuhnroyal/flutter-fvm-config-action/setup@v3
with:
path: '.fvmrc'
cache: true
- name: Analyze and Build Flutter & Python packages
shell: bash
working-directory: ${{ env.SDK_PYTHON }}
run: |
set -euo pipefail
PACKAGES=(
flet-ads
flet-audio
flet-audio-recorder
flet-charts
flet-datatable2
flet-flashlight
flet-geolocator
flet-lottie
flet-map
flet-permission-handler
flet-rive
flet-video
flet-webview
)
source "$SCRIPTS/common.sh"
for PACKAGE in "${PACKAGES[@]}"; do
echo "::group::Processing ${PACKAGE}"
FLUTTER_PACKAGE="${PACKAGE//-/_}"
FLUTTER_DIR="${SDK_PYTHON}/packages/${PACKAGE}/src/flutter/${FLUTTER_PACKAGE}"
pushd "$FLUTTER_DIR"
flutter pub get
dart analyze
popd
patch_toml_versions "packages/${PACKAGE}/pyproject.toml" "$PYPI_VER"
uv build --package "$PACKAGE"
echo "::endgroup::"
done
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: flet-python-extensions
if-no-files-found: error
path: |
sdk/python/dist/*.whl
sdk/python/dist/*.tar.gz
# =====================================
# Build flet, flet-cli and flet-desktop
# =====================================
build_flet_cli_desktop:
name: Build flet, flet-cli and flet-desktop Python packages
runs-on: ubuntu-latest
env:
PYPI_VER: ${{ needs.build_flet_package.outputs.PYPI_VER }}
needs:
- python_tests
- build_flet_package
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup uv
uses: astral-sh/setup-uv@v6
- name: Build Python packages
shell: bash
run: |
source "$SCRIPTS/common.sh"
patch_python_package_versions
uv build --package flet-cli
uv build --package flet
uv build --package flet-desktop --sdist
update_flet_wheel_deps dist
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: flet-cli-desktop-python-distribution
path: |
sdk/python/dist/*.whl
sdk/python/dist/*.tar.gz
# ===============================
# Publish Python packages to PyPI
# ===============================
py_publish:
name: Publish Python packages to PyPI
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main'
needs:
- python_tests
- build_flet_package
- build_flet_cli_desktop
- build_windows
- build_macos
- build_linux
- build_web
- build_flet_extensions
steps:
- name: Setup uv
uses: astral-sh/setup-uv@v6
with:
ignore-empty-workdir: true
cache-dependency-glob: ""
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Publish packages to PyPI
run: |
# remove client to avoid glob conflicts with its contents
rm -rf dist/client
for pkg in \
flet \
flet_cli \
flet_desktop \
flet_desktop_light \
flet_web \
flet_ads \
flet_audio \
flet_audio_recorder \
flet_charts \
flet_datatable2 \
flet_flashlight \
flet_geolocator \
flet_lottie \
flet_map \
flet_permission_handler \
flet_rive \
flet_video \
flet_webview; do
uv publish dist/**/${pkg}-*
done
# ==============
# GitHub Release
# ==============
release:
name: Publish GitHub Release
runs-on: ubuntu-latest
needs: py_publish
if: ${{ startsWith(github.ref, 'refs/tags/') }}
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Create/Update GitHub Release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: ${{ github.ref_name }}
tag_name: ${{ github.ref_name }}
generate_release_notes: true
preserve_order: true
overwrite_files: true
fail_on_unmatched_files: true
files: |
dist/**/*.whl
dist/**/*.tar.gz
dist/**/*.zip