Skip to content

Commit 42ec3ac

Browse files
authored
Merge pull request #115 from jguhlin/jg-branch-4
Fix cI?
2 parents ea69a01 + e50de47 commit 42ec3ac

File tree

5 files changed

+127
-40
lines changed

5 files changed

+127
-40
lines changed

.github/workflows/create-python-release.yaml

Lines changed: 69 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -28,38 +28,60 @@ jobs:
2828
strategy:
2929
matrix:
3030
platform:
31-
- runner: ubuntu-22.04
31+
- runner: ubuntu-24.04
3232
target: x86_64
33-
- runner: ubuntu-22.04
33+
- runner: ubuntu-24.04
3434
target: x86
35-
- runner: ubuntu-22.04
35+
- runner: ubuntu-24.04
3636
target: aarch64
37-
- runner: ubuntu-22.04
38-
target: armv7
39-
- runner: ubuntu-22.04
40-
target: s390x
41-
- runner: ubuntu-22.04
42-
target: ppc64le
4337
steps:
38+
- run: sudo apt-get update && sudo apt-get install -y build-essential
4439
- uses: actions/checkout@v4
40+
with:
41+
submodules: 'recursive'
4542
- run: cd minimappers2
4643
- uses: actions/setup-python@v5
4744
with:
4845
python-version: 3.x
46+
47+
# Conditionally install AArch64 cross-compiler and libraries
48+
- name: Install AArch64 Cross-Compiler and Libraries
49+
if: matrix.platform.target == 'aarch64'
50+
run: |
51+
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
52+
sudo apt-get update
53+
sudo apt-get install -y gcc-13-aarch64-linux-gnu gcc-13-aarch64-linux-gnu g++-13-aarch64-linux-gnu libc6-dev-arm64-cross
54+
55+
# Add the AArch64 Rust target
56+
- name: Add AArch64 Rust Target
57+
if: matrix.platform.target == 'aarch64'
58+
run: rustup target add aarch64-unknown-linux-gnu
59+
60+
# Set environment variables for cross-compilation
61+
# - name: Set Environment Variables for AArch64
62+
# if: matrix.platform.target == 'aarch64'
63+
# run: |
64+
# echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc-13" >> $GITHUB_ENV
65+
# echo "CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc-13" >> $GITHUB_ENV
66+
# echo "CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++-13" >> $GITHUB_ENV
67+
68+
4969
- name: Build wheels
5070
uses: PyO3/maturin-action@v1
5171
with:
5272
target: ${{ matrix.platform.target }}
5373
args: --release --out dist
5474
sccache: 'true'
5575
manylinux: auto
56-
- name: Build free-threaded wheels
57-
uses: PyO3/maturin-action@v1
58-
with:
59-
target: ${{ matrix.platform.target }}
60-
args: --release --out dist -i python3.13t
61-
sccache: 'true'
62-
manylinux: auto
76+
working-directory: "minimappers2"
77+
# - name: Build free-threaded wheels
78+
# uses: PyO3/maturin-action@v1
79+
# with:
80+
# target: ${{ matrix.platform.target }}
81+
# args: --release --out dist -i python3.13t
82+
# sccache: 'true'
83+
# manylinux: auto
84+
# working-directory: "minimappers2"
6385
- name: Upload wheels
6486
uses: actions/upload-artifact@v4
6587
with:
@@ -71,16 +93,17 @@ jobs:
7193
strategy:
7294
matrix:
7395
platform:
74-
- runner: ubuntu-22.04
96+
- runner: ubuntu-24.04
7597
target: x86_64
76-
- runner: ubuntu-22.04
98+
- runner: ubuntu-24.04
7799
target: x86
78-
- runner: ubuntu-22.04
100+
- runner: ubuntu-24.04
79101
target: aarch64
80-
- runner: ubuntu-22.04
81-
target: armv7
82102
steps:
103+
- run: sudo apt-get update && sudo apt-get install -y build-essential musl-tools
83104
- uses: actions/checkout@v4
105+
with:
106+
submodules: 'recursive'
84107
- run: cd minimappers2
85108
- uses: actions/setup-python@v5
86109
with:
@@ -92,13 +115,15 @@ jobs:
92115
args: --release --out dist
93116
sccache: 'true'
94117
manylinux: musllinux_1_2
95-
- name: Build free-threaded wheels
96-
uses: PyO3/maturin-action@v1
97-
with:
98-
target: ${{ matrix.platform.target }}
99-
args: --release --out dist -i python3.13t
100-
sccache: 'true'
101-
manylinux: musllinux_1_2
118+
working-directory: "minimappers2"
119+
# - name: Build free-threaded wheels
120+
# uses: PyO3/maturin-action@v1
121+
# with:
122+
# target: ${{ matrix.platform.target }}
123+
# args: --release --out dist -i python3.13t
124+
# sccache: 'true'
125+
# manylinux: musllinux_1_2
126+
# working-directory: "minimappers2"
102127
- name: Upload wheels
103128
uses: actions/upload-artifact@v4
104129
with:
@@ -118,6 +143,8 @@ jobs:
118143
target: aarch64
119144
steps:
120145
- uses: actions/checkout@v4
146+
with:
147+
submodules: 'recursive'
121148
- run: cd minimappers2
122149
- uses: actions/setup-python@v5
123150
with:
@@ -128,12 +155,14 @@ jobs:
128155
target: ${{ matrix.platform.target }}
129156
args: --release --out dist
130157
sccache: 'true'
131-
- name: Build free-threaded wheels
132-
uses: PyO3/maturin-action@v1
133-
with:
134-
target: ${{ matrix.platform.target }}
135-
args: --release --out dist -i python3.13t
136-
sccache: 'true'
158+
working-directory: "minimappers2"
159+
# - name: Build free-threaded wheels
160+
# uses: PyO3/maturin-action@v1
161+
# with:
162+
# target: ${{ matrix.platform.target }}
163+
# args: --release --out dist -i python3.13t
164+
# sccache: 'true'
165+
# working-directory: "minimappers2"
137166
- name: Upload wheels
138167
uses: actions/upload-artifact@v4
139168
with:
@@ -143,12 +172,16 @@ jobs:
143172
sdist:
144173
runs-on: ubuntu-latest
145174
steps:
175+
- run: sudo apt-get update && sudo apt-get install -y build-essential
146176
- uses: actions/checkout@v4
177+
with:
178+
submodules: 'recursive'
147179
- run: cd minimappers2
148180
- name: Build sdist
149181
uses: PyO3/maturin-action@v1
150182
with:
151183
command: sdist
184+
working-directory: "minimappers2"
152185
args: --out dist
153186
- name: Upload sdist
154187
uses: actions/upload-artifact@v4
@@ -169,6 +202,7 @@ jobs:
169202
# Used to generate artifact attestation
170203
attestations: write
171204
steps:
205+
- run: sudo apt-get update && sudo apt-get install -y build-essential
172206
- uses: actions/download-artifact@v4
173207
- run: cd minimappers2
174208
- name: Generate artifact attestation
@@ -181,5 +215,6 @@ jobs:
181215
env:
182216
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
183217
with:
218+
working-directory: "minimappers2"
184219
command: upload
185220
args: --non-interactive --skip-existing wheels-*/*

minimappers2/Cargo.toml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,20 @@ crate-type = ["cdylib", "rlib"]
1010
[dependencies]
1111
minimap2 = { version = "0.1.23", features = ["simde"], path = ".." }
1212
crossbeam = "0.8.4"
13-
mimalloc = {version = "0.1", default-features = false }
14-
15-
pyo3 = { version = "0.22" }
13+
pyo3 = { version = "0.22", features = ["abi3-py39", "chrono", "extension-module"] }
1614
polars = "0.45"
1715
pyo3-polars = "0.19"
1816

17+
[target.'cfg(all(any(not(target_family = "unix"), target_os = "emscripten", allocator = "mimalloc"), not(allocator = "default")))'.dependencies]
18+
mimalloc = { version = "0.1", default-features = false }
19+
20+
# Feature background_threads is unsupported on MacOS (https://github.com/jemalloc/jemalloc/issues/843).
21+
[target.'cfg(all(target_family = "unix", not(target_os = "macos"), not(target_os = "emscripten"), not(allocator = "mimalloc"), not(allocator = "default")))'.dependencies]
22+
jemallocator = { version = "0.5", features = ["disable_initial_exec_tls", "background_threads"] }
23+
24+
[target.'cfg(all(target_family = "unix", target_os = "macos", not(allocator = "mimalloc"), not(allocator = "default")))'.dependencies]
25+
jemallocator = { version = "0.5", features = ["disable_initial_exec_tls"] }
26+
1927
[profile.release]
2028
opt-level = 3
2129
lto = "fat"

minimappers2/build.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
fn main() {
2+
println!("cargo::rustc-check-cfg=cfg(allocator, values(\"default\", \"mimalloc\"))");
3+
println!(
4+
"cargo:rustc-env=TARGET={}",
5+
std::env::var("TARGET").unwrap()
6+
);
7+
}

minimappers2/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ classifiers = [
99
"Operating System :: POSIX :: Linux",
1010
"Programming Language :: Rust"
1111
]
12-
license = { file = "LICENSE" }
12+
# license = { file = "LICENSE" }
1313
description = "A Python wrapper for minimap2-rs"
1414
keywords = ["minimap2", "bioinformatics", "alignment", "mapping"]
1515
dependencies = [

minimappers2/src/lib.rs

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,52 @@ use std::num::NonZeroI32;
22
use std::sync::{Arc, Mutex};
33

44
use crossbeam::queue::ArrayQueue;
5-
use mimalloc::MiMalloc;
65
use minimap2::*;
76

87
use polars::{df, prelude::*};
98
use pyo3::prelude::*;
109
use pyo3_polars::{error::PyPolarsErr, PyDataFrame};
1110

11+
#[cfg(all(
12+
target_family = "unix",
13+
not(target_os = "emscripten"),
14+
not(allocator = "default"),
15+
not(allocator = "mimalloc"),
16+
))]
17+
use jemallocator::Jemalloc;
18+
#[cfg(all(
19+
not(debug_assertions),
20+
not(allocator = "default"),
21+
any(
22+
not(target_family = "unix"),
23+
target_os = "emscripten",
24+
allocator = "mimalloc"
25+
),
26+
))]
27+
use mimalloc::MiMalloc;
28+
1229
#[global_allocator]
13-
static GLOBAL: MiMalloc = MiMalloc;
30+
#[cfg(all(
31+
not(debug_assertions),
32+
not(allocator = "mimalloc"),
33+
not(allocator = "default"),
34+
target_family = "unix",
35+
not(target_os = "emscripten"),
36+
))]
37+
static ALLOC: Jemalloc = Jemalloc;
38+
39+
#[global_allocator]
40+
#[cfg(all(
41+
not(debug_assertions),
42+
not(allocator = "default"),
43+
any(
44+
not(target_family = "unix"),
45+
target_os = "emscripten",
46+
allocator = "mimalloc"
47+
),
48+
))]
49+
static ALLOC: MiMalloc = MiMalloc;
50+
1451

1552
mod multithreading;
1653

0 commit comments

Comments
 (0)