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: env:
MACOSX_DEPLOYMENT_TARGET: "11.0" 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" 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: jobs:

View file

@ -22,7 +22,7 @@ on:
- cron: "0 4 * * *" - cron: "0 4 * * *"
env: 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" SLINT_BINARY_FEATURES: "backend-linuxkms-noseat,backend-winit,renderer-femtovg,renderer-skia,renderer-software"
MACOSX_DEPLOYMENT_TARGET: "11.0" MACOSX_DEPLOYMENT_TARGET: "11.0"

View file

@ -15,7 +15,7 @@ on:
features: features:
type: string type: string
description: features to enable for build 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" default: "backend-linuxkms-noseat,backend-winit,renderer-femtovg,renderer-skia,renderer-software"
codesign: codesign:
type: boolean type: boolean
@ -30,7 +30,7 @@ on:
features: features:
type: string type: string
description: features to enable for build 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" default: "backend-linuxkms-noseat,backend-winit,renderer-femtovg,renderer-skia,renderer-software"
codesign: codesign:
type: boolean type: boolean

View file

@ -21,28 +21,45 @@ jobs:
platform: platform:
- runner: windows-latest - runner: windows-latest
target: x64 target: x64
container: auto
- runner: macos-13 - runner: macos-13
target: x86_64 target: x86_64
container: auto
- runner: macos-14 - runner: macos-14
target: aarch64 target: aarch64
container: auto
- runner: ubuntu-latest - runner: ubuntu-latest
target: x86_64 target: x86_64
container: auto
- runner: ubuntu-latest - runner: ubuntu-latest
target: aarch64 target: aarch64
container: "ghcr.io/slint-ui/slint/aarch64-unknown-linux-gnu"
- runner: ubuntu-latest - runner: ubuntu-latest
target: armv7 target: armv7
container: "ghcr.io/slint-ui/slint/armv7-unknown-linux-gnueabihf"
runs-on: ${{ matrix.platform.runner }} runs-on: ${{ matrix.platform.runner }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: ./.github/actions/install-linux-dependencies
if: runner.os == 'Linux'
- uses: actions/setup-python@v5 - uses: actions/setup-python@v5
with: with:
python-version: '3.10' 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 - name: Build a binary wheel
uses: PyO3/maturin-action@v1 uses: PyO3/maturin-action@v1
with: with:
working-directory: api/python working-directory: api/python
target: ${{ matrix.platform.target }} target: ${{ matrix.platform.target }}
args: --release --out wheelhouse --find-interpreter args: --release --out wheelhouse --find-interpreter
container: ${{ matrix.platform.container }}
- name: Store the distribution packages - name: Store the distribution packages
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
@ -54,6 +71,14 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - 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 - name: Build source package
uses: PyO3/maturin-action@v1 uses: PyO3/maturin-action@v1
with: with:

View file

@ -21,7 +21,7 @@ crate-type = ["cdylib"]
[features] [features]
default = ["backend-winit", "renderer-femtovg", "renderer-software", "backend-qt", "accessibility"] 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"] # binaries: default = ["backend-linuxkms-noseat", "backend-winit", "renderer-femtovg", "renderer-skia", "accessibility"]
backend-qt = ["slint-interpreter/backend-qt"] backend-qt = ["slint-interpreter/backend-qt"]

View file

@ -17,6 +17,25 @@ rust-version.workspace = true
path = "lib.rs" path = "lib.rs"
crate-type = ["cdylib"] 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] [dependencies]
i-slint-backend-selector = { workspace = true } i-slint-backend-selector = { workspace = true }
i-slint-core = { workspace = true } i-slint-core = { workspace = true }