Skip to content

Commit

Permalink
Merge pull request #114 from jguhlin/minimappers2-update
Browse files Browse the repository at this point in the history
minimappers2-update
  • Loading branch information
jguhlin authored Jan 7, 2025
2 parents 2fbf6d8 + 6229fdd commit ea69a01
Show file tree
Hide file tree
Showing 16 changed files with 9,683 additions and 3,526 deletions.
82 changes: 56 additions & 26 deletions .github/workflows/build-test-rust-minimappers2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,71 @@ on:
pull_request:
branches: [ "main" ]
paths:
- 'minimappers2/src/'
- 'minimappers2/Cargo.toml'
- minimappers2/src/
- minimappers2/Cargo.toml
- minimappers2/**
- .github/workflows/build-test-rust-minimappers2.yaml

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
RUSTFLAGS: -C debuginfo=0 # Do not produce debug symbols to keep memory usage down
RUST_BACKTRACE: 1
PYTHONUTF8: 1
CARGO_TERM_COLOR: always

defaults:
run:
working-directory: minimappers2
shell: bash

jobs:
test:
runs-on: ubuntu-latest
test-python:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ['3.9', '3.12', '3.13']

steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- run: cd minimappers2
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Create virtual environment
env:
BIN: ${{ matrix.os == 'windows-latest' && 'Scripts' || 'bin' }}
run: |
python -m venv .venv
echo "$GITHUB_WORKSPACE/minimappers2/.venv/$BIN" >> $GITHUB_PATH
echo "VIRTUAL_ENV=$GITHUB_WORKSPACE/minimappers2/.venv" >> $GITHUB_ENV
- name: Set up Rust
run: rustup show

- name: Cache Rust
uses: Swatinem/rust-cache@v2
with:
workspaces: minimappers2
save-if: ${{ github.ref_name == 'main' }}

- name: Install Python dependencies
run: |
pip install uv
uv pip install maturin
- name: Install minimappers2
run: maturin develop

- name: Build
run: cargo build --verbose

- name: Run tests
run: cargo test --verbose

build-manylinux-x64_64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: Test build
uses: messense/maturin-action@v1
env:
RUSTFLAGS: -C target-feature=+fxsr,+sse,+sse2,+sse3,+ssse3,+sse4.1,+sse4.2,+popcnt,+avx,+fma
with:
rust-toolchain: nightly-2025-01-08
maturin-version: '1.8.0'
command: build
args: -m minimappers2/Cargo.toml
run: cargo test --verbose
229 changes: 164 additions & 65 deletions .github/workflows/create-python-release.yaml
Original file line number Diff line number Diff line change
@@ -1,86 +1,185 @@
# Taken from Polar-rs github action

name: Create Python release
# This file is autogenerated by maturin v1.8.1
# To update, run
#
# maturin generate-ci github
#
name: CI

on:
push:
branches:
- main
- master
tags:
- py-*
- '*'
pull_request:
workflow_dispatch:

defaults:
run:
shell: bash

permissions:
contents: read

jobs:
manylinux-x64_64:
runs-on: ubuntu-latest
linux:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-22.04
target: x86_64
- runner: ubuntu-22.04
target: x86
- runner: ubuntu-22.04
target: aarch64
- runner: ubuntu-22.04
target: armv7
- runner: ubuntu-22.04
target: s390x
- runner: ubuntu-22.04
target: ppc64le
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- run: cd minimappers2
- uses: actions/setup-python@v5
with:
python-version: '3.7'

- name: Publish wheel
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
RUSTFLAGS: -C target-feature=+fxsr,+sse,+sse2,+sse3,+ssse3,+sse4.1,+sse4.2,+popcnt,+avx,+fma
with:
rust-toolchain: nightly-2024-02-04
maturin-version: '1.6.0'
command: publish
args: -m minimappers2/Cargo.toml --skip-existing -o wheels -u jguhlin

# Needed for Docker on Apple M1
# manylinux-aarch64:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-python@v4
# with:
# python-version: '3.7'
#
# - name: Publish wheel
# uses: messense/maturin-action@v1
# env:
# MATURIN_PASSWORD: ${{ secrets.PYPI_PASS }}
# with:
# rust-toolchain: nightly-2023-01-19
# target: aarch64-unknown-linux-gnu
# maturin-version: '0.14.10'
# command: publish
# args: -m minimappers2/Cargo.toml --skip-existing -o wheels -u jguhlin
target: ${{ matrix.platform.target }}
args: --release --out dist
sccache: 'true'
manylinux: auto
- name: Build free-threaded wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist -i python3.13t
sccache: 'true'
manylinux: auto
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.platform.target }}
path: dist

# uncomment to build a universal2 wheel
# we don't run it because it is twice as big and not needed because we build for both architectures separately
# macos-aarch64-universal:
# runs-on: macos-latest
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-python@v4
# with:
# python-version: '3.7'
musllinux:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-22.04
target: x86_64
- runner: ubuntu-22.04
target: x86
- runner: ubuntu-22.04
target: aarch64
- runner: ubuntu-22.04
target: armv7
steps:
- uses: actions/checkout@v4
- run: cd minimappers2
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist
sccache: 'true'
manylinux: musllinux_1_2
- name: Build free-threaded wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist -i python3.13t
sccache: 'true'
manylinux: musllinux_1_2
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-musllinux-${{ matrix.platform.target }}
path: dist

# - name: Fix README symlink
# run: |
# rm py-polars/README.md
# cp README.md py-polars/README.md
# No support for minimap2 for windows

# - name: Set up Rust
# uses: dtolnay/rust-toolchain@master
# with:
# toolchain: nightly-2023-01-19
macos:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: macos-13
target: x86_64
- runner: macos-14
target: aarch64
steps:
- uses: actions/checkout@v4
- run: cd minimappers2
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist
sccache: 'true'
- name: Build free-threaded wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist -i python3.13t
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-macos-${{ matrix.platform.target }}
path: dist

# - name: Set up Rust targets
# run: rustup target add aarch64-apple-darwin
sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: cd minimappers2
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: wheels-sdist
path: dist

# - name: Publish wheel
# uses: messense/maturin-action@v1
# env:
# MATURIN_PASSWORD: ${{ secrets.PYPI_PASS }}
# with:
# maturin-version: '0.14.10'
# command: publish
# args: -m py-polars/Cargo.toml --no-sdist --universal2 -o wheels -i python -u ritchie46
release:
name: Release
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/py-') || github.event_name == 'workflow_dispatch' }}
needs: [linux, musllinux, macos, sdist]
permissions:
# Use to sign the release artifacts
id-token: write
# Used to upload release artifacts
contents: write
# Used to generate artifact attestation
attestations: write
steps:
- uses: actions/download-artifact@v4
- run: cd minimappers2
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-path: 'wheels-*/*'
- name: Publish to PyPI
if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: PyO3/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
with:
command: upload
args: --non-interactive --skip-existing wheels-*/*
2 changes: 2 additions & 0 deletions minimappers2/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# GitHub syntax highlighting
pixi.lock linguist-language=YAML linguist-generated=true
3 changes: 3 additions & 0 deletions minimappers2/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# pixi environments
.pixi
*.egg-info
Loading

0 comments on commit ea69a01

Please sign in to comment.