Python: Attempt to build python packages with the same features as the nodejs/tool/etc. binaries

This commit is contained in:
Simon Hausmann 2024-06-18 16:42:48 +02:00 committed by Simon Hausmann
parent 83e7f8c6af
commit 3be6e641c6
6 changed files with 49 additions and 5 deletions

View file

@ -9,7 +9,7 @@ on:
env:
MACOSX_DEPLOYMENT_TARGET: "11.0"
# Keep in sync with features in nightly_snapshot.yaml, slint_tool_binary.yaml, and api/node/Cargo.toml
# Keep in sync with features in nightly_snapshot.yaml, slint_tool_binary.yaml, api/node/Cargo.toml, and api/python/Cargo.toml
SLINT_BINARY_FEATURES: "-DSLINT_FEATURE_BACKEND_LINUXKMS_NOSEAT=ON -DSLINT_FEATURE_BACKEND_WINIT=ON -DSLINT_FEATURE_RENDERER_FEMTOVG=ON -DSLINT_FEATURE_RENDERER_SKIA=ON -DSLINT_FEATURE_RENDERER_SOFTWARE=ON"
jobs:

View file

@ -22,7 +22,7 @@ on:
- cron: "0 4 * * *"
env:
# Keep in sync with features in slint_tool_binary.yaml, cpp_package.yaml, and api/node/Cargo.toml
# Keep in sync with features in slint_tool_binary.yaml, cpp_package.yaml, api/node/Cargo.toml, and api/python/Cargo.toml
SLINT_BINARY_FEATURES: "backend-linuxkms-noseat,backend-winit,renderer-femtovg,renderer-skia,renderer-software"
MACOSX_DEPLOYMENT_TARGET: "11.0"

View file

@ -15,7 +15,7 @@ on:
features:
type: string
description: features to enable for build
# Keep in sync with features in nightly_snapshot.yaml, cpp_package.yaml, and api/node/Cargo.toml
# Keep in sync with features in nightly_snapshot.yaml, cpp_package.yaml,api/node/Cargo.toml, and api/python/Cargo.toml
default: "backend-linuxkms-noseat,backend-winit,renderer-femtovg,renderer-skia,renderer-software"
codesign:
type: boolean
@ -30,7 +30,7 @@ on:
features:
type: string
description: features to enable for build
# Keep in sync with features in nightly_snapshot.yaml, cpp_package.yaml, and api/node/Cargo.toml
# Keep in sync with features in nightly_snapshot.yaml, cpp_package.yaml,api/node/Cargo.toml, and api/python/Cargo.toml
default: "backend-linuxkms-noseat,backend-winit,renderer-femtovg,renderer-skia,renderer-software"
codesign:
type: boolean

View file

@ -21,28 +21,45 @@ jobs:
platform:
- runner: windows-latest
target: x64
container: auto
- runner: macos-13
target: x86_64
container: auto
- runner: macos-14
target: aarch64
container: auto
- runner: ubuntu-latest
target: x86_64
container: auto
- runner: ubuntu-latest
target: aarch64
container: "ghcr.io/slint-ui/slint/aarch64-unknown-linux-gnu"
- runner: ubuntu-latest
target: armv7
container: "ghcr.io/slint-ui/slint/armv7-unknown-linux-gnueabihf"
runs-on: ${{ matrix.platform.runner }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install-linux-dependencies
if: runner.os == 'Linux'
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Prepare feature config for binaries
working-directory: api/python
shell: bash
run: |
perl -pi -e 's,^default =.*,,' Cargo.toml
perl -pi -e 's,# binaries:,,' Cargo.toml
echo "New defaults:"
grep "^\s*default =" Cargo.toml
- name: Build a binary wheel
uses: PyO3/maturin-action@v1
with:
working-directory: api/python
target: ${{ matrix.platform.target }}
args: --release --out wheelhouse --find-interpreter
container: ${{ matrix.platform.container }}
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
@ -54,6 +71,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Prepare feature config for binaries
working-directory: api/python
shell: bash
run: |
perl -pi -e 's,^default =.*,,' Cargo.toml
perl -pi -e 's,# binaries:,,' Cargo.toml
echo "New defaults:"
grep "^\s*default =" Cargo.toml
- name: Build source package
uses: PyO3/maturin-action@v1
with:

View file

@ -21,7 +21,7 @@ crate-type = ["cdylib"]
[features]
default = ["backend-winit", "renderer-femtovg", "renderer-software", "backend-qt", "accessibility"]
# Keep in sync with features in nightly_snapshot.yaml, cpp_package.yaml, and slint_tool_binary.yaml
# Keep in sync with features in nightly_snapshot.yaml, cpp_package.yaml, slint_tool_binary.yaml, and api/python/Cargo.toml
# binaries: default = ["backend-linuxkms-noseat", "backend-winit", "renderer-femtovg", "renderer-skia", "accessibility"]
backend-qt = ["slint-interpreter/backend-qt"]

View file

@ -17,6 +17,25 @@ rust-version.workspace = true
path = "lib.rs"
crate-type = ["cdylib"]
[features]
default = ["backend-winit", "renderer-femtovg", "renderer-software", "backend-qt", "accessibility"]
# Keep in sync with features in nightly_snapshot.yaml, cpp_package.yaml, slint_tool_binary.yaml, and api/node/Cargo.toml
# binaries: default = ["backend-linuxkms-noseat", "backend-winit", "renderer-femtovg", "renderer-skia", "accessibility"]
backend-qt = ["slint-interpreter/backend-qt"]
backend-winit = ["slint-interpreter/backend-winit"]
backend-winit-x11 = ["slint-interpreter/backend-winit-x11"]
backend-winit-wayland = ["slint-interpreter/backend-winit-wayland"]
backend-linuxkms = ["slint-interpreter/backend-linuxkms"]
backend-linuxkms-noseat = ["slint-interpreter/backend-linuxkms-noseat"]
renderer-femtovg = ["slint-interpreter/renderer-femtovg"]
renderer-skia = ["slint-interpreter/renderer-skia"]
renderer-skia-opengl = ["slint-interpreter/renderer-skia-opengl"]
renderer-skia-vulkan = ["slint-interpreter/renderer-skia-vulkan"]
renderer-software = ["slint-interpreter/renderer-software"]
accessibility = ["slint-interpreter/accessibility"]
[dependencies]
i-slint-backend-selector = { workspace = true }
i-slint-core = { workspace = true }