Skip to content

Commit

Permalink
Python: Attempt to build python packages with the same features as th…
Browse files Browse the repository at this point in the history
…e nodejs/tool/etc. binaries
  • Loading branch information
tronical committed Jun 18, 2024
1 parent 83e7f8c commit 3be6e64
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cpp_package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly_snapshot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/slint_tool_binary.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/upload_pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion api/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
19 changes: 19 additions & 0 deletions api/python/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down

0 comments on commit 3be6e64

Please sign in to comment.