Skip to content

Commit ef3e765

Browse files
fix: build with better manylinux compatibility to prevent segfaults on different linux environments (#1332)
## 🎟️ Tracking https://bitwarden.atlassian.net/browse/SM-1540 ## 📔 Objective Fixes the segfaults described in #1288 by building with `--zig` and lowering the `manylinux` compatibility settings from the explicitly defined `2_28` to `2_17`, [which is implied](https://www.maturin.rs/distribution.html?highlight=zig#build-wheels) when passing `--zig`. ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## 🦮 Reviewer guidelines <!-- Suggested interactions but feel free to use (or not) as you desire! --> - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹ️ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠️ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or ♻️ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes
1 parent d41bdaf commit ef3e765

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

.github/workflows/build-python-wheels.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,22 +52,27 @@ jobs:
5252
- os: macos-13
5353
target: x86_64-apple-darwin
5454
python-version: "3.9"
55+
maturin-build-args: ""
5556

5657
- os: macos-13
5758
target: aarch64-apple-darwin
5859
python-version: "3.9"
60+
maturin-build-args: ""
5961

6062
- os: windows-2022
6163
target: x86_64-pc-windows-msvc
6264
python-version: "3.9"
65+
maturin-build-args: ""
6366

6467
- os: ubuntu-22.04
6568
target: x86_64-unknown-linux-gnu
6669
python-version: "3.9"
70+
maturin-build-args: "--zig"
6771

6872
- os: ubuntu-22.04
6973
target: aarch64-unknown-linux-gnu
7074
python-version: "3.9"
75+
maturin-build-args: "--zig"
7176

7277
steps:
7378
- name: Checkout repo
@@ -81,14 +86,19 @@ jobs:
8186
- name: Setup Node
8287
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
8388
with:
84-
node-version: 18
89+
node-version: 22
8590

8691
- name: Install rust
8792
uses: dtolnay/rust-toolchain@6d653acede28d24f02e3cd41383119e8b1b35921 # stable
8893
with:
8994
toolchain: stable
9095
targets: ${{ matrix.settings.target }}
9196

97+
- name: Set up Zig
98+
uses: mlugg/setup-zig@8d6198c65fb0feaa111df26e6b467fea8345e46f # v2.0.5
99+
with:
100+
version: 0.15.1
101+
92102
- name: Cache cargo registry
93103
uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5
94104
with:
@@ -105,18 +115,16 @@ jobs:
105115
uses: PyO3/maturin-action@ea5bac0f1ccd0ab11c805e2b804bfcb65dac2eab # v1.45.0
106116
with:
107117
target: ${{ matrix.settings.target }}
108-
args: --release --interpreter python${{ matrix.settings.python-version }}
118+
args: --release --interpreter python${{ matrix.settings.python-version }} ${{ matrix.settings.maturin-build-args }}
109119
sccache: true
110-
manylinux: "2_28" # https://github.com/pola-rs/polars/pull/12211
111120
working-directory: ${{ github.workspace }}/languages/python
112121

113122
- name: Build wheels (Linux - x86_64)
114123
if: ${{ matrix.settings.target == 'x86_64-unknown-linux-gnu' }}
115124
uses: PyO3/maturin-action@ea5bac0f1ccd0ab11c805e2b804bfcb65dac2eab # v1.45.0
116125
with:
117126
target: ${{ matrix.settings.target }}
118-
args: --release --sdist --interpreter python${{ matrix.settings.python-version }}
119-
manylinux: "2_28" # https://github.com/pola-rs/polars/pull/12211
127+
args: --release --sdist --interpreter python${{ matrix.settings.python-version }} ${{ matrix.settings.maturin-build-args }}
120128
working-directory: ${{ github.workspace }}/languages/python
121129

122130
- name: Upload wheels

languages/python/pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ dev-linux = [
3333

3434
[tool.maturin]
3535
bindings = "pyo3"
36-
compatibility = "2_28"
3736
include = [
3837
{ path = "bitwarden_sdk/*.py", format = ["sdist", "wheel"] },
3938
{ path = "LICENSE", format = ["sdist", "wheel"] }

0 commit comments

Comments
 (0)