Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions .github/build.sh → .github/musl_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,24 @@ fi
TARGET=$1
MANYLINUX=$2

BASH_IMAGE="ghcr.io/0x676e67/rust-musl-cross"
IMAGE="ghcr.io/0x676e67/rust-musl-cross"
VOLUME_MAPPING="-v $(pwd):/home/rust/src"
MATURIN_CMD="maturin build --release --out dist --find-interpreter"

case $TARGET in
x86_64-unknown-linux-musl | \
x86_64-unknown-linux-gnu | \
aarch64-unknown-linux-musl | \
aarch64-unknown-linux-gnu | \
armv7-unknown-linux-musleabihf | \
armv7-unknown-linux-gnueabihf | \
i686-unknown-linux-musl | \
i686-unknown-linux-gnu)
i686-unknown-linux-musl)
;;
*)
echo "Unknown target: $TARGET"
exit 1
;;
esac

if [ "$MANYLINUX" == "manylinux" ]; then
echo "Building for manylinux..."
MATURIN_CMD="maturin build --release --target $TARGET --out dist --manylinux"
fi

echo "Building for $TARGET..."
docker run --rm $VOLUME_MAPPING $BASH_IMAGE:$TARGET /bin/bash -c "$MATURIN_CMD"
docker pull $IMAGE:$TARGET
docker run --rm $VOLUME_MAPPING $IMAGE:$TARGET /bin/bash -c "$MATURIN_CMD"

echo "Build completed for target: $TARGET"
51 changes: 41 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,25 +59,56 @@ jobs:
source .venv/bin/activate
pytest

linux:
manylinux:
runs-on: ${{ matrix.platform.runner }}
environment: ManyLinux
strategy:
fail-fast: false
matrix:
platform:
- runner: ubuntu-22.04
target: x86_64-unknown-linux-gnu
target: x86_64
apt_packages: ''
custom_env: {}
- runner: ubuntu-22.04
target: aarch64-unknown-linux-gnu
target: x86
apt_packages: crossbuild-essential-i386
custom_env:
CC: i686-linux-gnu-gcc
CXX: i686-linux-gnu-g++
CARGO_TARGET_I686_UNKNOWN_LINUX_GNU_LINKER: i686-linux-gnu-g++
- runner: ubuntu-22.04
target: armv7-unknown-linux-gnueabihf
target: aarch64
apt_packages: crossbuild-essential-arm64
custom_env:
CFLAGS_aarch64_unknown_linux_gnu: -D__ARM_ARCH=8
CC: aarch64-linux-gnu-gcc
CXX: aarch64-linux-gnu-g++
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-g++
- runner: ubuntu-22.04
target: i686-unknown-linux-gnu
target: armv7
apt_packages: crossbuild-essential-armhf
custom_env:
CC: arm-linux-gnueabihf-gcc
CXX: arm-linux-gnueabihf-g++
CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER: arm-linux-gnueabihf-g++
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Install target-specific APT dependencies
if: "matrix.platform.apt_packages != ''"
run: sudo apt-get update && sudo apt-get install -y ${{ matrix.platform.apt_packages }}
- name: Build wheels
run:
bash .github/build.sh ${{ matrix.platform.target }} manylinux
uses: PyO3/maturin-action@v1
with:
rust-toolchain: stable
target: ${{ matrix.platform.target }}
args: ${{ matrix.platform.target == 'x86_64' && '--release --out dist --zig' || '--release --out dist' }}
sccache: 'false'
manylinux: auto
container: 'off'
env: ${{ matrix.platform.custom_env }}
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
Expand All @@ -102,7 +133,7 @@ jobs:
- uses: actions/checkout@v4
- name: Build wheels
run:
bash .github/build.sh ${{ matrix.platform.target }}
bash .github/musl_build.sh ${{ matrix.platform.target }}
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -191,7 +222,7 @@ jobs:
name: Release
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
needs: [linux,musllinux, windows, macos, sdist, tests, style]
needs: [manylinux, musllinux, windows, macos, sdist, tests, style]
permissions:
# Use to sign the release artifacts
id-token: write
Expand Down